Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Sep 2009 23:41:20 +0930
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: SANE vs USB scanner on 8.0
Message-ID:  <200909302341.40232.doconnor@gsoft.com.au>
In-Reply-To: <200909281536.38747.hselasky@c2i.net>
References:  <200909282240.53802.doconnor@gsoft.com.au> <200909281536.38747.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1406691.RQCrTKn7kK
Content-Type: text/plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Mon, 28 Sep 2009, Hans Petter Selasky wrote:

> -       if (sscanf(dev, "libusb:%d:%d", &busnum, &devnum) !=3D 2)
> +       if ((sscanf(dev, "libusb:%d:%d", &busnum, &devnum) !=3D 2) &&
> +           (sscanf(dev, "libusb:/dev/usb:ugen%d.%d", &busnum,
> &devnum) !=3D 2)) {
>             DBG (DL_MAJOR_ERROR, "%s: could not parse device string:
> %s\n", me, strerror(errno));
>             return 0;
>
> If it works, get the patch sent to the sane developers.

Unfortunately no (I reworked it to match the path it uses) and now it=20
segfaults. I rebuilt sane with debugging (is there some way to make libtool
not strip on install? It's so tedious manually editing makefiles to remove
=2Ds..) as well as libusb.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 801b021c0 (LWP 100292)]
0x000000080140e715 in libusb20_dev_open (pdev=3D0x801b13d00, nTransferMax=
=3D32)
    at /usr/src/lib/libusb/libusb20.c:550
550             error =3D pdev->beMethods->open_device(pdev, nTransferMax);
(gdb) bt
#0  0x000000080140e715 in libusb20_dev_open (pdev=3D0x801b13d00, nTransferM=
ax=3D32)
    at /usr/src/lib/libusb/libusb20.c:550
#1  0x0000000801408f15 in usb_open (dev=3D0x801b1ae00)
    at /usr/src/lib/libusb/libusb20_compat01.c:150
#2  0x000000080065c34f in sanei_usb_open (
    devname=3D0x801b09380 "libusb:/dev/usb:/dev/ugen0.5", dn=3D0x7fffffffdc=
0c)
    at sanei_usb.c:1143
#3  0x00000008025e5ad3 in snapscani_usb_open (
    dev=3D0x801b09380 "libusb:/dev/usb:/dev/ugen0.5", fdp=3D0x7fffffffdc0c,
    sense_handler=3D0x8025df7c0 <sense_handler>, pss=3D0x0) at snapscan-usb=
=2Ec:178
#4  0x00000008025eb985 in add_usb_device (
    full_name=3D0x801b09080 "libusb:/dev/usb:/dev/ugen0.5") at snapscan.c:5=
90
#5  0x000000080065c0ed in sanei_usb_find_devices (vendor=3D1189, product=3D=
8288,
    attach=3D0x8025eb880 <add_usb_device>) at sanei_usb.c:1091
#6  0x000000080065bb3e in sanei_usb_attach_matching_devices (name=3D0x7ffff=
fffdcc1 "",
    attach=3D0x8025eb880 <add_usb_device>) at sanei_usb.c:965
#7  0x00000008025ebdac in sane_snapscan_init (version_code=3D0x7fffffffe0f8,
    authorize=3D0x401b50 <auth_callback>) at snapscan.c:735
#8  0x000000080066579b in init (be=3D0x801b0da00) at dll.c:613
#9  0x000000080066621b in sane_dll_get_devices (device_list=3D0x7fffffffea0=
0,
=2D--Type <return> to continue, or q <return> to quit---
    local_only=3D0) at dll.c:1034
#10 0x0000000800658bbb in sane_get_devices (dl=3D0x7fffffffea00, local=3D0)=
 at dll-s.c:17
#11 0x0000000000405a11 in main (argc=3D4, argv=3D0x7fffffffeb30) at scanima=
ge.c:1771
(gdb) print *pdev
$1 =3D {ddesc =3D {LIBUSB20_DEVICE_DESC_FORMAT =3D 0x0, bLength =3D 0 '\0',
    bDescriptorType =3D 0 '\0', bcdUSB =3D 0, bDeviceClass =3D 0 '\0',
    bDeviceSubClass =3D 0 '\0', bDeviceProtocol =3D 0 '\0', bMaxPacketSize0=
 =3D 0 '\0',
    idVendor =3D 0, idProduct =3D 0, bcdDevice =3D 0, iManufacturer =3D 0 '=
\0',
    iProduct =3D 0 '\0', iSerialNumber =3D 0 '\0', bNumConfigurations =3D 0=
 '\0'},
  session_data =3D {session_data =3D 0, tv =3D {tv_sec =3D 0, tv_nsec =3D 0=
}, plugtime =3D 0},
  dev_entry =3D {tqe_next =3D 0x0, tqe_prev =3D 0x0}, methods =3D 0x0, beMe=
thods =3D 0x0,
  pTransfer =3D 0x801b48500, privBeData =3D 0x0, privLuData =3D 0x0,
  claimed_interface =3D 0 '\0', file =3D 0, file_ctrl =3D 0, debug =3D 0, n=
Transfer =3D 32,
  bus_number =3D 0 '\0', device_address =3D 0 '\0', usb_mode =3D 0 '\0',
  usb_speed =3D 0 '\0', is_opened =3D 0 '\0', usb_desc =3D '\0' <repeats 95=
 times>}
(gdb) up
#1  0x0000000801408f15 in usb_open (dev=3D0x801b1ae00)
    at /usr/src/lib/libusb/libusb20_compat01.c:150
150             err =3D libusb20_dev_open(dev->dev, 16 * 2);
(gdb) print *dev
$2 =3D {next =3D 0x0, prev =3D 0x0, filename =3D "/dev/ugen0.5", '\0' <repe=
ats 1012 times>,
  bus =3D 0x801510020, descriptor =3D {bLength =3D 18 '\022', bDescriptorTy=
pe =3D 1 '\001',
    bcdUSB =3D 256, bDeviceClass =3D 255 '=FF', bDeviceSubClass =3D 255 '=
=FF',
    bDeviceProtocol =3D 255 '=FF', bMaxPacketSize0 =3D 8 '\b', idVendor =3D=
 1189,
    idProduct =3D 8288, bcdDevice =3D 256, iManufacturer =3D 1 '\001',
    iProduct =3D 2 '\002', iSerialNumber =3D 0 '\0', bNumConfigurations =3D=
 1 '\001'},
  config =3D 0x801b23280, dev =3D 0x801b13d00, devnum =3D 0 '\0', num_child=
ren =3D 0 '\0',
  children =3D 0x0}
(gdb) print dev->dev
$3 =3D (void *) 0x801b13d00
(gdb) up
#2  0x000000080065c34f in sanei_usb_open (
    devname=3D0x801b09380 "libusb:/dev/usb:/dev/ugen0.5", dn=3D0x7fffffffdc=
0c)
    at sanei_usb.c:1143
1143          devices[devcount].libusb_handle =3D
(gdb) list
1138    #ifdef HAVE_LIBUSB
1139          struct usb_device *dev;
1140          struct usb_interface_descriptor *interface;
1141          int result, num;
1142
1143          devices[devcount].libusb_handle =3D
1144            usb_open (devices[devcount].libusb_device);
1145          if (!devices[devcount].libusb_handle)
1146            {
1147              SANE_Status status =3D SANE_STATUS_INVAL;
(gdb) print *devices[devcount].libusb_device
$4 =3D {next =3D 0x0, prev =3D 0x0, filename =3D "/dev/ugen0.5", '\0' <repe=
ats 1012 times>,
  bus =3D 0x801510020, descriptor =3D {bLength =3D 18 '\022', bDescriptorTy=
pe =3D 1 '\001',
    bcdUSB =3D 256, bDeviceClass =3D 255 '=FF', bDeviceSubClass =3D 255 '=
=FF',
    bDeviceProtocol =3D 255 '=FF', bMaxPacketSize0 =3D 8 '\b', idVendor =3D=
 1189,
    idProduct =3D 8288, bcdDevice =3D 256, iManufacturer =3D 1 '\001',
    iProduct =3D 2 '\002', iSerialNumber =3D 0 '\0', bNumConfigurations =3D=
 1 '\001'},
  config =3D 0x801b23280, dev =3D 0x801b13d00, devnum =3D 0 '\0', num_child=
ren =3D 0 '\0',
  children =3D 0x0}

=2D-=20
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

--nextPart1406691.RQCrTKn7kK
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iD8DBQBKw2cc5ZPcIHs/zowRAvcbAKCb7NH8BMwNdzMmCARA2kSCrKPd/QCgguUa
ALyjYF5nC0yzDxQ5L+rAEKU=
=YUVw
-----END PGP SIGNATURE-----

--nextPart1406691.RQCrTKn7kK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909302341.40232.doconnor>