NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ulpt0 or uscanner but same device? and using sane-backends (Canon MP150)



(Sorry this a long mail. I have been putting notes in here for more than a 
day. I needed to scan in some receipts for work yesterday but still not 
done. Since I chose to plug the scanner into a NetBSD system instead of 
NetBSD, I won't get paid for some stuff for another month :)


Does anyone use xsane on NetBSD using USB?


I have a Canon MP150 multifunction device. I have used its scanner under 
Ubuntu Linux with xsane. (I don't know versions, but now has libsane 
1.0.19~cvs20070505-3ubuntu and xsane 0.99+0.991-3ubuntu5.)

On NetBSD/i386 4.0, when USB plugged in, it detected:

ulpt0 at uhub4 port 5 configuration 1 interface 1
ulpt0: Canon MP150, rev 2.00/1.08, addr 2, iclass 7/1
ulpt0: using bi-directional mode

But no uscanner0 (or uscanner1).

I have installed from pkgsrc: sane-backends-1.0.19 and xsane-0.99.4nb7

ktrace of xsane shows it needed access so did a chmod. Then saw that 
/dev/uscanner0 was not configured.

So I patched usbdevs like:

 /* Canon, Inc. products */
+product CANON MP150            0x1709  PIXMA MP150

I chose 0x1709 because that is what I saw with usbdevs -v:

 port 5 addr 2: high speed, self powered, config 1, MP150(0x1709), 
 Canon(0x04a9) , rev 1.08, serial 62948B

And ran make -f Makefile.usbdevs
And then patched uscanner.c with:

   /* Canon */
+ {{ USB_VENDOR_CANON, USB_PRODUCT_CANON_MP150 }

So rebooting into NetBSD 4.99.59, now I have:

uscanner0 at uhub4 port 5
uscanner0: Canon MP150, rev 2.00/1.08,

But now I don't have ulpt0.

Any ideas or solutions on how to have both uscanner0 and ulpt0?

Then xsane still didn't detect the scanner. ktrace shows it is 
opened and closed (after pulling in /usr/pkg/lib/sane/libsane-pixma.so.1 
and pixma is not commented out in /usr/pkg/etc/sane.d/dll.conf):

   394      1 xsane    CALL  open(0xbfbfcfa8,2,0xbae56284)
   394      1 xsane    NAMI  "/dev/uscanner0"
   394      1 xsane    RET   open 8
   394      1 xsane    CALL  close(8)
   394      1 xsane    RET   close 0

I don't see any ugen* used.

And sane-find-scanner reports:

 checking /dev/uscanner0... open ok, but vendor and product could NOT be 
 identified
 found USB scanner (UNKNOWN vendor and product) at device /dev/uscanner0

This was built with HAVE_LIBUSB defined and so it uses libusb.

So I read the README.netbsd with the sane-backends-1.0.19 source and it 
says:

 "If you want to use libusb, disable the uscanner driver.

 "Problems with uscanner driver:

 The uscanner driver also works (tested with the plustek backend). As the
 uscanner driver can't detect the vendor and product ids automatically, it's
 necessary to add the name of the device file to the backends's configuration
 file. Some backends also need the vendor and product id of the scanner.

 Some backends won't work with the uscanner driver becasue they need USB
 control messages. Use libusb instead."

With debugging enabled plus added my own debugging, I had:


[dll] init: initializing backend `pixma'
[sanei_debug] Setting debug level of pixma to 128.
[pixma] pixma version 0.13.1
[sanei_debug] Setting debug level of sanei_usb to 128.
[sanei_usb] sanei_usb_init: Looking for kernel scanner devices
[sanei_usb] sanei_usb_init: found kernel scanner device 
(0xffffffff/0xffffffff) 
at /dev/uscanner0
[sanei_usb] sanei_usb_init: couldn't open /dev/uscanner1: Device not 
configured
[sanei_usb] sanei_usb_init: Looking for libusb devices
usb_set_debug: Setting debugging level to 255 (on)
[sanei_usb] sanei_usb_init: found 1 devices

So found 1 device then but notice the vendor and product above is 
0xffffffff/0xffffffff.

[dll] init: backend `pixma' is version 1.0.13
[sanei_usb] sanei_usb_find_devices: vendor=0x04a9, product=0x1709
...
[pixma] pixma_find_scanners() found 0 devices

...

[dll] sane_get_devices: found 0 devices
[dll] sane_exit: exiting


So vendor and product is detected as 0xffffffff and 0xffffffff which will 
never match 0x04a9 and product=0x170.

I also updated libusb with new kernel just in case that made a difference.

Now I see the backends-1.0.19/sanei/sanei_usb.c code for
kernel_get_vendor_product() has no code for __NetBSD__ and so the routine 
does nothing.

So I patched sane-backends-1.0.19/sanei/sanei_usb.c so NetBSD will include 
usb.h and also scan the usb devices to get the vendor and product info. 
That worked to detect it (I don't know why it doesn't use libusb for 
that.)

But xsane won't work. When I try to do a preview scan, sometimes I get the 
scanner moving, but returns EINVAL. I haven't track down yet with many 
ktraces and tons of debugging. I see it is failing when using libusb.

I am confused why it uses ioctl and devices directly and then other times 
uses libusb.

Reverting to old kernel (4.0 without patch) but with my sane-backends 
patch, xsane fails to detect pixma:

[dll] init: initializing backend `pixma'
[sanei_debug] Setting debug level of pixma to 128.
[pixma] pixma version 0.13.1
[sanei_debug] Setting debug level of sanei_usb to 128.
[sanei_usb] sanei_usb_init: Looking for kernel scanner devices
[sanei_usb] sanei_usb_init: couldn't open /dev/uscanner0: Device not 
configured
[sanei_usb] sanei_usb_init: couldn't open /dev/uscanner1: Device not 
configured
[sanei_usb] sanei_usb_init: Looking for libusb devices
usb_set_debug: Setting debugging level to 255 (on)
[sanei_usb] sanei_usb_init: found 0 devices
[dll] init: backend `pixma' is version 1.0.13
[pixma] pixma_find_scanners() found 0 devices



Does anyone use xsane on NetBSD using USB?

Any ideas on how to troubleshoot this further?

(I need to talk to sane-backends developers too ... but want to make sure 
I have all details first.)


  Jeremy C. Reed


Home | Main Index | Thread Index | Old Index