Gentoo Archives: gentoo-accessibility

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

Replies

Subject Author
Re: [gentoo-accessibility] brltty udev rules Chris Brannon <teiresias@g.o>