Hi Dave,

Please test the latest commit to verify that it's correct.

Tested. Yes, that works.

Is there something we can do on remove in order to stop the service?

I asked a colleague who is more familiar with systemd than I am, and he pointed me to this link:

http://unix.stackexchange.com/questions/63232/what-is-the-correct-way-to-write-a-udev-rule-to-stop-a-service-under-systemd

However, when I run
systemctl list-units --all --full |grep .device
I get this for the Brailliant:
dev-brltty-auto\x2dusb:25000072.device                                          
                    loaded    active   plugged   Brailliant_40
dev-bus-usb-003-039.device                                                      
                    loaded    active   plugged   Brailliant_40

So it appears that I need a fixed device name that systemd could bind to for any Braille display. I've just tested having the udev rules file create a symlink called "braille" and have systemd bind to it, and now it unloades when I remove the display. Patch attached.

-Mike
diff --git a/Autostart/Systemd/brltty.service.in 
b/Autostart/Systemd/brltty.service.in
index 87f26ca..8491ba3 100644
--- a/Autostart/Systemd/brltty.service.in
+++ b/Autostart/Systemd/brltty.service.in
@@ -6,6 +6,8 @@ Documentation=http://brltty.com/
 
 DefaultDependencies=no
 Before=sysinit.target
+BindsTo=dev-braille.device
+After=dev-braille.device
 
 RequiresMountsFor=@UPDATABLE_DIRECTORY@
 
diff --git a/Autostart/Udev/udev.rules b/Autostart/Udev/udev.rules
index 4d9926f..0259ab5 100644
--- a/Autostart/Udev/udev.rules
+++ b/Autostart/Udev/udev.rules
@@ -447,6 +447,7 @@ RUN+="/bin/brltty -E -P$env{BRLTTY_PID_FILE}"
 GOTO="brltty_end"
 
 LABEL="brltty_add_systemd"
+SYMLINK+="braille"
 TAG+="systemd", ENV{SYSTEMD_WANTS}+="brltty.service"
 GOTO="brltty_end"
 
_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: BRLTTY@mielke.cc
For general information, go to: http://mielke.cc/mailman/listinfo/brltty

Reply via email to