[libusb] Problems with USB-based scanner

From: Wojciech A. Koszek <wkoszek_at_freebsd.org>
Date: Sun, 13 Sep 2009 11:37:06 +0200
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):


	wkoszek_at_laptop:/usr/local/etc/sane.d# scanimage
	Segmentation fault (core dumped)

wkoszek_at_laptop:~$ ldd /usr/local/bin/scanimage 
/usr/local/bin/scanimage:
   libsane.so.1 => /usr/local/lib/libsane.so.1 (0x28097000)
   libm.so.5 => /lib/libm.so.5 (0x280b0000)
   libjpeg.so.10 => /usr/local/lib/libjpeg.so.10 (0x280d3000)
   libusb.so.2 => /usr/lib/libusb.so.2 (0x28107000)
   libcam.so.5 => /lib/libcam.so.5 (0x28114000)
   libc.so.7 => /lib/libc.so.7 (0x28129000)
   libthr.so.3 => /lib/libthr.so.3 (0x28240000)
   libsbuf.so.5 => /lib/libsbuf.so.5 (0x28255000)

I compiled /usr/src/lib/libusb/... with debugging symbols and here's what
I got:

Loaded symbols for /usr/local/lib/sane/libsane-plustek.so.1
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  libusb20_dev_open (pdev=0x5a5a5a5a, nTransferMax=32) at /usr/src/lib/libusb/libusb20.c:524
524             if (pdev->is_opened) {
[New Thread 28301140 (LWP 100113)]
(gdb) bt
#0  libusb20_dev_open (pdev=0x5a5a5a5a, nTransferMax=32) at /usr/src/lib/libusb/libusb20.c:524
#1  0x2810aaf0 in usb_open (dev=0x28310b00) at /usr/src/lib/libusb/libusb20_compat01.c:150
#2  0x2809e69d in sanei_usb_open () from /usr/local/lib/libsane.so.1
#3  0x284dda6f in usbDev_open () from /usr/local/lib/sane/libsane-plustek.so.1
#4  0x284ed334 in attach () from /usr/local/lib/sane/libsane-plustek.so.1
#5  0x284eef8b in sane_plustek_init () from /usr/local/lib/sane/libsane-plustek.so.1
#6  0x280a64ed in init () from /usr/local/lib/libsane.so.1
#7  0x280a67dd in sane_dll_get_devices () from /usr/local/lib/libsane.so.1
#8  0x2809b624 in sane_get_devices () from /usr/local/lib/libsane.so.1
#9  0x0804b961 in ?? ()
#10 0xbfbfe51c in ?? ()
#11 0x00000000 in ?? ()
#12 0x00000003 in ?? ()
#13 0x08052520 in __progname ()
#14 0xbfbfe520 in ?? ()
#15 0xbfbfdc94 in ?? ()
#16 0x28056578 in dladdr () from /libexec/ld-elf.so.1
#17 0x08049289 in ?? ()
#18 0x00000000 in ?? ()
#19 0x00000000 in ?? ()
#20 0xbfbfe574 in ?? ()
#21 0x08049289 in ?? ()
#22 0x00000001 in ?? ()
#23 0xbfbfe57c in ?? ()
#24 0xbfbfe584 in ?? ()
#25 0x00000000 in ?? ()
#26 0x28057e90 in dlclose () from /libexec/ld-elf.so.1
#27 0x00000001 in ?? ()
(gdb) f 1
#1  0x2810aaf0 in usb_open (dev=0x28310b00) at /usr/src/lib/libusb/libusb20_compat01.c:150
150             err = libusb20_dev_open(dev->dev, 16 * 2);
(gdb) p *dev
$1 = {next = 0x5a5a5a5a, prev = 0x5a5a5a5a, filename = 'Z' <repeats 1025 times>, bus = 0x5a5a5a5a, descriptor = {bLength = 90 'Z', bDescriptorType = 90 'Z', bcdUSB = 23130, bDeviceClass = 90 'Z', 
    bDeviceSubClass = 90 'Z', bDeviceProtocol = 90 'Z', bMaxPacketSize0 = 90 'Z', idVendor = 23130, idProduct = 23130, bcdDevice = 23130, iManufacturer = 90 'Z', iProduct = 90 'Z', iSerialNumber = 90 'Z', 
    bNumConfigurations = 90 'Z'}, config = 0x5a5a5a5a, dev = 0x5a5a5a5a, devnum = 90 'Z', num_children = 90 'Z', children = 0x5a5a5a5a}

[1] usbdevs(4) isn't useful in the -CURRENT -- from the code, I see it
    doesn't have a chance to work correctly after new USB appeared.

Thanks
-- 
Wojciech A. Koszek
wkoszek_at_FreeBSD.org
http://FreeBSD.czest.pl/~wkoszek/
Received on Sun Sep 13 2009 - 07:48:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:55 UTC