From f459d9b953c6b8c3a1f3490f6913f70f0368b782 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Wed, 22 May 2013 20:50:35 +0300 Subject: [PATCH] updated installation docs and udev rule install scrip --- docs/installation.md | 15 ++++++++------- rules.d/install.sh | 15 ++++++--------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 4c59df5f..a7a087c3 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -24,15 +24,16 @@ need to do a one-time udev rule installation to allow access to the Logitech Unifying Receiver. You can run the `rules.d/install.sh` script from Solaar to do this installation -automatically (it will switch to root when necessary), or you can do all the -required steps by hand, as the root user: +automatically (make sure to run it as your regular desktop user, it will switch +to root when necessary), or you can do all the required steps by hand, as the +root user: 1. Copy `rules.d/99-logitech-unifying-receiver.rules` from Solaar to - `/etc/udev/rules.d/`. udev will automatically pick up this file using - inotify. + `/etc/udev/rules.d/`. The `udev` daemon will automatically pick up this file + using inotify. By default, the rule allows all members of the `plugdev` group to have - read/write access to the Unifying Receiver device. (standard Debian/ Ubuntu + read/write access to the Unifying Receiver device. (standard Debian/Ubuntu group for pluggable devices). It may need changes, specific to your particular system's configuration. If in doubt, replacing `GROUP="plugdev"` with `GROUP=""` should just work. @@ -40,9 +41,9 @@ required steps by hand, as the root user: 2. Physically remove the Unifying Receiver and re-insert it. This is necessary because if the receiver is already plugged-in, it already - has a `/dev/hidraw?` device node, but with the old (`root:root`) permissions. + has a `/dev/hidrawX` device node, but with the old (`root:root`) permissions. Plugging it again will re-create the device node with the right permissions. 3. Make sure your desktop users are part of the `plugdev` group, by running - `gpasswd $USER plugdev` as root. If these users were not assigned to the + `gpasswd plugdev`. If these users were not assigned to the group before, they must re-login for the changes to take effect. diff --git a/rules.d/install.sh b/rules.d/install.sh index 1620214f..46e3692a 100755 --- a/rules.d/install.sh +++ b/rules.d/install.sh @@ -2,7 +2,7 @@ set -e -Z=`readlink -f "$0"` +Z=$(readlink -f "$0") RULES_D=/etc/udev/rules.d if ! test -d "$RULES_D"; then @@ -15,18 +15,18 @@ RULE=99-logitech-unifying-receiver.rules if test -n "$1"; then SOURCE="$1" else - SOURCE="`dirname "$Z"`/$RULE" + SOURCE="$(dirname "$Z")/$RULE" if ! id -G -n | grep -q -F plugdev; then - GROUP=$(id -g -n) + GROUP="$(id -g -n)" echo "User '$USER' does not belong to the 'plugdev' group, will use group '$GROUP' in the udev rule." TEMP_RULE="${TMPDIR:-/tmp}/$$-$RULE" cp -f "$SOURCE" "$TEMP_RULE" - SOURCE=$TEMP_RULE + SOURCE="$TEMP_RULE" sed -i -e "s/GROUP=\"plugdev\"/GROUP=\"$GROUP\"/" "$SOURCE" fi fi -if test "`id -u`" != "0"; then +if test "$(id -u)" != "0"; then echo "Switching to root to install the udev rule." test -x /usr/bin/pkexec && exec /usr/bin/pkexec "$Z" "$SOURCE" test -x /usr/bin/sudo && exec /usr/bin/sudo -- "$Z" "$SOURCE" @@ -39,7 +39,4 @@ echo "Installing $RULE." cp "$SOURCE" "$RULES_D/$RULE" chmod a+r "$RULES_D/$RULE" -echo "Reloading udev rules." -udevadm control --reload-rules - -echo "Done. Now remove the Unfiying Receiver, wait 10 seconds and plug it in again." +echo "Done. Now remove the Unfiying Receiver and plug it in again."