On Thu, Mar 05, 2009 at 11:34:36AM -0500, Alan Stern wrote: > A complete usbmon starting from before the device was plugged in might > help to settle the issue. After all, following a fresh plug-in the > toggle value definitely should be 0 on both the device and the host, no > matter what. Thanks Alan for the explanation of toggle behaviour. All my testing has been through a VM, changing the kernel in the VM while leaving the kernel in the host the same. I'm not sure if a usbmon capture in this setup will be as clean as you need, since you said that toggle behaviour is handled by the hardware: in this case, the host hardware and the QEMU code. I've created two usbmon captures anyway. 0u.txt is with the extra set_altinterface() call, and it works. 0u-hant.txt is without, and it hangs as usual. Both were created by plugging the device into the host OS, fresh. Then in the VM, starting the usbmon cat from 0u, and activating the usb device in QEMU with 'usb_add host:0fca:0004'. The VM usb_storage would see the device and claim it, then I would run a breset, which calls usb_reset() on all blackberry devices. Then I run btool, which, internally, will do one set of usb_open/claim/close calls to probe the device, and another set to access the database. It is in the second set that the device hangs. If I don't use breset first, then it will hang in the probe messages, but I think this is a separate issue. I apologise for the complexity of my test setup. It was the only way I could reproduce things at all. > Calling usb_set_altinterface() at the start should always be safe and > it should work around the problem, whatever the ultimate cause is. The good news is that this seems to have fixed similar hangs on Mac OS X and, pending feedback, FreeBSD, so it is a good fix all around, and may indicate that the Linux kernel was more forgiving before, and the new behaviour is not due to a bug. Thanks again for your help, - Chris
Attachment:
0u.txt.gz
Description: GNU Zip compressed data
Attachment:
0u-hang.txt.gz
Description: GNU Zip compressed data