USB: GET_ID from nonzero interface
From: Pete Zaitcev
Date: Tue Jul 27 2004 - 13:32:10 EST
Synopsys: Fix GET_ID for nonzero interface. IIRC, it's HP-1300 combo.
The patch looks bizzare, but it is actually correct and the code is
not too bad. The 2.6 patch from errandir_news@xxxxxxxxxxxxxxxxx, this
is a backport.
I must admit I didn't hear from anyone using the stock 2.4
having this problem, but I had a couple of users on RHL.
diff -urp -X dontdiff linux-2.4.27-rc3/drivers/usb/printer.c linux-2.4.27-rc3-usbx/drivers/usb/printer.c
--- linux-2.4.27-rc3/drivers/usb/printer.c 2004-07-25 23:00:17.000000000 -0700
+++ linux-2.4.27-rc3-usbx/drivers/usb/printer.c 2004-07-27 10:28:53.000000000 -0700
@@ -1,9 +1,9 @@
/*
- * printer.c Version 0.11
+ * printer.c Version 0.13
*
* Copyright (c) 1999 Michael Gee <michael@xxxxxxxxxxxxxxxxx>
* Copyright (c) 1999 Pavel Machek <pavel@xxxxxxx>
- * Copyright (c) 2000 Randy Dunlap <randy.dunlap@xxxxxxxxx>
+ * Copyright (c) 2000 Randy Dunlap <rddunlap@xxxxxxxx>
* Copyright (c) 2000 Vojtech Pavlik <vojtech@xxxxxxx>
# Copyright (c) 2001 Pete Zaitcev <zaitcev@xxxxxxxxxx>
# Copyright (c) 2001 David Paschal <paschal@xxxxxxxxx>
@@ -230,11 +230,21 @@ static DECLARE_MUTEX(usblp_sem); /* lock
static int usblp_ctrl_msg(struct usblp *usblp, int request, int type, int dir, int recip, int value, void *buf, int len)
{
- int retval = usb_control_msg(usblp->dev,
+ int retval;
+ int index = usblp->ifnum;
+
+ /* High byte has the interface index.
+ Low byte has the alternate setting.
+ */
+ if ((request == USBLP_REQ_GET_ID) && (type == USB_TYPE_CLASS)) {
+ index = (usblp->ifnum<<8)|usblp->protocol[usblp->current_protocol].alt_setting;
+ }
+
+ retval = usb_control_msg(usblp->dev,
dir ? usb_rcvctrlpipe(usblp->dev, 0) : usb_sndctrlpipe(usblp->dev, 0),
- request, type | dir | recip, value, usblp->ifnum, buf, len, USBLP_WRITE_TIMEOUT);
- dbg("usblp_control_msg: rq: 0x%02x dir: %d recip: %d value: %d len: %#x result: %d",
- request, !!dir, recip, value, len, retval);
+ request, type | dir | recip, value, index, buf, len, USBLP_WRITE_TIMEOUT);
+ dbg("usblp_control_msg: rq: 0x%02x dir: %d recip: %d value: %d idx: %d len: %#x result: %d",
+ request, !!dir, recip, value, index, len, retval);
return retval < 0 ? retval : 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/