On Sun, Mar 20, 2016 at 06:09:57PM +0100, Guido Trentalancia wrote:
> Hello.
> 
> Considering that EM interference can last for a while (generally up to
> seconds), I am currently testing the following patch for module usbcore
> so that it is possible to specify an amount of time to wait before
> trying to re-enable a port that has been previously disabled by the hub
> (supposedly because of EM interference).
> 
> Hopefully, setting the right positive value (for example, 2000
> milliseconds) would help overcome situations such as the following:
> 
> [ 1295.575679] usb 6-2: FTDI USB Serial Device converter now attached
> to ttyUSB1
> [ 1302.204285] usb usb6-port2: disabled by hub (EMI?), re-enabling...
> 
> *** NOTE: EMI is probably still present here ***
> 
> [ 1303.205202] usb 6-2: USB disconnect, device number 6
> [ 1303.205907] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now
> disconnected from ttyUSB1
> [ 1303.205950] ftdi_sio 6-2:1.0: device disconnected
> [ 1303.414089] usb 6-2: new full-speed USB device number 7 using
> uhci_hcd
> [ 1303.526226] usb 6-2: device descriptor read/64, error -71
> [ 1303.894228] usb 6-2: new full-speed USB device number 8 using
> uhci_hcd
> [ 1304.006185] usb 6-2: device descriptor read/64, error -71
> [ 1304.219089] usb 6-2: device descriptor read/64, error -71
> [ 1304.422107] usb 6-2: new full-speed USB device number 9 using
> uhci_hcd
> [ 1304.640020] usb 6-2: device not accepting address 9, error -71
> [ 1304.752024] usb 6-2: new full-speed USB device number 10 using
> uhci_hcd
> [ 1305.160020] usb 6-2: device not accepting address 10, error -71
> [ 1305.160038] hub 6-0:1.0: unable to enumerate USB device on port 2
> 
> *** NOTE: Device is permanently disabled at this point ***
> 
> I don't know whether my analysis is correct (and therefore the proposed
> solution appropriate), as reproducing the problem is very difficult...
> 
> Regards,
> 
> Guido
> 
> Add an option to the usbcore module to wait a specified amount of time (in
> milliseconds) before trying to re-enable a USB port that has been previously
> disabled by the hub (possibly due to EMI).
> 
> Signed-off-by: Guido Trentalancia <gu...@trentalancia.net>
> ---
>  drivers/usb/core/hub.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> --- linux-4.4.6-orig/drivers/usb/core/hub.c   2016-03-20 16:47:09.358674922 
> +0100
> +++ linux-4.4.6/drivers/usb/core/hub.c        2016-03-20 16:47:51.960195139 
> +0100
> @@ -89,6 +89,13 @@ MODULE_PARM_DESC(use_both_schemes,
>               "try the other device initialization scheme if the "
>               "first one fails");
>  
> +static int emi_recover_timer = 0;
> +module_param(emi_recover_timer, int, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(emi_recover_timer,
> +             "wait before trying to re-enable a port "
> +             "that has been disabled by the hub due to EMI "
> +             "(default 0 milliseconds)");

Module parameters are "icky", isn't there some way we can just
dynamically determine this (i.e. fall back to longer and longer wait
times?)

Have you been able to test this out and see if it works?

thanks,

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

Reply via email to