[Barry-devel] Setting alternate interface in Usb::Interface::Interface
Status: Beta
Brought to you by:
ndprojects
From: Toby G. <tob...@re...> - 2010-09-21 11:13:06
|
Hi, As has been mentioned previously, I'm trying to track down why doing USB mass storage operations while Barry is running will lead to bad things happening such as USB port getting reset, device rebooting. After weeks of assuming it was down to the various differences in how the usb-storage is implemented between Linux and Windows I decided to have a look at what Barry was doing. I then noticed that all the issues seem to happen when a SET INTERFACE message for interface 0 is sent to the BlackBerry while some URBs are outstanding on the mass storage interface (which is interface 1, so should be ok). However it seems that this upsets the BlackBerry. Looking into the Barry code I noticed that commit 5301cd76 added code to call usb_set_altinterface from Interface::Interface. As it stands, I don't think this code is correct as usb_set_altinterface wants a bAlternateSetting value but usb_claim_interface, which is passed the same iface value wants a bInterfaceNumber. As far as I understand it, alternate settings in USB are distinct from interface number. The BlackBerry 8310 I have to hand only has one alternate setting and commenting out the call to usb_set_altinterface removes all issues with using USB mass storage and Barry concurrently. However there's clearly a reason for the call to usb_set_altinterface, so can anyone remember what devices it was necessary for? Depending on the history of that call and what devices it was needed for, I'd suggest doing one of the following: 1) Removing the call to it entirely 2) Only call it if there are multiple alternate settings 3) Add it as an option for the various tools and API users 4) Carry on calling it but using a bAlternateSettings value retrieved from the device; this won't fix the mass storage issue but will fix the Barry code. What do people think? Regards, Toby |