Allow udev rules to be configured at build time [#25]

Prior to this change, the udev rules were fixed to allow read-write
access only to the `plugdev` group. However, while this is the default
group for USB input devices on Debian and its derivatives, this is not
true for some systems such as openSUSE, which use `input` as the group.

This change adds a `--with-input-group` argument to `configure`, which
defaults to `plugdev`. This change also updates the install
documentation to reflect the new options.
pull/26/head
nirenjan 2020-12-25 15:17:52 -08:00
parent 59c4643474
commit abb366d89c
3 changed files with 34 additions and 7 deletions

View File

@ -56,3 +56,23 @@ You will also need the following packages to run the unit tests:
make && sudo make install
```
## Configuration options
### udev
The configuration system should automatically detect the udev rules directory,
but you can override it by using the following argument to `configure`:
```
--with-udevrulesdir=/path/to/udev/rules.d
```
### Input group
The udev rules that are installed provide read/write access to members of the
input devices group. This defaults to `plugdev`, but can be modified using
the following argument to `configure`:
```
--with-input-group=group
```

View File

@ -74,6 +74,12 @@ AC_ARG_WITH([udevrulesdir],
[udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)"/rules.d"])
AC_SUBST([udevrulesdir], [$udevrulesdir])
AC_ARG_WITH([input-group],
AS_HELP_STRING([--with-input-group=GROUP], [Group allowed to access input devices]),
[input_group=$withval],
[input_group=plugdev])
AC_SUBST([input_group], [$input_group])
# Doxygen Support
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
@ -107,6 +113,7 @@ AC_CONFIG_FILES([ po/Makefile.in
lib/libx52util/Makefile
lib/libx52io/Makefile
udev/Makefile
udev/60-saitek-x52-x52pro.rules
utils/Makefile
utils/cli/Makefile
utils/test/Makefile

View File

@ -1,17 +1,17 @@
# udev rules to give plugdev users permissions to:
# udev rules to give members of "@input_group@" users permissions to:
# - write to the X52/X52pro using libx52
# - read from the hidraw interface
ACTION!="add", GOTO="x52_rules_end"
# X52Pro flight control system
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0762", MODE="0664", GROUP="plugdev"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0762", MODE="0640", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0762", MODE="0664", GROUP="@input_group@"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0762", MODE="0640", GROUP="@input_group@"
# X52 flight control system
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0255", MODE="0664", GROUP="plugdev"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0255", MODE="0640", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="075c", MODE="0664", GROUP="plugdev"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="075c", MODE="0640", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0255", MODE="0664", GROUP="@input_group@"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0255", MODE="0640", GROUP="@input_group@"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="075c", MODE="0664", GROUP="@input_group@"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="075c", MODE="0640", GROUP="@input_group@"
LABEL="x52_rules_end"