blob: 67fa216795923fb4c1faedbdf703f443866dbe4f [file] [log] [blame] [view]
dmazzoni2f489752017-02-16 03:39:161# BRLTTY in Chrome OS
2
3Chrome OS uses the open-source [BRLTTY](http://mielke.cc/brltty/)
4library to provide support for refreshable braille displays.
5
6We typically ship with a stable release build of BRLTTY plus some
David Tseng35ccdf32019-09-13 23:04:347permanent or cherry-picked patches.
dmazzoni2f489752017-02-16 03:39:168
9## Updating BRLTTY or adding a patch
10
11First, follow the public
12[Chromium OS Developer Guide](http://www.chromium.org/chromium-os/developer-guide) to check out the source.
13At a minimum you'll need to create a chroot.
14You do not need to build everything from source.
15You do need to start the devserver.
16
17Next, flash your device to a very recent test build. Internally at Google
18you can do this with the following command when the dev server is running,
19where CHROMEBOOK_IP_ADDRESS is the IP address of your Chromebook already
20in developer mode, and $BOARD is your Chromebook's board name.
21
22```cros flash ssh://CHROMEBOOK_IP_ADDRESS xbuddy://remote/$BOARD/latest-dev/test```
23
24The BRLTTY files can be found in this directory:
25
26```third_party/chromiumos-overlay/app-accessibility/brltty```
27
David Tseng35ccdf32019-09-13 23:04:3428###Major release
29
30You'll first want to rename all files to the new major release. For example, brltty-5.6.ebuild and remove all revision symlinks (see below).
31
32###Revision release
33
34A revision release is the same release build of brltty, but with additional patches.
35
dmazzoni2f489752017-02-16 03:39:1636The first thing you'll need to do is edit the ebuild symlink to change the
37revision number. The real file is something like brltty-5.4.ebuild,
38but the revision will be something like brltty-5.4-r5.ebuild. You'll need
39to increment it.
40
41To increment it from r5 to r6, you'd do something like this:
42
43```
44rm brltty-5.4-r5.ebuild
45ln -s brltty-5.4.ebuild brltty-5.4-r6.ebuild
46git add brltty-5.4-r6.ebuild
47```
48
49The changes we make are all patches against a stable release of brltty.
50To add a new patch, put it in the files/ directory and reference it in
51brltty.bashrc
52
53Once you're done adding patches or making other changes, flash it to your
54device like this:
55
56```
57emerge-$BOARD brltty
58cros deploy CHROMEBOOK_IP_ADDRESS brltty
59```
60
61After that, reboot your Chromebook and verify that brltty works.
62
63To upload a change, use repo, something like this:
64
65```
66repo start <branch_name> .
67git commit -a
Lei Zhang3fd577db2020-05-21 21:33:1968 Bug: chromium:12345
69 Test: Write what you tested here
dmazzoni2f489752017-02-16 03:39:1670repo upload .
71```
72
73Note that you shouldn't need to run cros_workon.
David Tseng9e78ce82018-10-26 22:08:0574
75## Uprevving Brltty
76
77This section outlines the process to upgrade Brltty to a major release.
78
79### Prerequisites
80
81First, download the latest brltty release tarball
82http://mielke.cc/brltty/archive
83E.g.
84brltty-5.6.tar.gz
85
86The server holding all Chrome OS source packages is Google Cloud Storage. In
87order to update Brltty, you will need to first get started with GCS.
88[Google-internal only](https://sites.google.com/a/google.com/chromeos/resources/engineering/releng/localmirror)
89
90If you follow the alternative cli workflow, you should have the ability to
91list the Chrome OS GCS bucket:
92
David Tseng9e78ce82018-10-26 22:08:0593```gsutil ls gs://chromeos-localmirror/```
94
95for example:
96gs://chromeos-localmirror/distfiles/brltty-5.6.tar.gz
97is the latest release as of writing.
98
99It will also be handy to checkout brltty.
100
101```Git clone http://github.com/brltty/brltty```
102
103And follow the instructions in the readme to configure/build.
104
105### Upload the latest stable release of brltty.
106
107You can do this via ```gsutil cp```.
108
109After copying, you will likely want the package to be world readable:
110
David Tseng9e78ce82018-10-26 22:08:05111```
112gsutil acl ch -u AllUsers:R gs://chromeos-localmirror/distfiles/brltty-5.6.tar.gz
113
114```
115
116### Upreving
117
118Next, you will need to uprev the ebuild. Do this by renaming all files from the previous version to the new one.
119E.g.
120Brltty-5.4.ebuild -> brltty-5.6.ebuild
121
David Tsengcae58bc2020-05-15 22:38:07122Start a build with your changes by doing
123
124emerge brltty
125(or emerge{$BOARD} brltty).
126
David Tseng9e78ce82018-10-26 22:08:05127Note: Manifest has various checksums computed based on the release you uploaded to GCS. Each of these will need to be replaced/updated.
128
129This should be enough to kick off a build. It is likely patches wont apply cleanly.
130Apply patches
131It is often much easier to apply patches to your local checkout of brltty from github, an build there.
132
133```git tags```
134
135Will ensure you find the right release. You can then checkout that release via
136
137```Git checkout tags/<tag_name>```
138
David Tseng35ccdf32019-09-13 23:04:34139Finally apply each of the *.patch files to this tag of brltty.
140
141This is more or less straightforward. If conflicts arise, it is useful to list
142commits to the file containing the conflict
143
144```git log --oneline <file>```
145
146then understanding the history since the last release. If the patch is already
147upstreamed, you can remove it from the Chrome OS repo.
148
David Tsengcae58bc2020-05-15 22:38:07149### Chrome side changes
150
151Chrome communicates with brltty using libbrlapi.
152libbrlapi resides at //third_party/libbrlapi.
153
154Chrome loads this library dynamically and hard-codes the expected version of the api so in
155chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
156
157which should match up with the header in
158third_party/libbrlapi/brlapi.h.
159
160During uppreving, if brltty increments its api version, it will be necessary to update the header for libbrlapi, as well as incrementing the supported api version of the libbrlapi shared object.
161
162First, grab the generated header from your Chrome OS build above.
163cp <chromeos root>/build/$BOARD/usr/include/brlapi.h <chrome_root>/third_party/libbrlapi/brlapi.h
164
165This header contains the specific socket path for Chrome OS which differs from brltty defaults.
166
167Next, ensure the version in
168chrome/browser/extensions/api/braille_display_private/braille_controller_brlapi.cc
169
170matches the one in the new brltty.
171
David Tseng7a537f12021-06-03 22:55:18172#### ChromeVox
173ChromeVox keeps a list of bluetooth braille display names
174(search for bluetooth_display_manager.js).
175
176Within the brltty sources (as of 6.3), one can find all bluetooth display names
177in:
178brltty/Programs/bluetooth_names.c
179
David Tseng9e78ce82018-10-26 22:08:05180### Testing
181
David Tseng35ccdf32019-09-13 23:04:34182Firstly, try to test against brltty on linux. This involves building brltty at
183the proposed stable release and fully patching all of our changes from Chrome
184OS.
185
186You would do something like:
187
188```
189./autogen
190./configure
191make
192./run-brltty -n
193```
194
195This will launch brltty (in the foreground and not as a daemon).
196
197Any connected displays should automatically work.
198
199Next, once you have a build deployed on a Chrome OS machine, here are a few
200useful things to check:
David Tseng9e78ce82018-10-26 22:08:05201* Routing keys within a text field
202* Routing keys on a link
203* Basic braille output
204* Chorded commands (e.g. space + s to toggle speech)
205* Typing (e.g. dots 1-2-3 within a text field)
206* Display specific hardware keys
207* Unload ChromeVox (ctrl+alt+z), plug in a display; ChromeVox should auto
208start
209
210Try to test with at least two displays.
David Tseng35ccdf32019-09-13 23:04:34211###Debugging
212
213In the event things don't go well (such as no braille appearing on the display),
214you may find it helpful to:
215
2161. examine chrome logging
217
218/var/log/chrome
219
220Look for any errors in *brl* related files. For example, a new release of
221libbrlapi could require additional so versions be added to our loader.
222
2232. modify the way in which brltty gets run.
224
Quinten Yearsley317532d2021-10-20 17:10:31225In particular, look at the invocation of the minijail in
David Tseng35ccdf32019-09-13 23:04:34226
227third_party/chromiumos-overlay/app-accessibility/brltty/files/brltty
228
229You may want to add the '-l debug' flag to the brltty call and redirect stderr/stdout to a file.
230... brltty -n ... -l debug,server,usb,brldrv ... > /tmp/brltty_errors 2>&1