Hi Daniel,

В Mon, 31 Oct 2011 15:43:17 +0100
Daniel Golle <[email protected]> пишет:

> Hi Alexander,
> 
> On 10/26/2011 06:00 PM, Alexander Gordeev wrote:
> > I think this is not necessarily USB problem. I've got a couple of times
> > in the same situation when libusb returned something strange. Both
> > times it was a bug in uClibc. :)
> > I'll be happy to help with this issue.
> So now, I got another o2 prepaid surfstick and changed the hotplug script so 
> it
> calls strace $usb_modeswitch,
> see
> modeswitch fails (1st try) http://pastebin.com/a0V4KC3D
> vs.
> modeswitch succeeds (2nd try) http://pastebin.com/nbC0Ndfi
> 
> the first significant difference between the two logs seems to be that on the
> first try, usb-storage didn't claim the endpoint yet. After claiming the

This is the first try (which failed) and I think that it is exactly the
opposite i.e. usb-storage has already claimed the device and
usb-modeswitch detaches it:

ioctl(3, USBDEVFS_GETDRIVER, 0x7f8ce808) = 0
ioctl(3, USBDEVFS_IOCTL, 0x7f8ce900)    = 0
ioctl(3, USBDEVFS_CLAIMINTERFACE, 0x7f8ce904) = 0

And the second try (that worked), ENODATA is returned when either no
interface with this number is present or no driver is active, which is
the case here probably:

ioctl(3, USBDEVFS_GETDRIVER, 0x7f909378) = -1 ENODATA (No data available)
ioctl(3, USBDEVFS_CLAIMINTERFACE, 0x7f909474) = 0

> interface with libusb, some calls to USBDEVFS_SUBMITURB go out, interestingly 
> 2
> times in the first case (fails) and 3 times in the 2nd case (succeeds)...
> Then there seems to be some active waiting for the reply in both cases, just 
> the
> on the first try usb_modeswitch gives up waiting after a long time and on the
> retry it receives a reply a few moments after the message was sent.

Correction: both times three URBs are sent:

The first try:
1. send first URB, wait -> success
2. send second URB, wait -> timeout, discard urb
3. send third URB, wait -> timeout, discard urb
4. check that target device appears many times -> no success

The second try:
1. send first URB, wait -> success
2. send second URB, wait -> success
3. send third URB, wait -> timeout, discard urb
4. release interface
5. check for target device -> success, it's now /proc/bus/usb/001/003

> My first thought was to try just waiting a bit longer before calling
> usb_modeswitch, so a added a sleep 60 in the hotplug script before calling
> usb_modeswitch. Now, usb-storage does claim the interface but usb_modeswitch
> still fails, eventhough usb-storage was loaded and the boot has fully 
> completed
> at the time usb_modeswitch was called then. See
> 
> modeswitch still fails when sleeping 60 seconds before the 1st try
> http://pastebin.com/0uQVWDx1

Right, I see that it deactivates usb-storage here.
So the rule I see here is that:
1. if usb-modeswitch has to deactivate usb-storage, it fails
2. if usb-modeswitch doesn't have to deactivate usb-storage, it works

> Any ideas?

Please remove usb-storage module from your filesystem. You can then
restore it from /rom. This will show us if the problem is with
usb-storage.

-- 
  Alexander
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to