added script for udev rule installation
This commit is contained in:
parent
b5b86ab8b8
commit
0e551383ba
40
README.md
40
README.md
|
@ -5,9 +5,7 @@ It comes in two flavours, command-line and GUI. Both are able to list the
|
||||||
devices paired to a Unifying Receiver, show detailed info for each device, and
|
devices paired to a Unifying Receiver, show detailed info for each device, and
|
||||||
also pair/unpair supported devices with the receiver.
|
also pair/unpair supported devices with the receiver.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
|
|
||||||
You should have a reasonably new kernel (3.2+), with the `logitech-djreceiver`
|
You should have a reasonably new kernel (3.2+), with the `logitech-djreceiver`
|
||||||
driver enabled and loaded; also, the `udev` package must be installed and the
|
driver enabled and loaded; also, the `udev` package must be installed and the
|
||||||
|
@ -24,32 +22,30 @@ distribution the required packages are most likely named something similar.
|
||||||
If the desktop notifications bindings are also installed (`gir1.2-notify-0.7`),
|
If the desktop notifications bindings are also installed (`gir1.2-notify-0.7`),
|
||||||
you will also get desktop notifications when devices come online/go offline.
|
you will also get desktop notifications when devices come online/go offline.
|
||||||
|
|
||||||
|
## Installation
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
Normally USB devices are not accessible for r/w by regular users, so you will
|
Normally USB devices are not accessible for r/w by regular users, so you will
|
||||||
need to do a one-time udev rule installation to allow access to the Logitech
|
need to do a one-time udev rule installation to allow access to the Logitech
|
||||||
Unifying Receiver.
|
Unifying Receiver.
|
||||||
|
|
||||||
In the `rules.d/` folder of Solaar you'll find a udev rule file, to be copied in
|
You can run the `rules.d/install.sh` script from Solaar to do this installation
|
||||||
`/etc/udev/rules.d/` (as the root user).
|
(it will switch to root when necessary), or you can do all the required steps by
|
||||||
|
hand, as the root user:
|
||||||
|
|
||||||
In its current form it makes the Unifying Receiver device available for r/w by
|
- copy `rules.d/99-logitech-unfiying-receiver.rules` from Solaar to
|
||||||
all users belonging to the `plugdev` system group (standard Debian/Ubuntu group
|
`/etc/udev/rules.d/`
|
||||||
for pluggable devices). It may need changes, specific to your particular
|
|
||||||
system's configuration.
|
|
||||||
|
|
||||||
If in doubt, replacing `GROUP="plugdev"` with `GROUP="<your username>"` should just
|
By default, the rule makes the Unifying Receiver device available for r/w by
|
||||||
work.
|
all users belonging to the `plugdev` system group (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="<your username>"` should just work.
|
||||||
|
|
||||||
After you copy the file to `/etc/udev/rules.d` (and possibly modify it for your
|
- run `udevadm control --reload-rules` to let the udev daemon know about the new
|
||||||
system), run `udevadm control --reload-rules` as root for it to apply. Then
|
rule
|
||||||
physically remove the Unifying Receiver, wait 10 seconds and re-insert it.
|
- physically remove the Unifying Receiver, wait 10 seconds and re-insert it
|
||||||
|
|
||||||
|
## Supported Devices
|
||||||
Supported Devices
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
**Solaar** will detect all devices paired with your Unifying Receiver, and at
|
**Solaar** will detect all devices paired with your Unifying Receiver, and at
|
||||||
the very least display some basic information about them. Depending on the
|
the very least display some basic information about them. Depending on the
|
||||||
|
@ -66,9 +62,7 @@ Extended support for other devices will be added in the future, depending on the
|
||||||
documentation available, but the K750 keyboard is the only device I have and can
|
documentation available, but the K750 keyboard is the only device I have and can
|
||||||
test on right now.
|
test on right now.
|
||||||
|
|
||||||
|
## Thanks
|
||||||
Thanks
|
|
||||||
------
|
|
||||||
|
|
||||||
This project began as a third-hand clone of [Noah K. Tilton](https://github.com/noah)'s
|
This project began as a third-hand clone of [Noah K. Tilton](https://github.com/noah)'s
|
||||||
logitech-solar-k750 project on GitHub (no longer available). It was developed
|
logitech-solar-k750 project on GitHub (no longer available). It was developed
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
Z=$(readlink -f "$0")
|
||||||
|
|
||||||
|
RULES_D=/etc/udev/rules.d
|
||||||
|
if ! test -d "$RULES_D"; then
|
||||||
|
echo "$RULES_D not found; is udev installed?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
RULE=99-logitech-unifying-receiver.rules
|
||||||
|
|
||||||
|
if test -n "$1"; then
|
||||||
|
SOURCE=$1
|
||||||
|
else
|
||||||
|
SOURCE=$(dirname "$Z")/$RULE
|
||||||
|
if ! id -G -n | grep -q -F plugdev; then
|
||||||
|
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
|
||||||
|
sed -i -e "s/GROUP=\"plugdev\"/GROUP=\"$GROUP\"/" "$SOURCE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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"
|
||||||
|
test -x /bin/su && exec /bin/su -c "\"$Z\" \"$SOURCE\""
|
||||||
|
echo "Could not switch to root: none of pkexec, sudo or su were found?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
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."
|
Loading…
Reference in New Issue