Skip to content

Commit

Permalink
udev: Simplify installation of udev rules
Browse files Browse the repository at this point in the history
* Simplify installation of udev rules

Fixes #2263

* udev: Shorten udev installation description

Related #2263

* udev: Shorten udev installation description

Related #2263

* udev: Update installation of udev rules

Related #2263

* Update docs/installation.md

Co-authored-by: Peter F. Patel-Schneider <[email protected]>

* Update Makefile

Co-authored-by: Peter F. Patel-Schneider <[email protected]>

* Update Makefile

Co-authored-by: Peter F. Patel-Schneider <[email protected]>

* Update docs/installation.md

Co-authored-by: Peter F. Patel-Schneider <[email protected]>

* Update docs/installation.md

Co-authored-by: Peter F. Patel-Schneider <[email protected]>

* Update docs/installation.md

Co-authored-by: Peter F. Patel-Schneider <[email protected]>

---------

Co-authored-by: Peter F. Patel-Schneider <[email protected]>
  • Loading branch information
MattHag and pfps authored Feb 12, 2024
1 parent 10d65f0 commit c66f3c3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
UDEV_RULE_FILE = 42-logitech-unify-permissions.rules
UDEV_RULES_SOURCE := rules.d/$(UDEV_RULE_FILE)
UDEV_RULES_SOURCE_UINPUT := rules.d-uinput/$(UDEV_RULE_FILE)
UDEV_RULES_DEST := /etc/udev/rules.d/

.PHONY: install_udev install_udev_uinput uninstall_udev

install_udev:
@echo "Copying Solaar udev rule to $(UDEV_RULES_DEST)"
sudo cp $(UDEV_RULES_SOURCE) $(UDEV_RULES_DEST)
sudo udevadm control --reload-rules

install_udev_uinput:
@echo "Copying Solaar udev rule (uinput) to $(UDEV_RULES_DEST)"
sudo cp $(UDEV_RULES_SOURCE_UINPUT) $(UDEV_RULES_DEST)
sudo udevadm control --reload-rules

uninstall_udev:
@echo "Removing Solaar udev rules from $(UDEV_RULES_DEST)"
sudo rm -f $(UDEV_RULES_DEST)/$(UDEV_RULE_FILE)
sudo udevadm control --reload-rules
30 changes: 16 additions & 14 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,22 @@ For more information see [the rules page](https://pwr-solaar.github.io/Solaar/ru

### Installing Solaar's udev rule

Solaar needs to write to HID devices for receivers and devices.
To be able to do this without running as root requires a udev rule
that gives seated users write access to the HID devices for Logitech receivers and devices.

You can install this rule by copying, as root,
[`rules.d/42-logitech-unify-permissions.rules`](/rules.d/42-logitech-unify-permissions.rules) from Solaar repo to
`/etc/udev/rules.d`.
You will probably also have to tell udev to reload its rule via
`sudo udevadm control --reload-rules`.

For this rule to set up the correct permissions for your receivers and devices
you will then need to either disconnect your receivers and
any USB-connected or Bluetooth-connected devices and
re-connect them or reboot your computer.
Solaar needs to write to HID devices and receivers.
To achieve this without Solaar running as root, which is not recommended, requires a udev rule. Run `make install_udev` in Solaar's root folder to
install Solaar's regular udev rule and put it into effect. You need sudo privileges to do this and will be asked for your password. If you are using Wayland instead of X11 you may want to instead `make install_udev_uinput` so that Solaar rules can simulate input in Wayland.

<details>
<summary>Manual steps</summary>

You can install this rule manually by copying the file
[`rules.d/42-logitech-unify-permissions.rules`](/rules.d/42-logitech-unify-permissions.rules) as root from Solaar repo
to `/etc/udev/rules.d`.
Let udev reload its rules by running
`sudo udevadm control --reload-rules`.
</details>

Then disconnect your Logitech receivers and any USB- or Bluetooth-connected Logitech devices and
re-connect them for the udev rule to take effect. Alternatively, you can just reboot your computer.

## Running from the download directory

Expand Down

0 comments on commit c66f3c3

Please sign in to comment.