All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] enable usb control message with class specific request
@ 2011-09-22 10:10 Matthias Dellweg
  2011-09-22 15:12 ` Alan Stern
  0 siblings, 1 reply; 11+ messages in thread
From: Matthias Dellweg @ 2011-09-22 10:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Vasiliy Kulikov, Michal Sojka, Arnd Bergmann,
	linux-usb, linux-kernel

Hi!
Usb devio assumes that the wIndex in every control message apart from
those flagged as USB_TYPE_VENDOR holds the number of the Interface
being addressed. This is for example not true for the class specific
request GET_DEVICE_ID in the printer class:

"The high-byte of the wIndex field is used to specify the zero-based
interface index. The low-byte of the wIndex field is used to specify
the zero-based alternate setting." [1]

In this special case it misinterpretes the alternate setting 1 for the
interface and tries to claim a nonexisting one. Therefor you won't get
the printers name.

The patch below is a minimal approach to fix this. Maybe it should be
extended to USB_TYPE_RESERVED. Maybe there should be an extended test
that knows something about specific classes.

What do you think?
regards Matthias

[1] http://www.usb.org/developers/devclass_docs/usbprint11.pdf



>From 724e3b5e8782a584a95d05bb2f44e59743ed3a72 Mon Sep 17 00:00:00 2001
From: Matthias Dellweg <2500@gmx.de>
Date: Wed, 21 Sep 2011 21:28:18 +0200
Subject: [PATCH] drivers/usb/core/devio.c: Relax test in check_ctrlrecip

The generic test for the interface is not valid when the request type is
class specific.

Signed-off-by: Matthias Dellweg <2500@gmx.de>
---
 drivers/usb/core/devio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 37518df..4e78768 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -615,7 +615,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
         && ps->dev->state != USB_STATE_ADDRESS
         && ps->dev->state != USB_STATE_CONFIGURED)
                return -EHOSTUNREACH;
-       if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))
+       if ((USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))
+        || (USB_TYPE_CLASS == (USB_TYPE_MASK & requesttype)))
                return 0;
 
        index &= 0xff;
-- 
1.7.6.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-09-26 23:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-22 10:10 [PATCH] enable usb control message with class specific request Matthias Dellweg
2011-09-22 15:12 ` Alan Stern
2011-09-22 21:56   ` Matthias Dellweg
2011-09-23  7:05     ` Matthias Dellweg
2011-09-23 16:16       ` Alan Stern
2011-09-23 17:57         ` Matthias Dellweg
2011-09-23 18:31           ` Alan Stern
2011-09-25 12:46             ` Matthias Dellweg
2011-09-26 22:34               ` [PATCH] usb/core/devio.c: Check for printer " Greg KH
2011-09-26 23:24                 ` Matthias Dellweg
2011-09-26 23:31                   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.