I have an Epson Stylus CX3200. But the GET_DEVICE_ID ioctl is not working (see kern.log output below). Because of this, user software like foomatic-gui cannot identify it.
Turns out there is a bug in the GET_DEVICE_ID implementation. The patch below (against 2.6.5-rc2) fixes the code to work according to the USB printer spec. After fixing the code, I found that Adam Lazur already reported this issue months ago: http://sourceforge.net/mailarchive/forum.php?thread_id=3065460&forum_id=5398 I hope his patch was missed by mistake. Please report if there is a reason not to take his or my patch. His mail explains the problem and fix in more detail, and there is nothing usefull I can add to that. Martin Habets ----- Part of kern.log: Apr 1 19:09:55 palantir8 kernel: usb 1-2: new full speed USB device using address 3 Apr 1 19:09:55 palantir8 kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=3 Apr 1 19:09:55 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/core/message.c: USB device number 3 default language ID 0x409 Apr 1 19:09:55 palantir8 kernel: usb 1-2: Product: USB MFP Apr 1 19:09:55 palantir8 kernel: usb 1-2: Manufacturer: EPSON Apr 1 19:09:55 palantir8 kernel: usb 1-2: SerialNumber: W23231910201022370 Apr 1 19:09:55 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/core/usb.c: usb_hotplug Apr 1 19:09:56 palantir8 kernel: usb 1-2: registering 1-2:1.0 (config #1, interface 0) Apr 1 19:09:56 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/core/usb.c: usb_hotplug Apr 1 19:09:56 palantir8 kernel: usb 1-2: registering 1-2:1.1 (config #1, interface 1) Apr 1 19:09:56 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/core/usb.c: usb_hotplug Apr 1 19:09:57 palantir8 kernel: usblp 1-2:1.1: usb_probe_interface Apr 1 19:09:57 palantir8 kernel: usblp 1-2:1.1: usb_probe_interface - got id Apr 1 19:09:57 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/class/usblp.c: usblp0 set protocol 2 Apr 1 19:09:57 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/class/usblp.c: usblp_control_msg: rq: 0x00 dir: 1 recip: 1 value: 1 len: 0x3ff result: -32 Apr 1 19:09:57 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/class/usblp.c: usblp0: error = -32 reading IEEE-1284 Device ID string After patch: Apr 3 03:13:04 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/class/usblp.c: usblp0 set protocol 2 Apr 3 03:13:04 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/class/usblp.c: usblp_control_msg: rq: 0x00 dir: 1 recip: 1 value: 0 idx: 256 len: 0x3ff result: 84 Apr 3 03:13:04 palantir8 kernel: /home/opendev/src/linux/linux-2.6.5-rc2/drivers/usb/class/usblp.c: usblp0 Device ID string [len=84]="MFG:EPSON;CMD:ESCPL2,BDC,D4;MDL:Stylus CX3200;CLS:PRINTER;DES:EPSON Stylus CX3200;" ----- --- 2.6/drivers/usb/class/usblp.c.original 2004-03-20 00:11:03.000000000 +0000 +++ 2.6/drivers/usb/class/usblp.c 2004-04-03 04:18:19.000000000 +0100 @@ -226,11 +226,21 @@ 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; } @@ -440,6 +450,9 @@ goto done; } + dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd), + _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) ); + if (_IOC_TYPE(cmd) == 'P') /* new-style ioctl number */ switch (_IOC_NR(cmd)) { ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel