[quoted lines by Christoph-Simon Senjak on 2016/09/17 at 21:54 +0200] >I wrote the following proof-of-concept patch for the driver. It just >adds an additional line with braille characters.
Thank you. I've reworked it some (attached as tty-braille-1.patch). Please verify that I haven't broken it. You'll notice that I moved the buffer outside of the loop. That's because it's not guaranteed that a variable-size local buffer is deallocated at the end of the block that declares it. >However, it would probably be better to make this configurable, and I am not >quite sure how the configuration system works. I don't think there's a need to make it configurable. We can always add a parameter for that should it ever be requested. -- Dave Mielke | 2213 Fox Crescent | The Bible is the very Word of God. Phone: 1-613-726-0014 | Ottawa, Ontario | http://Mielke.cc/bible/ EMail: d...@mielke.cc | Canada K2A 1H7 | http://FamilyRadio.org/
diff --git a/Drivers/Braille/TTY/braille.c b/Drivers/Braille/TTY/braille.c index f3da547..e496224 100644 --- a/Drivers/Braille/TTY/braille.c +++ b/Drivers/Braille/TTY/braille.c @@ -36,6 +36,7 @@ static iconv_t conversionDescriptor = NULL; #include "log.h" #include "parse.h" #include "charset.h" +#include "unicode.h" #include "get_curses.h" #ifndef GOT_CURSES @@ -289,11 +290,32 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) { #endif /* GOT_CURSES */ { - int row; - for (row=0; row<brl->textRows; row++) { - writeText(&text[row*brl->textColumns], brl->textColumns); - if (row < brl->textRows-1) + wchar_t braille[brl->textColumns]; + + for (unsigned int row=0; row<brl->textRows; row++) { + unsigned int offset = row * brl->textColumns; + + for (unsigned int column=0; column<brl->textColumns; column+=1) { + unsigned char c = brl->buffer[offset + column]; + braille[column] = UNICODE_BRAILLE_ROW + | (!!(c & BRL_DOT1) << 0) + | (!!(c & BRL_DOT2) << 1) + | (!!(c & BRL_DOT3) << 2) + | (!!(c & BRL_DOT4) << 3) + | (!!(c & BRL_DOT5) << 4) + | (!!(c & BRL_DOT6) << 5) + | (!!(c & BRL_DOT7) << 6) + | (!!(c & BRL_DOT8) << 7) + ; + } + + writeText(&text[offset], brl->textColumns); + addstr("\r\n"); + writeText(braille, brl->textColumns); + + if (row < (brl->textRows - 1)) { addstr("\r\n"); + } } }
_______________________________________________ This message was sent via the BRLTTY mailing list. To post a message, send an e-mail to: BRLTTY@mielke.cc For general information, go to: http://mielke.cc/mailman/listinfo/brltty