When opening a pipe, usbd_setup_pipe() will do a usbd_clear_endpoint_stall()

to make sure the pipe is ready. Some devices apparently don't support
the clear stall command however. So what happens when you issue such
devices a clear stall command? Typically, the command just times out.
This, at least, is the behavior I've observed with two devices that
I own: a Rio600 mp3 player and a T-Mobile Sidekick II.

It used to be that after the timeout expired, the pipe open operation
would conclude and you could still access the device, with the only
negative effect being a long delay on open. But in the recent past,
someone added code to make the timeout a fatal error, thereby breaking
the ability to communicate with these devices in any way.

I don't know exactly what the right solution is for this problem:
presumeably there is some way to determine whether or not a device
supports the 'clear stall' command beyond just issuing one and waiting
to see if it times out, but I don't know what that is. So for now,
I've added a special case to the error checking code so that the
timeout is once again non-fatal, thereby letting me use my two
devices again.
This commit is contained in:
wpaul 2004-09-29 18:12:33 +00:00
parent 65ddcbed6a
commit 5a8a07121e

View File

@ -818,9 +818,14 @@ usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface,
/* Clear any stall and make sure DATA0 toggle will be used next. */
if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) {
err = usbd_clear_endpoint_stall(p);
/* Some devices reject this command, so ignore a STALL. */
if (err && err != USBD_STALLED) {
printf("usbd_setup_pipe: failed to start endpoint, %s\n", usbd_errstr(err));
/*
* Some devices reject this command, so ignore a STALL. */
* Some device just time out on this command, so ignore
* that too.
*/
if (err && err != USBD_STALLED && err != USBD_TIMEOUT) {
printf("usbd_setup_pipe: failed to start "
"endpoint, %s\n", usbd_errstr(err));
return (err);
}
}