updated installation docs and udev rule install scrip

This commit is contained in:
Daniel Pavel 2013-05-22 20:50:35 +03:00
parent b276fbab90
commit f459d9b953
2 changed files with 14 additions and 16 deletions

View File

@ -24,15 +24,16 @@ need to do a one-time udev rule installation to allow access to the Logitech
Unifying Receiver. Unifying Receiver.
You can run the `rules.d/install.sh` script from Solaar to do this installation 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 automatically (make sure to run it as your regular desktop user, it will switch
required steps by hand, as the root user: 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 1. Copy `rules.d/99-logitech-unifying-receiver.rules` from Solaar to
`/etc/udev/rules.d/`. udev will automatically pick up this file using `/etc/udev/rules.d/`. The `udev` daemon will automatically pick up this file
inotify. using inotify.
By default, the rule allows all members of the `plugdev` group to have 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 group for pluggable devices). It may need changes, specific to your
particular system's configuration. If in doubt, replacing `GROUP="plugdev"` particular system's configuration. If in doubt, replacing `GROUP="plugdev"`
with `GROUP="<your username>"` should just work. with `GROUP="<your username>"` 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. 2. Physically remove the Unifying Receiver and re-insert it.
This is necessary because if the receiver is already plugged-in, it already 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. 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 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 <desktop username> plugdev`. If these users were not assigned to the
group before, they must re-login for the changes to take effect. group before, they must re-login for the changes to take effect.

View File

@ -2,7 +2,7 @@
set -e set -e
Z=`readlink -f "$0"` Z=$(readlink -f "$0")
RULES_D=/etc/udev/rules.d RULES_D=/etc/udev/rules.d
if ! test -d "$RULES_D"; then if ! test -d "$RULES_D"; then
@ -15,18 +15,18 @@ RULE=99-logitech-unifying-receiver.rules
if test -n "$1"; then if test -n "$1"; then
SOURCE="$1" SOURCE="$1"
else else
SOURCE="`dirname "$Z"`/$RULE" SOURCE="$(dirname "$Z")/$RULE"
if ! id -G -n | grep -q -F plugdev; then 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." echo "User '$USER' does not belong to the 'plugdev' group, will use group '$GROUP' in the udev rule."
TEMP_RULE="${TMPDIR:-/tmp}/$$-$RULE" TEMP_RULE="${TMPDIR:-/tmp}/$$-$RULE"
cp -f "$SOURCE" "$TEMP_RULE" cp -f "$SOURCE" "$TEMP_RULE"
SOURCE=$TEMP_RULE SOURCE="$TEMP_RULE"
sed -i -e "s/GROUP=\"plugdev\"/GROUP=\"$GROUP\"/" "$SOURCE" sed -i -e "s/GROUP=\"plugdev\"/GROUP=\"$GROUP\"/" "$SOURCE"
fi fi
fi fi
if test "`id -u`" != "0"; then if test "$(id -u)" != "0"; then
echo "Switching to root to install the udev rule." echo "Switching to root to install the udev rule."
test -x /usr/bin/pkexec && exec /usr/bin/pkexec "$Z" "$SOURCE" test -x /usr/bin/pkexec && exec /usr/bin/pkexec "$Z" "$SOURCE"
test -x /usr/bin/sudo && exec /usr/bin/sudo -- "$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" cp "$SOURCE" "$RULES_D/$RULE"
chmod a+r "$RULES_D/$RULE" chmod a+r "$RULES_D/$RULE"
echo "Reloading udev rules." echo "Done. Now remove the Unfiying Receiver and plug it in again."
udevadm control --reload-rules
echo "Done. Now remove the Unfiying Receiver, wait 10 seconds and plug it in again."