[libusb] Problems with USB-based scanner

Hans Petter Selasky hselasky at c2i.net
Sun Sep 13 11:33:02 UTC 2009


On Sunday 13 September 2009 11:37:06 Wojciech A. Koszek wrote:
> Hi,
>
> Recently, I updated my laptop to the newest sources:
>
> 	FreeBSD laptop.freebsd.czest.pl 9.0-CURRENT FreeBSD 9.0-CURRENT #0
> r197059M: Thu Sep 10 19:08:58 UTC 2009
>
> This is the very first time I tried to use my Canon CanoScan 1220u
> scanner:
>
> [..]
> ugen0.4: <CanoScan Canon> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
>
>   bLength = 0x0012
>   bDescriptorType = 0x0001
>   bcdUSB = 0x0100
>   bDeviceClass = 0x0000
>   bDeviceSubClass = 0x0000
>   bDeviceProtocol = 0x0000
>   bMaxPacketSize0 = 0x0008
>   idVendor = 0x04a9
>   idProduct = 0x2207
>   bcdDevice = 0x0100
>   iManufacturer = 0x0040  <Canon>
>   iProduct = 0x004d  <CanoScan>
>   iSerialNumber = 0x0000  <no string>
>   bNumConfigurations = 0x0001
>
> since uscanner(4) removal. It worked without a problem with
> the old driver and I could use scanimage(8) with no effort:
>
> 	http://freebsd.czest.pl/~wkoszek/wlog/0/
>
> Right now I'm getting segmentation fault from plustek driver (and pretty
> much any other driver, if I comment "plustek" in dll.conf and add necessary
> quirk to other driver):

Hi,

This is a fault in the plustek driver, because it does not refresh the device 
pointer after a USB-rescan!

/usr/ports/graphics/sane-backends/work/sane-backends-1.0.20/sanei

Try the following patch:

--- sanei_usb.c.orig    2009-09-13 13:27:29.000000000 +0200
+++ sanei_usb.c 2009-09-13 13:29:32.000000000 +0200
@@ -337,6 +337,16 @@
        && devices[i].vendor == device.vendor
        && devices[i].product == device.product)
        {
+         /* 
+          * Need to update the LibUSB device pointer, hence it might
+          * have changed after the latest USB scan.
+          */
+#ifdef HAVE_LIBUSB
+         devices[i].libusb_device = device.libusb_device;
+#endif
+#ifdef HAVE_LIBUSB_1_0
+         devices[i].lu_device = device.lu_device;
+#endif
           devices[i].missing=0;
          DBG (3, "store_device: not storing device %s\n", device.devname);
          return;

If it works, are you able to get this patch committed to the SANE project?

--HPS



More information about the freebsd-current mailing list