64 is the _max_ packet size. A single transfer may be shorter; it does not 
matter if the rest of the buffer is filled with zeros or some garbage since 
the "data" transfered is contained in just the first x bytes of the buffer 
where x is the return value from bulkTransfer. For continuous transfer, 
just call bulkTransfer multiple times. I don't know why you want to set a 
baud rate. You don't do this with usb transfers.

Am Dienstag, 3. April 2012 20:14:30 UTC+2 schrieb ashish sharma:
>
> Hello,
>
> I am working with Lenovo tablet (Android 3.1) and I want to fetch data 
> from Telosb sensor. The sensor has following interface and endpoint
>
> Interface 0
> Endpoint 0: Inbound, type- bulk, max packet size- 64
> Endpoint 1: Outbound, type- bulk, max packet size- 64
>
> I want to read the data from sensor and I used UsbDeviceConnection and 
> bulkTransfer(endpoint, buffer, length, timeout) method to get the data. The 
> "byte[] buffer" field in the method must have the data from the sensor at 
> endpoint 0 is what I understand from the documentation. When I read in this 
> way, only 2 bytes (length= 64) are read and rest are zeros. Can anyone 
> explain what might be the cause for this? Also, how do I set the baud rate? 
> How do I read data from the sensor continuously?
>
> Thanks,
> Ashish.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to