Re: [PATCH 3/4] usb: Don't fail port power resume on device disconnect.

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

 



On Thu, Aug 15, 2013 at 06:43:58PM -0700, Sarah Sharp wrote:
> Userspace can tell the kernel to power off any USB port, including ones
> that are visible and connectible to users.  When an attached USB device
> goes into suspend, the port will be powered off if the
> pm_qos_no_port_poweroff file for its port is set to 0, the device does
> not have remote wakeup enabled, and the device is marked as persistent.
> 
> If the user disconnects the USB device while the port is powered off,
> the current code does not handle that properly.  If you disconnect a
> device, and then run `lsusb -v -s` for the device, the device disconnect
> does not get handled by the USB core.  The runtime resume of the port
> fails, because hub_port_debounce_be_connected() returns -ETIMEDOUT.
> 
> This means the port resume fails and khubd doesn't handle the USB device
> disconnect.  This leaves the device listed in lsusb, and the port's
> runtime_status will be permanently marked as "error".
> 
> Fix this by ignoring the return value of hub_port_debounce_be_connected.
> Users can disconnect USB devices while the ports are powered off, and we
> must be able to handle that.
> 
> This patch should be backported to kernels as old as 3.9, that
> contain the commit ad493e5e580546e6c3024b76a41535476da1546a "usb: add
> usb port auto power off mechanism"
> 
> Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
> Cc: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/core/port.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)

So the worse thing that happens is the user has to unplug and plug the
device back in, right?  Or just not disable the port power.

Who is disabling USB port power from userspace anyway?  Are there any
userspace tools doing this today?

Again, doesn't feel like late -rc fodder, sorry.

greg k-h
--
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