How to obtain permission to use scanner

Kernels & Hardware, configuring network, installing services

How to obtain permission to use scanner

Postby bicyclesonthemoon » 2020-03-07 13:06

I replaced computer, and installed Debian 10 amd64 with LXDE.
Previous had Debian 9 i386

I wanted to use my scanner, CanoScan LiDE 300, with xsane.
It is on the list of supported devices.
But not on the version of libsane available on package manager.
So I downloaded the original sources and compiled it.

Now I can use the scanner.
But only as root.

From what I remembered user has to be part of scanner group.
But already is.

https://wiki.debian.org/Scanner#Permissions
says that it is not that simple any more and that I permission for usb device usage.
And points to
https://bugs.debian.org/cgi-bin/bugrepo ... =918358#12
which tells that this is solved by adding
ENV{libsane_matched}=="yes", RUN+="/bin/setfacl -m g:scanner:rw $env{DEVNAME}"
to /etc/udev/rules.d/65-libsane.rules.
Actually, I found out that the actual location of the file is /lib/udev/rules.d/60-libsane.rules.
Anyway, adding such line does not help.

I don't know how to continue.

Edited to add: I found out that /bin/setfacl is wrong. /usr/bin/setfacl must be used instead because that's where it is.
But changing this doesn't help.
Last edited by bicyclesonthemoon on 2020-03-07 14:42, edited 1 time in total.
bicyclesonthemoon
 
Posts: 9
Joined: 2018-03-06 22:00

Re: How to obtain permission to use scanner

Postby arochester » 2020-03-07 14:41

Have you downloaded the driver/firmware from Canon?

https://www.usa.canon.com/internet/port ... _downloads
arochester
 
Posts: 1656
Joined: 2010-12-07 19:55

Re: How to obtain permission to use scanner

Postby bicyclesonthemoon » 2020-03-07 15:01

arochester wrote:Have you downloaded the driver/firmware from Canon?
I have not.
But it is not the source of my problem.

I can use the scanner from the root account.
I can also use the scanner when I manually add read and write permission to the /dev/bus/usb/*/* file which represents the scanner (but this of course works only until scanner disconnected or computer restarted)

Now I replaced the command
/usr/bin/setfacl -m g:scanner:rw $env{DEVNAME}
with my own debug program which writes its command line arguments to a file, and then calls the setfacl and I see that when I reconnect the scanner nothing new is written.
This means that the /usr/bin/setfacl -m g:scanner:rw $env{DEVNAME} is never executed.
But I don't know if that's because ENV{libsane_matched}=="yes" is not fulfilled or the whole file /lib/udev/rules.d/60-libsane.rules is omitted for some reason.
I don't know how to debug it.

Edited to add:
I did more debugging and now I see that indeed the condition ENV{libsane_matched}=="yes" is not fulfilled.

Edited to add again:
I have a solution
A rule has to be added:

#LiDE 300
ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="1913", ENV{libsane_matched}="yes"

and the aforementioned command has to be moved to a place which is actually executed.
And this makes it work!

However, I noticed that something has changed in this version of Debian:
The USB devices have been moved to /lib/udev/hwdb.d/20-sane.hwdb
So I could also add it there:

# Canon CanoScan LiDE 300
usb:v04A9p1913*
libsane_matched=yes

but doing just that and rebooting doesn't help. So I had to stick to the solution of adding to 60-libsane.rules as described above, even though Debian does it differently these days.

Where is the new approach documented?
Where does it come from?
bicyclesonthemoon
 
Posts: 9
Joined: 2018-03-06 22:00


Return to System configuration

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable