USB Gurus, In getting the Blackberry device working on Linux I have run into a snag. I know what is wrong and I am looking for suggestions as to the best approach to making it work. Right now, the only way I see this happening is by making some changes to USB core. So I am hoping those of you with the deep understanding of the USB architecture can point me in the right direction.
=================== PROBLEM DESCRIPTION =================== The Blackberry device, hereafter referred to as the BB device, has a single config and looking at the device descriptor it indicates it only needs 100ma. But this is not enough current to allow the device to recharge itself and eventually the battery will run down to nothing. Turns out that the BB device needs to tell the HUB that it needs 500ma so that it may recharge itself. Fair enough, that's what multiple configs are for. But no, there is only a single config and it says 100ma. Somehow it works on Windows so there must be a way to make it work. After watching USB protocol with a USB analyzer of the BB on a Windows system, I have found some interesting things. The device developers got real sneaky about getting the device to show that it needs 500ma instead of 100ma. The way they do this is that a secret command (vendor/class specific) is sent to the BB device and then a SET_CONFIGURATION is sent to the device. The device resets itself (the same as unplugging and replugging) and the Windows USB core reassigns the device address and reads the device descriptor and lo and behold it now says it needs 500ma. The device descriptor of a single configuration device has been altered. Let me repeat this. Upon seeing the secret command, the next call to a SET_CONFIGURATION will cause the BB to reset itself and actually change the device descriptor from indicating it uses the default power setting of 100ma to the high power setting of 500ma. I can't imagine this is a common way of handling multiple power requirements. I have also found that if you read the device descriptor to soon after doing this that the data is still changing and you will get garbage for the device descriptor. You need to wait a while and let the device settle down before reading the device descriptor. Anytime a SET_CONFIGURATION is sent to the device without being preceeded by the secret vendor specific command the device reverts to the previous device descriptor data indicating 100ma. A normal reset causes it to default to the normal power setting. So, my basic problem is that the Linux USB core does the SET_CONFIGURATION as part of device initialization after the device is plugged in, long before my driver is probed. I never get the opportunity to send the secret command to the device. If I actually write the secret command followed by a SET_CONFIGURATION from my driver the BB device will reset itself but the Linux core does another SET_CONFIGURATION upon seeing the reset and so the hidden device descriptor data has reverted back to the low power setting. ================= POSSIBLE SOLUTION ================= Sure it would be easy just to hack in something in USB core that looks at the vendor/device id and writes this secret command immediately before the SET_CONFIGURATION if it sees the BB device. But that is too hackish. I am looking for the correct solution. I know that USB core attemps to set the device to the first configuration and then pick various interfaces that make sense. Calling probe routines for each interface that is active in that config. In addition, for other reasons, I need a single driver that owns all interfaces. What I need to do is modify the USB Core so that I can register a driver that wants to own sending all SET_CONFIGURATION commands to the device, own all the interfaces, and generally manage everything about the device with the exception of assigning the device address. What I need is to bind the driver to a device and not an interface and have USB core do nothing more than assign the device address. Suggestions ? Comments ? Thanks, Mike King Hewlett-Packard ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel