From: Alan Stern <[EMAIL PROTECTED]>
>
> I've tried to reset all endpoints (0,5 and 7) and rescan the usb bus once
> the firmware is uploaded and before sending the first control message. But
> it doesn't solve the problem : I still get the USB control message timeouts.


Do you call usb_reset_device()?


I've tried to use usb_reset() from libusb. I use the following code :

 usb_release_interface(adsl_handle, 0);
 usb_release_interface(adsl_handle, 2);

usb_reset(adsl_handle);

sleep(1);

 if (usb_find_busses() < 0)
 {
   printf(gettext("Error: I can't find busses\n"));
   return -1;
 }
 if (usb_find_devices() < 0)
 {
   printf(gettext("Error: I can't find devices\n"));
   return -1;
 }

/* search first ADSL USB modem */
bus = usb_busses;
goon = 1;
while (bus && goon)
{
dev = bus->devices;
while (dev && goon)
{
tmodem = check_modem(dev->descriptor.idVendor, dev->descriptor.idProduct);
if (tmodem > 0)
{
goon = 0;
adsl_dev = dev;
}
else
dev = dev->next;
}
if (goon)
bus = bus->next;
}
if (adsl_dev == NULL)
{
printf(gettext("Error: I didn't find ADSL modem\n"));
return -1;
}
printf(gettext("I found ADSL modem with VendorID = %04x & ProductID = %04x\n"), adsl_dev->descriptor.idVendor, adsl_dev->descriptor.idProduct);
/* connect to ADSL modem */
adsl_handle = usb_open(adsl_dev);
if (adsl_handle == NULL)
{
printf(gettext("Error: Couldn't get device handle for ADSL modem\n"));
return -1;
}


It is able to find the ADSL Modem.
But the call to usb_open(adsl_dev) fails: it returns NULL.
The program stops with the message "Error: Couldn't get device handle for ADSL modem".


Is this how I'm supposed to use usb_reset() ?


That doesn't seem likely -- if the firmware was buggy it probably wouldn't
work with any kernel.  But it might be worthwhile doing a detailed
comparison of 2.4.21-pre3 and 2.4.21-pre4 to try and find the differences.

The problem happens between 2.4.21-pre4 and pre5. The following patch breaks things :


--- include/linux/usb.h.orig    2003-11-12 23:39:28.000000000 +0100
+++ include/linux/usb.h 2003-11-12 23:41:13.000000000 +0100
@@ -996,9 +996,9 @@
#define usb_pipebulk(pipe)      (usb_pipetype((pipe)) == PIPE_BULK)

/* The D0/D1 toggle bits ... USE WITH CAUTION (they're
almost hcd-internal) */
-#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out]

(ep)) & 1)
-#define        usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^=
(1 << (ep)))
-#define usb_settoggle(dev, ep, out, bit)
((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 <<
(ep))) |
((bit) << (ep)))
+#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out]

ep) & 1)
+#define        usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^=
(1 << ep))
+#define usb_settoggle(dev, ep, out, bit)
((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 <<
ep)) |
((bit) << ep))

/* Endpoint halt control/status ... likewise USE WITH
CAUTION */
#define usb_endpoint_running(dev, ep, out)
((dev)->halted[out] &= ~(1 << (ep)))


Cheers,


Mathias Gug

_________________________________________________________________
Dialoguez en direct et gratuitement avec vos amis sur http://g.msn.fr/FR1001/866 MSN Messenger !




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to