[cups.bugs] [CRIT] STR #3799: linux backend usb libusb fails to detect Canon MP110 - get_device_id empty

Mark Huijgen mark.sf.net at huijgen.tk
Tue Feb 22 10:31:59 PST 2011


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Linux, kernel 2.6.35 without usblp module, cups compiled with libusb
support. 
Connected a Canon MP110 printer via USB, lsusb -vv output for this device
attached as canon-lsusb.txt

Summary: printer *not* found by cups using libusb, but is found on system
using cups with usblp.

Executing the usb backend fails to list the Canon MP110 printer connected
to this system, other printers like an HP F2280, Epson SX215 are found by
both backend and webinterface. On an older system with cups 1.3 without
the libusb backend (using usblp kernel module) the Canon printer is found
and is working.

While debugging backend/usb-libusb.c I found the following:
In function find_device() it fails in the call get_device_id().
usb_control_msg() in this function returns an empty string, causing the
function to return -1.

With this info I've added some debug prints to the linux kernel's usblp
module (drivers/usb/class/usblp.c), function usblp_get_id, which is a
macro around usblp_ctrl_msg() and noticed that usblp uses a different
value for the index parameter for usb_control_msg(), namely 256 where cups
uses 1.

Cups uses for index = printer->iface
usblp module uses the following in case of a GET_ID request which is what
we are doing:
  /* 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;  
}

Resulting in the value 256 for index for this Canon MP110 printer (for an
HP F2280 printer, usblp also uses 256).

As a test I modified backend/usb-libusb.c to also leftshift the
printer->iface by 8, and sure enough the backend now finds the Canon:

direct usb://Canon/MP110?serial=65D6te&interface=1 "Canon MP110" "Canon
MP110" "MFG:Canon;CMD:BJL,HAPS,BSCCe;MDL:MP110;CLS:PRINTER;DES:Canon
MP110;VER:1.58;STA:10;" ""

Im not sure how to find the lowbyte for this index properly like usblp
does inside usb-libusb.c (maybe printer->altset??)

However with this change the webinterface still does not find the printer
so most likely some more changes are needed.

I hope this provides enough info to fix this usb-libusb issue in Cups, if
not I'm happy to provide more information.

Regards,
Mark

Link: http://www.cups.org/str.php?L3799
Version: 1.4-current
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: canon-lsusb.txt
URL: <https://lists.cups.org/pipermail/cups/attachments/20110222/09e99538/attachment.txt>


More information about the cups mailing list