mirror of
https://github.com/daniviga/django-ram.git
synced 2026-03-21 07:42:30 +01:00
23 lines
997 B
Plaintext
23 lines
997 B
Plaintext
# Udev rule to auto-start/stop dcc-usb-connector.service when USB device is connected/removed
|
|
#
|
|
# This rule detects when a CH340 USB-to-serial adapter (ID 1a86:7523)
|
|
# is connected/removed on /dev/ttyUSB0, then automatically starts/stops
|
|
# the dcc-usb-connector.service (user systemd service).
|
|
#
|
|
# Installation:
|
|
# sudo cp 99-dcc-usb-connector.rules /etc/udev/rules.d/
|
|
# sudo udevadm control --reload-rules
|
|
# sudo udevadm trigger --subsystem-match=tty
|
|
#
|
|
# Testing:
|
|
# udevadm test /sys/class/tty/ttyUSB0
|
|
# udevadm monitor --property --subsystem-match=tty
|
|
#
|
|
# The service will be started when the device is plugged in and stopped
|
|
# when the device is unplugged.
|
|
|
|
# Match USB device 1a86:7523 on ttyUSB0
|
|
# TAG+="systemd" tells systemd to track this device
|
|
# ENV{SYSTEMD_USER_WANTS} starts the service on "add" and stops it on "remove"
|
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", KERNEL=="ttyUSB0", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}="dcc-usb-connector.service"
|