[sane-devel] Identifying identical scanners dynamically turned on and off
olaf.meeuwissen at avasys.jp
Thu Mar 22 23:37:22 UTC 2012
Martin Zackrisson <martin.zackrisson at cmb.gu.se> writes:
> It is a modified version of the epson2-backend (don't know if the
> patch of last fall has made its way into the main dist).
> The OS is Ubuntu, the latest I think or the latest long-term (not
> sitting close to that computer at present).
> My first thought was to look for the serial too, and unfortunately
> fujitsu don't have any scanner that fits our needs (A4 TPU + many more
> things), so they all have to be Epson v700. Reading its "Programming
> Guide. Rev. C" it seems to agree with you - that the best it can do is
> to send its 'Product Name' and 'ROM Version'.
That's right the ESC/I protocol does not provide access to information
that is unique amongst all devices (of a certain model). You may have
more luck with the USB information which may include a serial number.
Some models have one, others don't. Don't know about the V700. Even if
they have a serial number in the USB info, I would not be too surprised
if some devices have the same serial number :-|
> I suppose it must be question of learning the inner workings of udev
These days the USB devices stay at the same place below /sys/ even when
power cycled. Only when replugging to a *different* USB port will this
location change. I'm not sure what happens when you reboot.
Assuming that you know which scanner shows up where in /sys/, you can
then use the busnum and devnum "files" to construct the device names
that the epson2 backend groks. So with
$ cat /sys/bus/usb/devices/usb2/2-4/busnum
$ cat /sys/bus/usb/devices/usb2/2-4/devnum
you'd use `epson2:libusb:002:003` for the device name. When power
cycling, on the `devnum` will change.
Note that there is a libsysfs-dev package which may be useful here.
Hope this helps,
Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962 Help support software freedom
More information about the sane-devel