[sane-devel] Strange behaviour by airscan
pzz at apevzner.com
Fri Oct 23 21:33:04 BST 2020
On 10/23/20 11:15 PM, Andrea Croci wrote:
> Addressing the scanner as "airscan:e0:..." works great. Not a big
> problem, I just find it kind of funny.
Well, it's a long story :-)
Airscan attempts to be user-friendly, not hacker-friendly. For this
purpose, it returns list of devices, not list of connection endpoints (a
device may have multiple endpoints: WiFi/Ethernet, HTTP/HTTPS, eSCL/WSD,
...). Airscan attempts to list each physical device only once,
regardless of how many endpoints it has.
SANE requires every device to have an unique name, and DNS-SD name of
the device is a natural choice.
Unfortunately, there is no 100% guarantee that DNS-SD name is unique:
1. If computer connected to multiple networks (WiFi/Ethernet, for
example), in theory these networks may contain devices with duplicated names
2. WSD doesn't have anything similar to DNS-SD name, its "namespace" is
a space of device UUIDs. If device is visible simultaneously as DNS-SD
device and WSD device, name is taken from the DNS-SD world. Otherwise,
airscan fallbacks to the model name, which is also is not guaranteed to
be unique across the network.
To ensure uniqueness, airscan prefixes every name with a short prefix,
like e1 or w2. First character comes from protocol (e == eSCL, w ==
WSD), small number is assigned as UNIX PID: incremented every time new
device is encountered with protection against assignment of number
currently in use.
So this prefix depends in a order of device discovery (device,
discovered first, will get smaller number).
It works nice with GUI programs, that allow to choose device from a
list, but may make some inconvenience for people, who uses command-line
tools, like scanimage. From another hand, nobody complained so far :-)
Wishes, Alexander Pevzner (pzz at apevzner.com)
More information about the sane-devel