udev added
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
* [Archlinux](./linux/arch/README.md)
|
* [Archlinux](./linux/arch/README.md)
|
||||||
* [Installation instructions for UEFI + GPT](./linux/arch/installation.md)
|
* [Installation instructions for UEFI + GPT](./linux/arch/installation.md)
|
||||||
* [Shell commands](./linux/shell_commands.md)
|
* [Shell commands](./linux/shell_commands.md)
|
||||||
|
* [udev](./linux/udev.md)
|
||||||
* [MySQL](./MySQL/README.md)
|
* [MySQL](./MySQL/README.md)
|
||||||
* [ODroid](./odroid.md)
|
* [ODroid](./odroid.md)
|
||||||
* [OpenSSL](./OpenSSL.md)
|
* [OpenSSL](./OpenSSL.md)
|
||||||
|
|||||||
20
linux/udev.md
Normal file
20
linux/udev.md
Normal 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"`.
|
||||||
Reference in New Issue
Block a user