Hi,

I've been trying to track down an issue with brawchannel where it will 
stop sending any data to the blackberry. This happens if the device is 
left connected with a mostly idle raw channel for anywhere between 1 
minute and 2.5 hours.

I believe that I've tracked the issue down to a limitation of the libusb 
0.1 API.  If the bulk read gets data just as it's about to timeout then 
libusb 0.1 just drops that data and returns the timeout. There's nothing 
libusb 0.1 can do as the function prototype is:

       int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int 
size, int timeout);

However libusb 1.0 has an improved reading API which allows it to return 
the partial read and the timeout value as it has the following prototype:

       int libusb_bulk_transfer (struct libusb_device_handle 
*dev_handle, unsigned char endpoint, unsigned char *data, int length, 
int *transferred, unsigned int timeout)

Luckily the libusb-0.1 compatibility layer has slightly different 
behaviour from libusb 0.1, returning the partial read rather than the 
error (see 
http://www.libusb.org/browser/libusb-compat-0.1/libusb/core.c#L758).

So for the time being we are favouring using libusb 1.0 with the 
libusb-0.1 compatibility layer as it improves the reliability of the raw 
channels. I've never seen this issue when using libusb 1.0 + 
libusb-compat-0.1, even after leaving a connection open for days.

Because of this I've been thinking of adding support for libusb 1.0 to 
Barry. Are there any objections to adding support for libusb 1.0, 
provided that libusb 0.1 is still supported?

My thinking was to have the configure script preferring libusb 1.0 to 
libusb 0.1, but falling back to using libusb 0.1 if libusb 1.0 isn't 
available. I would imagine that most users of Barry are most interested 
in syncing with the device, so the connections aren't open anywhere near 
long enough to see this issue, so it would seem silly to force people to 
have libusb 1.0.

I almost certainly won't have time to do this change immediately, but 
before working on it in spare time I wanted to check with the Barry 
community for any suggestions.

Regards,

Toby


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to