[BRLTTY] Are changes needed for systemd 247.1?

Dave Mielke Dave at mielke.cc
Sun Dec 6 20:39:01 EST 2020


There's another possibility worth trying, i.e. to use the /sys/ path rather
than the /dev/ path. I've updated the systemd-wrapper script to handle this.
The patch (attached as systemd-wrapper.patch) is attached to this message.

Then, to use the /sys/ path, a change must be made to brltty's udev rules. Go
to the SYSTEMD_WANTS line and remove the DEVNAME bit. In other words, change:

   SYSTEMD_WANTS}+="brltty@$env{DEVNAME}.service"
to:
   ENV{SYSTEMD_WANTS}+="brltty at .service"

And then, of course, run: udevadm control --reload

I hope this works because it's actually nicer.

-- 
I believe the Bible to be the very Word of God: http://Mielke.cc/bible/
Dave Mielke            | 2213 Fox Crescent | WebHome: http://Mielke.cc/
EMail: Dave at Mielke.cc  | Ottawa, Ontario   | Twitter: @Dave_Mielke
Phone: +1 613 726 0014 | Canada  K2A 1H7   |
-------------- next part --------------
--- systemd-wrapper	2020-11-20 10:39:36.482735402 -0500
+++ /etc/xdg/brltty/systemd-wrapper	2020-12-06 20:22:17.249843944 -0500
@@ -54,12 +54,29 @@
   errorMessage "${message}" 3
 }
 
-readonly currentInstance="${BRLTTY_SYSTEMD_INSTANCE:-${defaultInstance}}"
+currentInstance="${BRLTTY_SYSTEMD_INSTANCE:-${defaultInstance}}"
+[ "${currentInstance#/}" = "${currentInstance}" ] && currentInstance="/${currentInstance}"
+
 [ -e "${currentInstance}" ] || semanticError "instance not found: ${currentInstance}"
 [ -r "${currentInstance}" ] || semanticError "instance not readable: ${currentInstance}"
 
 if [ -c "${currentInstance}" ]
 then
+  isDevice=true
+  udevOption="name"
+elif [ -d "${currentInstance}" ]
+then
+  isDevice=true
+  udevOption="path"
+elif [ -f "${currentInstance}" ]
+then
+  isDevice=false
+else
+  semanticError "unrecognized instance type: ${currentInstance}"
+fi
+
+if "${isDevice}"
+then
   udevManaged=false
 
   while read line
@@ -77,14 +94,11 @@
 
       export "${name}=${value}"
     fi
-  done < <((udevadm info --name="${currentInstance}" --export 2>/dev/null))
+  done < <((udevadm info --"${udevOption}"="${currentInstance}" --export 2>/dev/null))
 
   "${udevManaged}" || semanticError "instance not managed by udev: ${currentInstance}"
-elif [ -f "${currentInstance}" ]
-then
-  export BRLTTY_CONFIGURATION_FILE="${currentInstance}"
 else
-  semanticError "unrecognized instance type: ${currentInstance}"
+  export BRLTTY_CONFIGURATION_FILE="${currentInstance}"
 fi
 
 set -- "${BRLTTY_EXECUTABLE_PATH:-brltty}" -E ${BRLTTY_EXECUTABLE_ARGUMENTS} "${@}"


More information about the BRLTTY mailing list