[sane-devel] How o make genesys backend make use of symlink via udev-rule?

Heinz Rohde 5420108 at mailbox.org
Fri Aug 6 17:48:11 BST 2021


To all the people who answerd my SOS, her is the missing info to what I
already tried and considered.

I hope, you all can see my text. I am quite unfamiliar with mailing-
lists....





Hello,

I am very sorry for beeing so short with my detailed information.


Here we go:

- The Scanner is a Canon CanoScan LiDE 60
- The Scanner is
connected to an ols ThinkPad r60e via USB (All USB ports are USB 2.0)
-
The Scanner is handeled by genesys backend.
- The OS is Debian Buster 64
bit, all updates installed.
- The IP number of the Thinkpad is
192.168.168.245

- The scanner works locally
hr at r60e:~$ sudo scanimage -L
d
evice `genesys:libusb:002:005' is a Canon LiDE 60 flatbed scanner


- The
scanner works over the network, my 2nd laptop is a Dell E6440 running
Debian Buster
hr at e6440:~$ scanimage -L
device
`net:192.168.168.245:genesys:libusb:002:005' is a Canon LiDE 60 flatbed
scanner


- This is my udev-rule in /usr/lib/udev/rules.d

less 90-
scanner.rules

# change device file permission to group scanner for sane
access
ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="221c",
SUBSYSTEMS=="usb", ACTION=="add", MODE="0664", GROUP="scanner",
SYMLINK+="MyLide60"

but this does not work - it creates no symlink in
/dev



- This does work and is my udev-rule in /etc/udev/rules.d

less 83-
scanner.rules

SUBSYSTEM=="usb", ATTR{product}=="CanoScan",
ATTR{idProduct}=="221c", ATTR{idVendor}=="04a9", SYMLINK+="myLide60"
GROUP+="scanner"

It creates a symlink in /dev/
lrwxrwxrwx  1 root root   
15 Aug  6 18:18 myLide60 -> bus/usb/002/005


It's hardly possilbe to
document here all the links I visited during the last 5 days, but tere
are Links that suggested to use
hr at r60e:~$ sudo scanimage -d
/dev/myLide60

which obv iously does not work, because a UNIX Device is
not to be used within the backend systax.

A invocation like
hr at r60e:~$
sudo scanimage -d genesys:libusb:/dev/myLide60 results also in an
error, though it was recommended in a forum blogpost by someone more or
less savvy.


The reason for this is, that I have some windows 10 clients
in my network. 
They can be used with sane-Scanning-Solution via NAPS2
Scanning Software and the windows WIA-Sane driver 
https://github.com/mback2k/wiasane/wiki/Downloads

But one need to
configure the scanning device by hand. Unfortunatly the scanner will be
assigned deviating USB Bus and Device numbers if the scanner is
unplugged and replugged or if the scanserver is rebootet. You cannot
rely on the persistence of USB bus/device number assignment.

That leads
to the situation, that the users of the windows clients won't be able
to scan at a certain day or hour noone can predict.
To assign the then
valid usb bus / device numbers, you'll have to reinstall the WIA-Sane
driver each time it is necessary.

Therefore I'd like to have the option
to configure the windows WIA Sane Driver to the symbolic link.

But until
today this endeavour was not successful.


Important to know: 
SCSI-
Scanners seem to behave other than USB-Scanners. 
SCSI-Scanners for
example may have a /dev/sg1, which is a UNIX-Device.
For SCSI-Scanners
the symlink may work. I unfortunatly cannot try this out, but several
postings do claim that.


I am now looking for a method to get a
persistent USB device enumeration for my scanner.

A already tried the
ALIASES option via dll.aliases.

I wrote this script, which updates the
dll.aliases in /dev/sane.d

-----
#!/bin/bash

ALIASFILE=/etc/sane.d/dll.ali
ases

lsusb | grep LiDE | awk '{ print "alias MyLiDE
genesys:libusb:"$2":"$4}' | sed 's/.$//' > $ALIASFILE
-----
 
The scanner
then is recognised by its alias, but the windows clients cannot make
use of it.
All that the windows WIA Sane Driver sees by autotetection is
the genesys:libusb:002:005 which I can select as only Option during
WIA-Sane Setup.



This is the long version, perhaps you have ideas how I
should proceed.

THX,
Heinz





Am Freitag, den 06.08.2021, 07:43 -0700 schrieb Ralph Little:
> Hi,
> 
> On 2021-08-04 1:44 p.m., Heinz Rohde via sane-devel wrote:
> > Hello,
> > 
> > I created a symlink via udev rule calles MyScanner and points to
> > /dev/bus/001/002 (for example)
> > 
> > I cannot get genesys to use this link, or in other words, scanimage
> > -d
> > /dev/MyScanner resukts in an error.
> > 
> The argument to -d is not a device file in the Unix sense, it is a 
> backend-specific string. The format of that string is determined by
> the 
> backend itself and can vary widely.
> This is because backends can provide services that are not from a
> local 
> device, such as the many devices that can be accessed through
> ethernet 
> or WiFi. Another example would be the test backend which is not 
> associated with any backend. For the test backend, the device would
> be 
> "test:0" or "test:1".
> 
> The common way to determine the device name is to run scanimage -L
> which 
> will probe for available devices and list them out.
> 
> Can you tell us which model of device you are trying to scan from?
> 
> Cheers,
> Ralph
> 





More information about the sane-devel mailing list