I made some experiences with a USB bluetooth device. What I did was setting the device up and down (alternating "hciconfig hci0 up" and "hciconfig hci0 down"). Doing this the USB INT endpoint from this device is added, removed, added, removed, and so on. I am using a 2.4.21 kernel.
If the device is always connected, the endpoint will always be present ... unless perhaps it's only found in an altsetting, which is enabled by your "up" processing and disabled by your "down" processing.
Analysing the problem I found that the host controller returned a data0/data1 toggle mismatch in the failure case. After analysing the packets on the USB line I recognised that the USB device does not reinit its toggling scheme with up and down commands. After the first up it continues toggling forever. According to the spec this behaviour should be correct.
When device drivers need to reset the toggling, they are responsible for doing that themselves. For example, by issuing a SET_INTERFACE call to the relevant interface. If they initialize ("up") without resetting that toggle, they get whatever was left over from any previous usage.
In the driver I found some code using usb_gettoggle() that might be intended to address this problem, but without effect, because there is no corresponding usb_settoggle() when an endpoint is removed.
The 2.4 kernels have no "endpoint remove" operation short of unplug; 2.6 does it internally at other places. (It eliminates some races in the unplug logic, and is needed to handle certain config changes.)
It's possible that your device would need such an operation ... but I suspect your "up" processing just isn't (re)initializing enough.
I would like to know where the problem can be fixed best: - Should each toggle state be tracked with usb_settoggle ?
Only if you're using the iso-oriented "no toggle" mode.
- Could Bit 2 in ed->hwHeadP be saved somehow ?
In 2.4 kernels it's never removed == already saved.
- There is also a Bit in td->hwINFO used with toggling. Can this be used ?
No point in using it except for the no-toggle mode.
Sounds to me like your up() logic probably needs to add usb_set_interface() calls to reset all its interfaces to known states before using them...
- Dave
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel