[sane-devel] Using scanimage's -device option to specify one of two identical scanners

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Sun Feb 23 23:31:27 UTC 2014

Joel Penner writes:

> With both 9000f scanners connected, it's:
> pi at raspberrypi ~/sambashare2 $ sudo LD_LIBRARY_PATH=/usr/lib/:/lib
> scanimage -L
> device `pixma:04A91908' is a CANON Canoscan 9000F multi-function peripheral
> device `pixma:04A91908' is a CANON Canoscan 9000F multi-function peripheral
> pi at raspberrypi ~/sambashare2 $

The "pixma:04A91908" bit is what you pass to scanimage's --device-name
option.  This is then used by the pixma backend to decide which device
it should use.  Unfortunately, this backend is not (yet) able to tell
the two devices apart.

>> On Sun, Feb 23, 2014 at 12:15 AM, Joel Penner <joelcpenner at gmail.com>
>> wrote:
>> > Using lsusb -t I get this feedback:
>> >
>> > pi at raspberrypi ~ $ lsusb -t
>> > /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
>> >     |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
>> >         |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
>> >         |__ Port 3: Dev 11, If 0, Class=vend., Driver=usbfs, 480M

So the USB layer has no problems telling your two devices apart.  One
reason that many backends do not want to expose the Dev part of this
output is that it changes every time you reconnect or power-cycle your
scanner.  That leads to changing device names, something that confuses
many users.  The pixma backend is one of those backends and it has opted
to exposo a device name that does *not* changes across reconnections,
power-cycling and system reboots.  It does so at the expense of not
supporting two or more devices of the same make.

>> > I do notice how sane-find-scanner returns the bus/port data:
>> >
>> > sudo sane-find-scanner
>> > found USB scanner (vendor=0x04a9 [Canon], product=0x1908 [CanoScan]) at
>> > libusb:001:011
>> > found USB scanner (vendor=0x0424, product=0xec00) at libusb:001:003
>> >
>> > How would I use the libusb:001:011 identifier for the 9000f with
>> > scanimage?

This would require changes to the pixma backend code.  It could for
example add support for "pixma:libusb:001:011" style device name,
possibly as aliases for "pixma:04A91908".  That way, user with only one
device don't have to bother with the changing device names, but users
like yourself with more than one would be able to pick one or the other
with the libusb "alias".

The drawback of this is that it would show twice as many device names as
are connected.

>> > If I try to tell scanimage to use one of those with the -device option, I
>> > get this feedback:
>> >
>> > pi at raspberrypi ~/sambashare $ sudo LD_LIBRARY_PATH=/usr/lib/:/lib
>> scanimage
>> > --progress --verbose --batch --format=tiff --resolution=2400 -x 240 -y
>> 135
>> > -d libusb:001:011 --batch-start=110000 > /home/pi/sambashare/myco%5d.tif
>> > scanimage: open of device libusb:001:011 failed: Invalid argument

This tells scanimage to look for a libusb SANE backend.  Such a backend
does not exist so you get the invalid argument error.

Hope this clarifies,
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

More information about the sane-devel mailing list