Skip to content

Commit

Permalink
resources: Update udev rules
Browse files Browse the repository at this point in the history
Rename the rules file so its ordering in the set of rules is more
tightly defined. The range 4* is typically used for USB serial devices
(for example,
https://github.com/Nitrokey/libnitrokey/blob/master/data/41-nitrokey.rules).

Use the new `uaccess` tag to give the user access to the device, rather
than hard-coding world-accessible permissions. (See
systemd/systemd#4288.)

Drop the `/dev/ttyANT*` symlink, which was unused in the code and just
cluttered up the devfs. Instead, set the `ID_ANT_DEVICE` variable on the
device. The code in openant could eventually key on that to find USB
devices to drive (currently it manually matches by vendor and product).

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
  • Loading branch information
pwithnall authored and Tigge committed Jun 11, 2020
1 parent 7165f05 commit ae9e736
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README
include LICENCE
include resources/ant-usb-sticks.rules
include resources/42-ant-usb-sticks.rules
include examples/*.py
13 changes: 13 additions & 0 deletions resources/42-ant-usb-sticks.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This files changes the mode of the Dynastream ANT UsbStick2 so all users
# can read and write to it.
#
# This file should go into '/etc/udev/rules.d'. Note that it should go in
# before 73-seat-late.rules for `uaccess` to work.

ACTION!="add", GOTO="openant_rules_end"
SUBSYSTEM!="usb", GOTO="openant_rules_end"

ATTR{idVendor}=="0fcf", ATTR{idProduct}=="1008", ENV{ID_ANT_DEVICE}="1", TAG+="uaccess"
ATTR{idVendor}=="0fcf", ATTR{idProduct}=="1009", ENV{ID_ANT_DEVICE}="1", TAG+="uaccess"

LABEL="openant_rules_end"
15 changes: 0 additions & 15 deletions resources/ant-usb-sticks.rules

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def udev_trigger():

def install_udev_rules(raise_exception):
if check_root():
shutil.copy('resources/ant-usb-sticks.rules', '/etc/udev/rules.d')
shutil.copy('resources/42-ant-usb-sticks.rules', '/etc/udev/rules.d')
execute(udev_reload_rules, [], "Reloading udev rules")
execute(udev_trigger, [], "Triggering udev rules")
else:
Expand Down

0 comments on commit ae9e736

Please sign in to comment.