From ae1b11708975b9dd12edeb0193857b50ce54422e Mon Sep 17 00:00:00 2001 From: vdovhanych Date: Mon, 22 Jul 2024 22:57:25 +0200 Subject: [PATCH] add udev rules for trezor hw wallet devices (cherry picked from commit 2cf425ec573b8f67025c5e74cd267015129e7349) (cherry picked from commit a78a52465298e8f5a927da9c9fc56c41837018aa) (cherry picked from commit e8fe599736d70fbaf553940ea99360575637408b) (cherry picked from commit f3eff7a838128dc690683aa94b9e1fbea3924bae) (cherry picked from commit 0fcee2c4debf810e0142223f04891e655eed3024) --- hwdb.d/70-hardware-wallets.hwdb | 24 ++++++++++++++++++++++++ hwdb.d/meson.build | 1 + hwdb.d/parse_hwdb.py | 1 + rules.d/70-uaccess.rules.in | 4 ++++ 4 files changed, 30 insertions(+) create mode 100644 hwdb.d/70-hardware-wallets.hwdb diff --git a/hwdb.d/70-hardware-wallets.hwdb b/hwdb.d/70-hardware-wallets.hwdb new file mode 100644 index 00000000000..77d8bfa92df --- /dev/null +++ b/hwdb.d/70-hardware-wallets.hwdb @@ -0,0 +1,24 @@ +# This file is part of systemd. +# +# Database for Hardware Wallets that should be accessible to the seat owner. +## +# To add local entries, copy this file to +# /etc/udev/hwdb.d/ +# and add your rules there. To load the new rules execute (as root): +# systemd-hwdb update +# udevadm trigger + +################ +# Trezor Hardware Wallets +################ + +# Trezor v1 +usb:v534Cp0001* + ID_HARDWARE_WALLET=1 + +# Trezor v2 +usb:v1209p53C0* + ID_HARDWARE_WALLET=1 + +usb:v1209p53C1* + ID_HARDWARE_WALLET=1 diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index 4c5df6ad709..65cfd440d79 100644 --- a/hwdb.d/meson.build +++ b/hwdb.d/meson.build @@ -29,6 +29,7 @@ hwdb_files_test = files( '70-analyzers.hwdb', '70-av-production.hwdb', '70-cameras.hwdb', + '70-hardware-wallets.hwdb', '70-joystick.hwdb', '70-mouse.hwdb', '70-pda.hwdb', diff --git a/hwdb.d/parse_hwdb.py b/hwdb.d/parse_hwdb.py index 30d5f8a569e..58489a56d43 100755 --- a/hwdb.d/parse_hwdb.py +++ b/hwdb.d/parse_hwdb.py @@ -173,6 +173,7 @@ def property_grammar(): ('ID_INPUT_TOUCHSCREEN', Or((Literal('0'), Literal('1')))), ('ID_INPUT_TRACKBALL', Or((Literal('0'), Literal('1')))), ('ID_SIGNAL_ANALYZER', Or((Literal('0'), Literal('1')))), + ('ID_HARDWARE_WALLET', Or((Literal('0'), Literal('1')))), ('POINTINGSTICK_SENSITIVITY', INTEGER), ('ID_INPUT_JOYSTICK_INTEGRATION', Or(('internal', 'external'))), ('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))), diff --git a/rules.d/70-uaccess.rules.in b/rules.d/70-uaccess.rules.in index b82ce04a39d..796e384e574 100644 --- a/rules.d/70-uaccess.rules.in +++ b/rules.d/70-uaccess.rules.in @@ -97,4 +97,8 @@ SUBSYSTEM=="hidraw", ENV{ID_AV_PRODUCTION_CONTROLLER}=="1", TAG+="uaccess" # This also allows accessing HID devices with the libusb backend of hidapi. SUBSYSTEM=="usb", ENV{ID_AV_PRODUCTION_CONTROLLER}=="1", TAG+="uaccess" +# Hardware wallets +SUBSYSTEM=="usb", ENV{ID_HARDWARE_WALLET}=="1", TAG+="uaccess" +SUBSYSTEM=="hidraw", ENV{ID_HARDWARE_WALLET}=="1", TAG+="uaccess" + LABEL="uaccess_end"