peterlaursen said:
I am talking about a refreshable braille display. While BRLTTY drives everything from user space, I don't see that as a wise solution, since the operating system (which, I hope you agree) should detect and communicate with hardware devices directly if at all possible. I still see it as the kernel's job to communicate with the hardware, thereby making it easily accessible for other programs through device nodes.
Well, yes and no. I would not embed a Postscript preprocessor in the kernel, nor code to format, interpret or do complex line handling in a printer driver. Low level communications and I/O handling, yes of course it belongs in the kernel. But a Braille translator is more akin to a Postscript or PCL filter than a communications protocol handler. OpenGL doesn't belong in the kernel either. These kinds of big, software-based filters and pre/post-processors are often best done in firmware in the device. That's where Postscript itself usually lives. If not in firmware, then in user space filters (e.g. Ghostscript, all of the printer filters in printcap, etc). It sounds like you want to treat the Braille display as if it had a full blown Braille translator in firmware on the device, but it doesn't so you want to emulate that in kernel. But it get messy at the edges, like at boot or install time, when such high-level pre-processing software isn't on board yet...
peterlaursen said:
For example # echo 'braille test' > /dev/brl0
would print the text to the first connected braille display if my driver was loaded.
If I were to do this using BRLTTY and its corresponding API, I would have to rewrite the echo command in order to add braille support, which is one of the many reasons why only a handful of programs supports native braille output.
But echo, csh, indeed ANY program that did standard input/output to a terminal would work fine with BRLTTY or the script(1) style method, without any mods or rewrites needed to the basic Unix software. Things would only be problematic, maybe, during boot or install time, which is the small exception. Indeed, its my understanding (not being blind), that actually text-to-speech based solutions are preferred for many text-only situations, and would work just as well, if not more efficiently for the boot and install phases (I do installs only every few years per machine). The Braille display is most useful when line and page formatting are critical, like page layouts, tables, etc -- but you should tell me if you agree.
peterlaursen said:
I don't understand your reasons for wanting to communicate with the hardware in user space rather than in kernel space?
Not sure what you mean... its the kernel that is still doing the low-level I/O, interrupt processing, handshaking etc. I don't view Braille translation as a "communicating" piece of the system. It is a high-level software-based pre-processing filter and formatter, requiring user-loadable tables, algorithm/rule changes depending on user context, and extensive "read-ahead" and "look-behind", it has to understand the notion of words, even sentences and text pages -- all high level stuff. These elements are not low-level communication tasks.
peterlaursen said:
While the
script(1) command would do the trick sometimes, it wouldn't necessarily work in single-user mode or during FreeBSD installation, which are some more reasons for me preferring kernel space.
Tricky but not impossible to have it work during installs. Definitely not that hard to have it work in single-user mode. I believe BRLTTY claims to be able to work under these conditions. Embedding in the kernel won't make it work during BIOS or loader booting and you'd have to do a kernel .ko module because it won't work in standard install kernels as distributed. In these cases, it really belongs either in firmware in the display, or an outboard "smart module" that sits between the serial port and the device.
For a real solution, if I couldn't convince the manufacturer to stick this in the firmware, I would get a small smartmodule and put it in that device's firmware. But to start, I'd say the script(1) would work 99% of the time, the major missing piece is for graphical/GUI software, like KDE, Gnome, and their apps. But kernel won't be better for that anyways. There probably is a way to get X Windows to funnel text through a Braille daemon, but I haven't looked into such an idea.
That's my rec anyways, take the script(1) source code strip it apart to divert the output to your display... solves 99% of the text-based programs with no mods to those programs. Then look into getting a programmable smart module of some sort (e.g. Raspberry Pi for $25
http://www.raspberrypi.org/faqs or similar cheap DOS-based or ARM-based module) and shove the translator into it to sit between Freebsd and your display. It would work for 100% cases and won't depend on FreeBSD.
Maybe part of the disconnect here is that I'm thinking Grade 2 "contracted" Braille, whereas perhaps you are focused more on Grade 0 "computer Braille". Yes Grade 0 is so stripped down and simplistic that it perhaps could reasonably be stuck in the kernel as a sideshow to the tty(4) interface. I could see that. But not contracted Braille. Perhaps that's a good compromise, as Grade 0 would probably get you through installs and boots, but to do proper contracted (Grade 2) Braille, it requires a whole lot more that, in my opinion, doesn't belong in the kernel. Grade 1 (non-contracted), well a toss up, but still far, far simpler than Grade 2.