use libudev to handle device disconnect/reconnect
This change has substantially bumped up the daemon's overall robustness, as the code now ensures that the controller will only start once the /dev/input/eventXX file is set up, which was causing all sorts of issues in the past. Additionally, this change enables the daemon to run as a proper background task that _doesn't_ constantly die / need to be restarted, which removes the need for any janky udev "on add" rules, and instead, a simple systemd user service will suffice.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
ACTION=="add", ATTR{name}=="Surface Dial System Multi Axis", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}="surface-dial.service"
|
||||
@@ -1,5 +1,12 @@
|
||||
# IMPORTANT: modify the "ExecStart" field to reflect your userid + surface-dial-daemon install dir
|
||||
# IMPORTANT: modify the "ExecStart" field to reflect your surface-dial-daemon install dir
|
||||
|
||||
[Unit]
|
||||
Description=Surface Dial Daemon
|
||||
|
||||
[Service]
|
||||
# HACK: this service needs to run _after_ the /dev/input/eventXX files have been created
|
||||
ExecStart=bash -c 'sleep 1 && /home/danielprilik/.cargo/bin/surface-dial-daemon'
|
||||
Type=simple
|
||||
StandardOutput=journal
|
||||
ExecStart=/home/danielprilik/.cargo/bin/surface-dial-daemon
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
Reference in New Issue
Block a user