Re: [PATCH] USB: accept 1-byte Device Status replies
David Brownell <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <20070814155154.2F9CD2350CA@adsl-69-226-248-13.dsl.pltn13.pacbell.net> |
> From: Alan Stern <[email protected]> > > Some devices have a bug which causes them to send a 1-byte reply to > Get-Device-Status requests instead of 2 bytes as required by the > spec. This doesn't play well with autosuspend, since we look for a > valid status reply to make sure the device is still present when it > resumes. Without both bytes, we assume the device has been > disconnected. > > Lack of the second byte shouldn't matter much, since the spec requires > it always to be equal to 0. Hence this patch (as959) causes > finish_port_resume() to accept a 1-byte reply as valid. ACK. I've certainly been tempted to return single bytes there on occasion. ;) > Signed-off-by: Alan Stern <[email protected]> > > --- > > Index: usb-2.6/drivers/usb/core/hub.c > =================================================================== > --- usb-2.6.orig/drivers/usb/core/hub.c > +++ usb-2.6/drivers/usb/core/hub.c > @@ -1764,9 +1764,10 @@ static int finish_port_resume(struct usb > * and device drivers will know about any resume quirks. > */ > if (status == 0) { > + devstatus = 0; > status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); > if (status >= 0) > - status = (status == 2 ? 0 : -ENODEV); > + status = (status > 0 ? 0 : -ENODEV); > } > > if (status) { > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel