diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-07-12 04:04:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-25 15:01:12 -0400 |
commit | 5dc50c357d5ce8f78e148d20a38e4e66b12d550f (patch) | |
tree | 14d7ff181b9f2c4c5df485953fafe1ffccf56f50 /drivers/usb/core/devio.c | |
parent | aaf6b52d50f85ed792c9c8987f5169f3dce2adea (diff) |
usbfs: Allow printer class 'get_device_id' without needing to claim the intf
For certain (HP) printers the printer device_id does not only contain a
static part identifying the printer, but it also contains a dynamic part
giving printer status, ink level, etc.
To get to this info various userspace utilities need to be able to make a
printer class 'get_device_id' request without first claiming the interface
(as that is in use for the actual printer driver).
Since the printer class 'get_device_id' request does not change interface
settings in anyway, allowing this without claiming the interface should not
cause any issues.
CC: Sanjay Kumar <sanjay.kumar14@hp.com>
CC: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/devio.c')
-rw-r--r-- | drivers/usb/core/devio.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 05986507b585..737e3c19967b 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -725,15 +725,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, | |||
725 | 725 | ||
726 | /* | 726 | /* |
727 | * check for the special corner case 'get_device_id' in the printer | 727 | * check for the special corner case 'get_device_id' in the printer |
728 | * class specification, where wIndex is (interface << 8 | altsetting) | 728 | * class specification, which we always want to allow as it is used |
729 | * instead of just interface | 729 | * to query things like ink level, etc. |
730 | */ | 730 | */ |
731 | if (requesttype == 0xa1 && request == 0) { | 731 | if (requesttype == 0xa1 && request == 0) { |
732 | alt_setting = usb_find_alt_setting(ps->dev->actconfig, | 732 | alt_setting = usb_find_alt_setting(ps->dev->actconfig, |
733 | index >> 8, index & 0xff); | 733 | index >> 8, index & 0xff); |
734 | if (alt_setting | 734 | if (alt_setting |
735 | && alt_setting->desc.bInterfaceClass == USB_CLASS_PRINTER) | 735 | && alt_setting->desc.bInterfaceClass == USB_CLASS_PRINTER) |
736 | index >>= 8; | 736 | return 0; |
737 | } | 737 | } |
738 | 738 | ||
739 | index &= 0xff; | 739 | index &= 0xff; |