udev added

This commit is contained in:
2020-10-07 22:40:27 +02:00
parent 755e7d1631
commit d929c9ca34
2 changed files with 21 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
* [Archlinux](./linux/arch/README.md)
* [Installation instructions for UEFI + GPT](./linux/arch/installation.md)
* [Shell commands](./linux/shell_commands.md)
* [udev](./linux/udev.md)
* [MySQL](./MySQL/README.md)
* [ODroid](./odroid.md)
* [OpenSSL](./OpenSSL.md)

20
linux/udev.md Normal file
View File

@@ -0,0 +1,20 @@
# udev
## Start (and stop) a systemd daemon
Create a udev rule to start the daemon:
```
% cat /etc/udev/rules.d/10-bluetooth-service.rules
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="21e8", TAG+="systemd", ENV{SYSTEMD_WANTS}="bluetooth.service"
```
This one starts the bluetooth systemd service when a specific usb bluetooth dongle is added to the system.
If you need to find `idVendor` and `idProduct` you can start `udevadm monitor --property` while plugging the usb device in and out.
To stop the daemon again you need to edit the systemd service file of the daemon - in this case `systemctl edit bluetooth.service`:
```
[Unit]
BindsTo=sys-subsystem-bluetooth-devices-hci0.device
After=sys-subsystem-bluetooth-devices-hci0.device
```
The device name in this case is found by `systemctl list-units --all --full | grep "\.device"`.