Gentoo Archives: gentoo-accessibility

From: Chris Brannon <teiresias@g.o>
To: gentoo-accessibility@l.g.o
Subject: [gentoo-accessibility] brltty udev rules
Date: Wed, 12 Feb 2014 08:07:45
Message-Id: 87txc4daa0.fsf@mushroom.PK5001Z
1 Here's a fragment of the brltty udev rules:
2
3 LABEL="brltty_add"
4 SYMLINK+="brltty/$env{BRLTTY_BRAILLE_DRIVER}-$env{BRLTTY_BRAILLE_DEVICE}"
5 RUN+="/bin/brltty -E -P$env{BRLTTY_PID_FILE}"
6 GOTO="brltty_end"
7
8 LABEL="brltty_remove"
9 RUN+="/bin/sh -c 'kill -TERM `cat $env{BRLTTY_PID_FILE}`'"
10 GOTO="brltty_end"
11
12 So basically, this starts *an instance* of brltty whenever a braille
13 display is connected and kills the corresponding instance when the
14 display is unplugged.
15 Yes, this seems quite reasonable. It's plug-and-play, and I
16 can see why folks like that, even though I'm an old curmudgeon.
17 But if you're using those rules, you'd better not start the daemon at
18 all from your init system. If you do, you've got a problem, because
19 you'll have two running daemons trying to communicate with the same
20 display!
21 At least, that's what happens with the default configuration, because it
22 autodetects the braille driver.
23 Also, if you have a speech-driver setting in your /etc/brltty.conf,
24 you'll probably end up with two daemons trying to provide speech. I
25 haven't verified this, however.
26
27 This is only a problem if you want to use brltty for both speech and
28 braille. If you just want it for braille, then don't start it from the
29 init system. Let udev start it automatically for you, and you're
30 golden. If you want to use brltty for both speech and braille,
31 you're going to have to work around this somehow.
32
33 As far as I can tell, there's no way to select a "null" braille driver.
34 So if you want to use this udev autostart scheme, you don't have the
35 option of spawning a brltty that will only be used for speech.
36 In short, the udev scheme is incompatible with using brltty for both
37 speech and braille.
38
39 Probably your best bet is to override the udev rules. First copy
40 /lib/udev/rules.d/70-brltty.rules to /etc/udev/rules.d/70-brltty.rules.
41 Edit /etc/udev/rules.d/70-brltty.rules, and delete the lines that
42 contain RUN+=
43 Right now, there are just two of them:
44 RUN+="/bin/brltty -E -P$env{BRLTTY_PID_FILE}"
45 and
46 RUN+="/bin/sh -c 'kill -TERM `cat $env{BRLTTY_PID_FILE}`'"
47 You'll need to repeat this procedure every time you upgrade brltty, just
48 to keep your modified rules from getting out of sync with the rules from
49 /lib/udev/rules.d.
50 Yeah, overriding files in /lib or /usr/lib with files in /etc is
51 fragile in the face of updates, but that's the way udev does things...
52 Anyway, this disables autostarting of brltty from udev.
53
54 Now, someone please tell me that there's a better way to do this, and
55 that I'm seeing problems that do not exist. I'd love to believe that
56 I'm delusional!
57
58 -- Chris

Replies

Subject Author
RE: [gentoo-accessibility] brltty udev rules Keith Wessel <keith@××××××.com>
RE: [gentoo-accessibility] brltty udev rules Keith Wessel <keith@××××××.com>