Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jan 2010 16:14:51 +1100
From:      Andrew Reilly <areilly@bigpond.net.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/143201: port graphics/sane-backends (snapscan) doesn't like new libusb device syntax
Message-ID:  <20100125161451.03bf2ea6@duncan.reilly.home>
Resent-Message-ID: <201001250610.o0P6A2PG045650@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         143201
>Category:       ports
>Synopsis:       port graphics/sane-backends (snapscan) doesn't like new libusb device syntax
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 25 06:10:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Reilly
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD duncan.reilly.home 9.0-CURRENT FreeBSD 9.0-CURRENT #13: Sat Jan 23 09:35:56 EST 2010 root@duncan.reilly.home:/usr/obj/usr/src/sys/DUNCAN amd64


	besides that, I have a USB scanner, reported by
	sane-find-scanner as:
	found USB scanner (vendor=0x06bd [AGFA], product=0x2091
	[ SNAPSCAN e20   ]) at libusb:/dev/usb:/dev/ugen0.3

>Description:
	This inexpensive scanner always used to work with the
	uscanner driver, but stopped working when I moved to
	-current (for other reasons), and the libusb/ugen
	scanner environment.  The failure mode was always of the
	form:

	[sanei_debug] Setting debug level of snapscan to 255.
	[snapscan] sane_snapscan_init
	[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
	[snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen0.3)
	[snapscan] add_usb_device: Detected (kind of) an USB device
	[snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen0.3)
	[snapscan] snapscani_mutex_open: could not parse device string: Invalid argument
	[snapscan] snapscani_usb_open: Can't get semaphore
	[snapscan] add_usb_device: error opening device libusb:/dev/usb:/dev/ugen0.3: +Invalid argument
	[snapscan] sane_snapscan_get_devices (0x7fffffffcbe0, 0)
	[snapscan] sane_snapscan_exit

	Observation of the offending snapscani_mutex_open()
	function showd that it wanted a device name of the form
	libusb:<bus>:<unit>, and it was parsing for that with a
	simple sscanf().

>How-To-Repeat:
	Plug in a snapscan USB scanner and try scanimage -L
>Fix:

	I applied the following patch so that at least the scanf
	would be happy, and that appears to have made the rest
	of the scanner backend happy too, so now I'm happy: my
	scanner is useful again!

duncan [253]$ pwd
/usr/ports/graphics/sane-backends/work/sane-backends-1.0.20/backend
duncan [254]$ ls *.orig
Makefile.in.orig	epson2.c.orig		snapscan-mutex.c.orig
duncan [255]$ diff -u snapscan-mutex.c.orig snapscan-mutex.c
--- snapscan-mutex.c.orig	2008-03-29 07:39:02.000000000 +1100
+++ snapscan-mutex.c	2010-01-25 15:36:47.000000000 +1100
@@ -130,7 +130,7 @@
 	    return 0;
 	}
 
-	if (sscanf(dev, "libusb:%d:%d", &busnum, &devnum) != 2)
+	if (sscanf(dev, "libusb:/dev/usb:/dev/ugen%d.%d", &busnum, &devnum) != 2)
 	{
 	    DBG (DL_MAJOR_ERROR, "%s: could not parse device string: %s\n", me, strerror(errno));
 	    return 0;



>Release-Note:
>Audit-Trail:
>Unformatted:



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