thardware wallets: pull udev rules into our repository - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 600b26eed61ba9ffa21179428263aa86e5ab0890 DIR parent 6ebbaa60ef31f110300d3df1c3345e6624d83e48 HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 15 Nov 2019 14:58:32 +0100 hardware wallets: pull udev rules into our repository README.md heavily based on https://github.com/bitcoin-core/HWI/blob/060c7fc618e77859eeb395acbdf2b0f9f962fc2c/hwilib/udev/README.md Diffstat: M MANIFEST.in | 1 + A contrib/udev/20-hw1.rules | 12 ++++++++++++ A contrib/udev/51-coinkite.rules | 16 ++++++++++++++++ A contrib/udev/51-hid-digitalbitbox.… | 1 + A contrib/udev/51-safe-t.rules | 10 ++++++++++ A contrib/udev/51-trezor.rules | 17 +++++++++++++++++ A contrib/udev/51-usb-keepkey.rules | 11 +++++++++++ A contrib/udev/52-hid-digitalbitbox.… | 1 + A contrib/udev/README.md | 24 ++++++++++++++++++++++++ 9 files changed, 93 insertions(+), 0 deletions(-) --- DIR diff --git a/MANIFEST.in b/MANIFEST.in t@@ -10,6 +10,7 @@ recursive-include packages cacert.pem graft electrum prune electrum/tests +graft contrib/udev global-exclude __pycache__ global-exclude *.py[co~] DIR diff --git a/contrib/udev/20-hw1.rules b/contrib/udev/20-hw1.rules t@@ -0,0 +1,12 @@ +# HW.1 / Nano +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1b7c|2b7c|3b7c|4b7c", TAG+="uaccess", TAG+="udev-acl" +# Blue +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0000|0000|0001|0002|0003|0004|0005|0006|0007|0008|0009|000a|000b|000c|000d|000e|000f|0010|0011|0012|0013|0014|0015|0016|0017|0018|0019|001a|001b|001c|001d|001e|001f", TAG+="uaccess", TAG+="udev-acl" +# Nano S +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001|1000|1001|1002|1003|1004|1005|1006|1007|1008|1009|100a|100b|100c|100d|100e|100f|1010|1011|1012|1013|1014|1015|1016|1017|1018|1019|101a|101b|101c|101d|101e|101f", TAG+="uaccess", TAG+="udev-acl" +# Aramis +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0002|2000|2001|2002|2003|2004|2005|2006|2007|2008|2009|200a|200b|200c|200d|200e|200f|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|201a|201b|201c|201d|201e|201f", TAG+="uaccess", TAG+="udev-acl" +# HW2 +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0003|3000|3001|3002|3003|3004|3005|3006|3007|3008|3009|300a|300b|300c|300d|300e|300f|3010|3011|3012|3013|3014|3015|3016|3017|3018|3019|301a|301b|301c|301d|301e|301f", TAG+="uaccess", TAG+="udev-acl" +# Nano X +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0004|4000|4001|4002|4003|4004|4005|4006|4007|4008|4009|400a|400b|400c|400d|400e|400f|4010|4011|4012|4013|4014|4015|4016|4017|4018|4019|401a|401b|401c|401d|401e|401f", TAG+="uaccess", TAG+="udev-acl" DIR diff --git a/contrib/udev/51-coinkite.rules b/contrib/udev/51-coinkite.rules t@@ -0,0 +1,16 @@ +# Linux udev support file. +# +# This is a example udev file for HIDAPI devices which changes the permissions +# to 0666 (world readable/writable) for a specific device on Linux systems. +# +# - Copy this file into /etc/udev/rules.d and unplug and re-plug your Coldcard. +# - Udev does not have to be restarted. +# + +# probably not needed: +SUBSYSTEMS=="usb", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666" + +# required: +# from <https://github.com/signal11/hidapi/blob/master/udev/99-hid.rules> +KERNEL=="hidraw*", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666" + DIR diff --git a/contrib/udev/51-hid-digitalbitbox.rules b/contrib/udev/51-hid-digitalbitbox.rules t@@ -0,0 +1 @@ +SUBSYSTEM=="usb", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbb%n", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402" DIR diff --git a/contrib/udev/51-safe-t.rules b/contrib/udev/51-safe-t.rules t@@ -0,0 +1,10 @@ +# Put this file into /usr/lib/udev/rules.d or /etc/udev/rules.d + +# Archos Safe-T mini +SUBSYSTEM=="usb", ATTR{idVendor}=="0e79", ATTR{idProduct}=="6000", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="safe-tr%n" +KERNEL=="hidraw*", ATTRS{idVendor}=="0e79", ATTRS{idProduct}=="6000", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + +# Archos Safe-T mini Bootloader +SUBSYSTEM=="usb", ATTR{idVendor}=="0e79", ATTR{idProduct}=="6001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="safe-t%n" +KERNEL=="hidraw*", ATTRS{idVendor}=="0e79", ATTRS{idProduct}=="6001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + DIR diff --git a/contrib/udev/51-trezor.rules b/contrib/udev/51-trezor.rules t@@ -0,0 +1,17 @@ +# Trezor: The Original Hardware Wallet +# https://trezor.io/ +# +# Put this file into /etc/udev/rules.d +# +# If you are creating a distribution package, +# put this into /usr/lib/udev/rules.d or /lib/udev/rules.d +# depending on your distribution + +# Trezor +SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n" +KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + +# Trezor v2 +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c0", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n" +SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n" +KERNEL=="hidraw*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" DIR diff --git a/contrib/udev/51-usb-keepkey.rules b/contrib/udev/51-usb-keepkey.rules t@@ -0,0 +1,11 @@ +# KeepKey: Your Private Bitcoin Vault +# http://www.keepkey.com/ +# Put this file into /usr/lib/udev/rules.d or /etc/udev/rules.d + +# KeepKey HID Firmware/Bootloader +SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n" +KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + +# KeepKey WebUSB Firmware/Bootloader +SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n" +KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" DIR diff --git a/contrib/udev/52-hid-digitalbitbox.rules b/contrib/udev/52-hid-digitalbitbox.rules t@@ -0,0 +1 @@ +KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="dbbf%n" DIR diff --git a/contrib/udev/README.md b/contrib/udev/README.md t@@ -0,0 +1,24 @@ +# udev rules + +This directory contains all of the udev rules for the supported devices +as retrieved from vendor websites and repositories. +These are necessary for the devices to be usable on Linux environments. + + - `20-hw1.rules` (Ledger): https://github.com/LedgerHQ/udev-rules/blob/master/20-hw1.rules + - `51-coinkite.rules` (Coldcard): https://github.com/Coldcard/ckcc-protocol/blob/master/51-coinkite.rules + - `51-hid-digitalbitbox.rules`, `52-hid-digitalbitbox.rules` (Digital Bitbox): https://shiftcrypto.ch/start_linux + - `51-trezor.rules` (Trezor): https://github.com/trezor/trezor-common/blob/master/udev/51-trezor.rules + - `51-usb-keepkey.rules` (Keepkey): https://github.com/keepkey/udev-rules/blob/master/51-usb-keepkey.rules + - `51-safe-t.rules` (Archos): https://github.com/archos-safe-t/safe-t-common/blob/master/udev/51-safe-t.rules + +# Usage + +Apply these rules by copying them to `/etc/udev/rules.d/` and notifying `udevadm`. +Your user will need to be added to the `plugdev` group, which needs to be created if it does not already exist. + +``` +$ sudo groupadd plugdev +$ sudo usermod -aG plugdev $(whoami) +$ sudo cp contrib/udev/*.rules /etc/udev/rules.d/ +$ sudo udevadm control --reload-rules && sudo udevadm trigger +```