Re: [PATCH] USB: core: Tolerate protocol stall during hub and port status read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 May 2011, Libor Pechacek wrote:

> Protocol stall should not be fatal while reading port or hub status as it is
> transient state.  Currently hub EP0 STALL during port status read results in
> failed device enumeration.  This has been observed with ST-Ericsson (formerly
> Philips) USB 2.0 Hub (04cc:1521) after connecting keyboard.

Hmmm.  The USB spec says that a device is supposed to send a protocol 
stall when the request isn't supported or the device has an error.  
Neither should be true in this case.

But what can we do if the ST-Ericsson hub wants to be non-compliant...

> Signed-off-by: Libor Pechacek <lpechacek@xxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/usb/core/hub.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> This in fact extends the logic introduced by Alan in 645ff95d (USB: Hub driver:
> improve error checking and retries [10/13]).
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 93720bd..78e7f25 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -339,7 +339,8 @@ static int get_hub_status(struct usb_device *hdev,
>  {
>  	int i, status = -ETIMEDOUT;
>  
> -	for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) {
> +	for (i = 0; i < USB_STS_RETRIES &&
> +			(status == -ETIMEDOUT || status == -EPIPE); i++) {
>  		status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
>  			USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0,
>  			data, sizeof(*data), USB_STS_TIMEOUT);
> @@ -355,7 +356,8 @@ static int get_port_status(struct usb_device *hdev, int port1,
>  {
>  	int i, status = -ETIMEDOUT;
>  
> -	for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) {
> +	for (i = 0; i < USB_STS_RETRIES &&
> +			(status == -ETIMEDOUT || status == -EPIPE); i++) {
>  		status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
>  			USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1,
>  			data, sizeof(*data), USB_STS_TIMEOUT);

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux