From owner-freebsd-usb@FreeBSD.ORG Mon Jan 25 04:57:23 2010 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A6821065672 for ; Mon, 25 Jan 2010 04:57:23 +0000 (UTC) (envelope-from areilly@bigpond.net.au) Received: from nschwmtas01p.mx.bigpond.com (nschwmtas01p.mx.bigpond.com [61.9.189.137]) by mx1.freebsd.org (Postfix) with ESMTP id 01E048FC08 for ; Mon, 25 Jan 2010 04:57:22 +0000 (UTC) Received: from nschwotgx01p.mx.bigpond.com ([124.188.161.100]) by nschwmtas01p.mx.bigpond.com with ESMTP id <20100125045721.YDJI1821.nschwmtas01p.mx.bigpond.com@nschwotgx01p.mx.bigpond.com>; Mon, 25 Jan 2010 04:57:21 +0000 Received: from duncan.reilly.home ([124.188.161.100]) by nschwotgx01p.mx.bigpond.com with ESMTP id <20100125045720.JTIU1743.nschwotgx01p.mx.bigpond.com@duncan.reilly.home>; Mon, 25 Jan 2010 04:57:20 +0000 Date: Mon, 25 Jan 2010 15:57:20 +1100 From: Andrew Reilly To: Warren Block Message-ID: <20100125045720.GA5475@duncan.reilly.home> References: <200909282240.53802.doconnor@gsoft.com.au> <200910291205.05757.hselasky@c2i.net> <200910292313.24636.doconnor@gsoft.com.au> <200910291347.10390.hselasky@c2i.net> <20100110184252.a2efd4cd.torfinn.ingolfsen@broadpark.no> <20100124031045.ad6515c9.torfinn.ingolfsen@broadpark.no> <20100124143139.99b7d102.torfinn.ingolfsen@broadpark.no> <20100125035721.GA18157@duncan.reilly.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100125035721.GA18157@duncan.reilly.home> User-Agent: Mutt/1.4.2.3i X-Authentication-Info: Submitted using SMTP AUTH LOGIN at nschwotgx01p.mx.bigpond.com from [124.188.161.100] using ID areilly@bigpond.net.au at Mon, 25 Jan 2010 04:57:20 +0000 X-RPD-ScanID: Class unknown; VirusThreatLevel unknown, RefID str=0001.0A150201.4B5D24B1.0046,ss=1,fgs=0 X-SIH-MSG-ID: qRA3FtT6TAD0zmQs0WyzOwJxyArnqyN48Z4QX81loRIGTUDCp8DeQ9reLP1Ru9+4xDxJJhqBNGQnaa7lTY3Rs9mK Cc: freebsd-usb@freebsd.org Subject: Re: SANE vs USB scanner on 8.0 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2010 04:57:23 -0000 On Mon, Jan 25, 2010 at 02:57:21PM +1100, Andrew Reilly wrote: > On Sun, Jan 24, 2010 at 09:32:43AM -0700, Warren Block wrote: > > Understood. It looks like it's going to take some work on the backend > > for that to happen. As Hans said, best to file a bug report at > > http://www.sane-project.org/bugs.html. > > For what it's worth, I appear to be in exactly the same > situation as Torfinn, with my snapscan-e20. I've now run the > back-end with the SANE_DEBUG_SNAPSCAN env set to 255, and it is > clear that it is running into the same device string parsing > issue: OK, I've "fixed" my copy of the snapscan backend, to behave nicely with FreeBSD's new libusb. Here's my patch, to be applied in /usr/ports/graphics/sane-backends/work/sane-backends-1.0.20/backend: --- 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; As you can see, this is pretty stupid: it looks as though the snapscan driver was trying to extract the bus number and device number from the libusb device string, so that it could use it to uniquify the SysV-IPC semaphore key it is about to generate. I suspect that anything that caused this test to not fail would have worked just as well. I don't have a login on the sane-project.org bug list mentioned above, so if someone who does wouldn't mind adding this info to the aforementioned bug, I'm sure someone would appreciate it. In the mean-time, I'll submit a pr on the FreeBSD ports list, in the hope that a ports patch might work in lieu of an up-stream fix. Cheers, -- Andrew