Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Give the active seat user read/write access to USB printers.
# systemd leaves a USB printer's node as root:lp 0664, and nobody is in lp on a
# default install, so a printer application running as the user (rootless
# container) can open the printer but not send it a job. uaccess adds a seat
# ACL for the logged-in user on top; lp keeps its access, so no MODE or GROUP.
# 0701 is the USB printer interface class.
# https://github.com/projectbluefin/common/issues/1681
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", TAG+="uaccess"
22 changes: 22 additions & 0 deletions tests/test_udev_rules.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

RULES_DIR="$BATS_TEST_DIRNAME/../system_files/shared/usr/lib/udev/rules.d"
VIIA_RULES="${RULES_DIR}/70-viia.rules"
# Issue #1681: rootless printer apps need write access to USB printer nodes.
PRINTER_RULES="${RULES_DIR}/70-usb-printer-uaccess.rules"

# Print the rule lines (comments and blanks stripped) of a rules file.
_rule_lines() {
Expand All @@ -33,6 +35,26 @@ _rule_lines() {
[[ "$output" != *'MODE'* ]]
}

@test "70-usb-printer-uaccess.rules exists in the shared system files" {
[ -f "${PRINTER_RULES}" ]
}

@test "70-usb-printer-uaccess.rules tags USB printer-class devices with uaccess" {
run _rule_lines "${PRINTER_RULES}"
[ "$status" -eq 0 ]
[[ "$output" == *'SUBSYSTEM=="usb"'* ]]
[[ "$output" == *'ENV{DEVTYPE}=="usb_device"'* ]]
[[ "$output" == *'ENV{ID_USB_INTERFACES}=="*:0701??:*"'* ]]
[[ "$output" == *'TAG+="uaccess"'* ]]
}

@test "70-usb-printer-uaccess.rules leaves MODE and GROUP to systemd" {
run _rule_lines "${PRINTER_RULES}"
[ "$status" -eq 0 ]
[[ "$output" != *'MODE'* ]]
[[ "$output" != *'GROUP'* ]]
}

@test "uaccess rules sort before systemd's 73-seat-late.rules" {
local late=""
local f
Expand Down
Loading