[sane-devel] Block device USB port

Simon Matter simon.matter at invoca.ch
Tue Jan 19 11:11:58 UTC 2010


>
> Hello,
>
> On Jan 16 12:27 Josu Lazkano wrote (shortened):
>
>> Hello everybody! I have a HP ScanJet 2400 scanner. I can scan normally
>> with
>> this command:
>>
>> scanimage -d hp2400:libusb:001:006 --format=tiff > Desktop/image.tiff
>>
>> But if I change the scanner USB port, the device address change:
>>
>> $ scanimage -L
>> device `hp2400:libusb:001:004' is a Hewlett-Packard hp2400 flatbed
>> scanner
> ...
>> I use the "scanimage" command on a script, so if I change the USB port I
>> must edit script.
>>
>> Is possible to assign always the same port?
>
> No.
> Because udev (or whatever it is, perhaps libusb or kernel?)

There is even a worse case. If you have multiple scanners of the same type
connected to the same box you can only distinguish them if they provide
some kind of unique id/serial number whatever - many devices don't do that
:(

Regards,
Simon

> is somewhat broken by design because it assigns different
> device nodes to same devices (there are whatever technical
> reasons for this).
>
> Therefore your script must work with changing SANE devices.
>
> scanimage -f '%d,'
> lists the currently available SANE devices (see "man scanimage")
> so that you could use command substitution for example like
>
> scanimage -d $( scanimage -f '%d,' | tr ',' '\n' | grep hp2400 ) \
>   --format=tiff > Desktop/image.tiff
>
> The bash is needed for the nice $(...) command substitution syntax.
> Otherwise use your appropriate shell syntax for command substitution
> or the old-style backquote/backtick (accent grave) form in bash
> which could be confused with other kind of accent characters.
>
>
> Kind Regards
> Johannes Meixner
> --
> SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
> AG Nuernberg, HRB 16746, GF: Markus Rex
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
>              to sane-devel-request at lists.alioth.debian.org
>





More information about the sane-devel mailing list