View previous topic :: View next topic |
Author |
Message |
Slippery Jim Apprentice


Joined: 08 Jan 2005 Posts: 295
|
Posted: Mon Apr 21, 2025 10:27 am Post subject: scanner is in lp group instead of scanner group |
|
|
My Canon LiDE 400 flatbed USB scanner gets put into the lp group instead of the scanner group.
I can manually change it after boot:
Code: | chgrp scanner /dev/bus/usb/001/004 |
However, I can't seem to get this to work in a udev rule:
Code: | ENV{libsane_matched}=="yes", RUN+="/bin/chgrp scanner $env{DEVNAME}" |
Also, this feels a bit hacky, and I'd rather know where/how/why it's getting set to lp in the first place. The file /lib/udev/rules.d/50-udev-default.rules mentions GROUP="lp" for usb:
Code: | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" |
but I don't recognize the interface ID "*:0701??:*" as matching anything my scanner advertises via lsusb:
Code: | Bus 001 Device 004: ID 04a9:1912 Canon, Inc. LiDE 400 |
I copied /lib/udev/rules.d/50-udev-default.rules to /etc/udev/rules.d and changed GROUP="lp" to GROUP="scanner", and that did the trick, but it feels heavy-handed, since it'll put printers in the scanner group too, I suspect.
So where do I find the list of ID_USB_INTERFACES? Can I use this property to differentiate a printer from a scanner, and set the group accordingly? If not, then how do I write the rule to specifically target my scanner using idProduct and idVendor instead?
Cheers! |
|
Back to top |
|
 |
GDH-gentoo Veteran


Joined: 20 Jul 2019 Posts: 1890 Location: South America
|
Posted: Mon Apr 21, 2025 9:33 pm Post subject: Re: scanner is in lp group instead of scanner group |
|
|
Slippery Jim wrote: | My Canon LiDE 400 flatbed USB scanner gets put into the lp group instead of the scanner group. |
I don't have a scanner, but I believe that for most of them, this is taken care of by an udev rule and a .hwdb (hardware database) file installed by media-gfx/sane-backends.
What is the output of:
Code: | udevadm info --query=all /dev/bus/usb/001/004 | ? _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer  |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though  |
|
|
Back to top |
|
 |
Slippery Jim Apprentice


Joined: 08 Jan 2005 Posts: 295
|
Posted: Mon Apr 21, 2025 11:53 pm Post subject: Re: scanner is in lp group instead of scanner group |
|
|
GDH-gentoo wrote: |
What is the output of:
Code: | udevadm info --query=all /dev/bus/usb/001/004 | ? |
james@Two-Spear ~ $ udevadm info --query=all /dev/bus/usb/001/004
P: /devices/pci0000:00/0000:00:08.1/0000:04:00.3/usb1/1-1/1-1.2
M: 1-1.2
R: 2
U: usb
T: usb_device
D: c 189:3
N: bus/usb/001/004
L: 0
V: usb
E: DEVPATH=/devices/pci0000:00/0000:00:08.1/0000:04:00.3/usb1/1-1/1-1.2
E: DEVNAME=/dev/bus/usb/001/004
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=4a9/1912/100
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=004
E: MAJOR=189
E: MINOR=3
E: SUBSYSTEM=usb
E: USEC_INITIALIZED=5103695
E: ID_BUS=usb
E: ID_MODEL=LiDE_400
E: ID_MODEL_ENC=LiDE\x20400
E: ID_MODEL_ID=1912
E: ID_SERIAL=Canon_LiDE_400_4DDAB7
E: ID_SERIAL_SHORT=4DDAB7
E: ID_VENDOR=Canon
E: ID_VENDOR_ENC=Canon
E: ID_VENDOR_ID=04a9
E: ID_REVISION=0100
E: ID_USB_MODEL=LiDE_400
E: ID_USB_MODEL_ENC=LiDE\x20400
E: ID_USB_MODEL_ID=1912
E: ID_USB_SERIAL=Canon_LiDE_400_4DDAB7
E: ID_USB_SERIAL_SHORT=4DDAB7
E: ID_USB_VENDOR=Canon
E: ID_USB_VENDOR_ENC=Canon
E: ID_USB_VENDOR_ID=04a9
E: ID_USB_REVISION=0100
E: ID_USB_INTERFACES=:ff00ff:ffffff:070104:
E: ID_VENDOR_FROM_DATABASE=Canon, Inc.
E: ID_MODEL_FROM_DATABASE=LiDE 400
E: ID_PATH_WITH_USB_REVISION=pci-0000:04:00.3-usbv2-0:1.2
E: ID_PATH=pci-0000:04:00.3-usb-0:1.2
E: ID_PATH_TAG=pci-0000_04_00_3-usb-0_1_2
E: ID_FOR_SEAT=usb-pci-0000_04_00_3-usb-0_1_2
E: TAGS=:seat:
E: CURRENT_TAGS=:seat:
james@Two-Spear ~ $ |
|
Back to top |
|
 |
GDH-gentoo Veteran


Joined: 20 Jul 2019 Posts: 1890 Location: South America
|
Posted: Tue Apr 22, 2025 2:33 am Post subject: |
|
|
Look like this should be handled automagically by installing media-gfx/sane-backends with SANE_BACKENDS=pixma in /etc/portage/make.conf. _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer  |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though  |
|
|
Back to top |
|
 |
Slippery Jim Apprentice


Joined: 08 Jan 2005 Posts: 295
|
Posted: Tue Apr 22, 2025 8:43 am Post subject: |
|
|
Yeah, you would think so, but here we are...
I'm using the current desktop profile, which has most backends selected, including pixma.
Also, it's an openrc system, not systemd, which might be relevant.
It's either not calling the script, or else it's getting clobbered by the rule I cited sbove. I'll do some more testing after work tonight, and update here. |
|
Back to top |
|
 |
freke Veteran

Joined: 23 Jan 2003 Posts: 1091 Location: Somewhere in Denmark
|
Posted: Tue Apr 22, 2025 9:30 am Post subject: Re: scanner is in lp group instead of scanner group |
|
|
Slippery Jim wrote: | My Canon LiDE 400 flatbed USB scanner gets put into the lp group instead of the scanner group.
I can manually change it after boot:
Code: | chgrp scanner /dev/bus/usb/001/004 |
However, I can't seem to get this to work in a udev rule:
Code: | ENV{libsane_matched}=="yes", RUN+="/bin/chgrp scanner $env{DEVNAME}" |
Also, this feels a bit hacky, and I'd rather know where/how/why it's getting set to lp in the first place. The file /lib/udev/rules.d/50-udev-default.rules mentions GROUP="lp" for usb:
Code: | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" |
but I don't recognize the interface ID "*:0701??:*" as matching anything my scanner advertises via lsusb:
Code: | Bus 001 Device 004: ID 04a9:1912 Canon, Inc. LiDE 400 |
I copied /lib/udev/rules.d/50-udev-default.rules to /etc/udev/rules.d and changed GROUP="lp" to GROUP="scanner", and that did the trick, but it feels heavy-handed, since it'll put printers in the scanner group too, I suspect.
So where do I find the list of ID_USB_INTERFACES? Can I use this property to differentiate a printer from a scanner, and set the group accordingly? If not, then how do I write the rule to specifically target my scanner using idProduct and idVendor instead?
Cheers! |
Code: | ENV{ID_USB_INTERFACES}=="*:0701??:*" | should be unique to the scanner (or maybe the model?) - it's seen in udevadm here Code: | E: ID_USB_INTERFACES=:ff00ff:ffffff:070104: | so changing the udev-rule to say scanner instead of lp shouldn't interfere if you decided to plugin a printer I would believe |
|
Back to top |
|
 |
Slippery Jim Apprentice


Joined: 08 Jan 2005 Posts: 295
|
Posted: Tue Apr 22, 2025 2:18 pm Post subject: Re: scanner is in lp group instead of scanner group |
|
|
freke wrote: |
Code: | ENV{ID_USB_INTERFACES}=="*:0701??:*" | should be unique to the scanner (or maybe the model?) - it's seen in udevadm here Code: | E: ID_USB_INTERFACES=:ff00ff:ffffff:070104: | so changing the udev-rule to say scanner instead of lp shouldn't interfere if you decided to plugin a printer I would believe |
That's one of the things I'd like to see some documentation on. The hardware already has ID_VENDOR_ID and ID_USB_MODEL_ID to completely specify what the device is, so I had assumed that ID_USB_INTERFACES was defining something more general. I just don't know what exactly that general thing is. If it's an ABI for scanner functionality, then that would be what we're looking for. There was a post on an Arch forum, I think, where it was asserted that "*:0701??:*" always refers to a printer, so setting group to lp should be OK. Obviously this is a counter-example to such an assertion, though. Any idea where the database for those ID_USB_INTERFACES values lives? |
|
Back to top |
|
 |
freke Veteran

Joined: 23 Jan 2003 Posts: 1091 Location: Somewhere in Denmark
|
Posted: Tue Apr 22, 2025 6:11 pm Post subject: Re: scanner is in lp group instead of scanner group |
|
|
Slippery Jim wrote: | freke wrote: |
Code: | ENV{ID_USB_INTERFACES}=="*:0701??:*" | should be unique to the scanner (or maybe the model?) - it's seen in udevadm here Code: | E: ID_USB_INTERFACES=:ff00ff:ffffff:070104: | so changing the udev-rule to say scanner instead of lp shouldn't interfere if you decided to plugin a printer I would believe |
That's one of the things I'd like to see some documentation on. The hardware already has ID_VENDOR_ID and ID_USB_MODEL_ID to completely specify what the device is, so I had assumed that ID_USB_INTERFACES was defining something more general. I just don't know what exactly that general thing is. If it's an ABI for scanner functionality, then that would be what we're looking for. There was a post on an Arch forum, I think, where it was asserted that "*:0701??:*" always refers to a printer, so setting group to lp should be OK. Obviously this is a counter-example to such an assertion, though. Any idea where the database for those ID_USB_INTERFACES values lives? |
Sorry, actually the 070104 seems to say it's Code: | bInterfaceClass 7 Printer
bInterfaceSubClass 1 Printer
bInterfaceProtocol 4 |
|
|
Back to top |
|
 |
GDH-gentoo Veteran


Joined: 20 Jul 2019 Posts: 1890 Location: South America
|
Posted: Wed Apr 23, 2025 3:10 am Post subject: |
|
|
Slippery Jim wrote: |
Yeah, you would think so, but here we are... |
I just realized that the udev rule installed by Gentoo's ebuild, 66-saned.rules, actually doesn't change the special file's group, but rather sets an access control list. Could you check that it is there?
Code: | $ getfacl /dev/bus/usb/001/004 |
_________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer  |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though  |
|
|
Back to top |
|
 |
Slippery Jim Apprentice


Joined: 08 Jan 2005 Posts: 295
|
Posted: Mon May 19, 2025 9:46 am Post subject: |
|
|
Sorry, haven't been watching the thread...
Code: | Two-Spear /home/james # getfacl /dev/bus/usb/001/003
getfacl: Removing leading '/' from absolute path names
# file: dev/bus/usb/001/003
# owner: root
# group: scanner
user::rw-
user:james:rw-
group::rw-
group:scanner:rw-
mask::rw-
other::r--
|
Not sure if it was fixed in portage, or if I did something locally to fix it. Seems to be working now... |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|