]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: fix authorization and claimed port logic
authorHindin Joseph <hindin@gmail.com>
Sun, 4 Nov 2012 20:50:08 +0000 (22:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Nov 2012 00:56:22 +0000 (16:56 -0800)
commitc13b86a336d089f248293776a853252fbca15c26
tree6eb97e2f67f4a08c68ea5dbe01bfe99bdfb16c66
parent9d94e16be70d34d139ec3c7882ed0283b5ac074d
USB: fix authorization and claimed port logic

    It looks like I've run into some inconsistency in the USB stack behavior.

    The USB stack maintains, among others, two states for the attach
USB device: authorized and owned. Authorization state is accessible to
the user space code through correspondent sysfs files, the ownership
can be set by claiming the hub's port with ioctl call. Both state may
be set before the device is attached, by access the hub settings. When
the new device is attached, both authorization and ownership prevent
the kernel USB stack from setting the newly attached device
configuration, but when the device is authorized, the ownership state
is ignored. It looks like ignoring the ownership state on
authorization make the stack behavior inconsistent; it also prevents
the user space code from completely overriding configuration
selection, important for implementing workarounds for bugs in the
device configuration selection.

   The following patch makes the stack behavior more consistent, by
moving ownership test into usb_choose_configuration - the later
function is used both by generic_probe and usb_authorize_device

Signed-off-by: Joseph Hindin <hindin@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/generic.c