Re: [BRLTTY] Adding a dot display to tt driver

2016-09-20 Thread Dave Mielke
[quoted lines by Christoph-Simon Senjak on 2016/09/20 at 20:41 +0200]

>The special keys for help (F1), etc., do not work. 

That's actually expected for now when curses isn't being used. We could assign 
control characters to braille display commands. We might even be able to 
implement the special key escape sequences. Neitehr of these has been done, 
yet, though.

>What is typing other characters supposed to do?

Typing characters should enqueue them as input. Maybe, given that you're using 
a serial port emulator, it's hard to tell the difference between typed input 
and echoed input. One way to be sure, though, would be to see if what you're 
typing also shows up in braille.

-- 
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/
___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-20 Thread Samuel Thibault
Christoph-Simon Senjak, on Tue 20 Sep 2016 20:41:55 +0200, wrote:
> On 20.09.2016 14:11, Dave Mielke wrote:
> >[quoted lines by Christoph-Simon Senjak on 2016/09/20 at 13:47 +0200]
> >
> >>I am using a terminal emulator.
> >
> >Do you mean that input (withotu curses) doesn't work at all, or that special
> >keys (e.g. the arrow keys) don't work but that typing characters (e.g. 
> >letters)
> >still does work?
> 
> The special keys for help (F1), etc., do not work.

We need ncurses to get the codes for these keys right. Only plain text
keys can work without ncurses.

> What is typing other characters supposed to do?

Simulate pressing the corresponding key on the PC keyboard. But that can
only work when using the Linux screen driver or running xbrlapi. And of
course you risk getting a loop :) since the simulated keypress event
will probably go into the xterm where you are running the TTY braille
driver, and thus simulating it again, etc.

Samuel
___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-20 Thread Christoph-Simon Senjak



On 20.09.2016 14:11, Dave Mielke wrote:

[quoted lines by Christoph-Simon Senjak on 2016/09/20 at 13:47 +0200]


I am using a terminal emulator.


Do you mean that input (withotu curses) doesn't work at all, or that special
keys (e.g. the arrow keys) don't work but that typing characters (e.g. letters)
still does work?



The special keys for help (F1), etc., do not work. What is typing other 
characters supposed to do?


Best Regards
Christoph-Simon Senjak
___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-20 Thread Dave Mielke
[quoted lines by Christoph-Simon Senjak on 2016/09/20 at 13:47 +0200]

>I am using a terminal emulator.

Do you mean that input (withotu curses) doesn't work at all, or that special 
keys (e.g. the arrow keys) don't work but that typing characters (e.g. letters) 
still does work?

-- 
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/
___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-20 Thread Christoph-Simon Senjak

I am using a terminal emulator.

$ stty -a -F /dev/pts/7
speed 38400 baud; rows 50; columns 194; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; 
eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt 
= ^R; werase = ^W; lnext = ; discard = ^O;

min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl 
-ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 
vt0 ff0
isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop 
-echoprt echoctl echoke -flusho -extproc


On 18.09.2016 20:31, Dave Mielke wrote:

[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 18:37 +0200]


It appears to work now in both configurations.


That patch is now committed to the repository.


Without ncurses, it does not react on keyboard inputs, but neither does the
original code which had no dots.


Are you using a serial port with an external device, a virtual tty, or what?

Could you please post the output of "stty -a -F /dev/whatever" while brltty is
ruhnning without ncurses?


___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-18 Thread Dave Mielke
[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 18:37 +0200]

>It appears to work now in both configurations. 

That patch is now committed to the repository.

>Without ncurses, it does not react on keyboard inputs, but neither does the 
>original code which had no dots.

Are you using a serial port with an external device, a virtual tty, or what?

Could you please post the output of "stty -a -F /dev/whatever" while brltty is 
ruhnning without ncurses?

-- 
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/
___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-18 Thread Christoph-Simon Senjak

Hi.

Thank you. It appears to work now in both configurations. Without 
ncurses, it does not react on keyboard inputs, but neither does the 
original code which had no dots.


Best Regards,
Christoph-Simon Senjak

On 18.09.2016 14:47, Dave Mielke wrote:

[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 14:06 +0200]


Ok, I found a problem: I compiled it without ncurses support
originally (because you have to give ncurses as explicit dependency
in your nix-shell) and it worked.

With ncurses support, only the dot display is shown, and I think I
have located the problem: [1] says that Newline does a clrtoeol,
which deletes the current line. So addstr("\r\n") will set the cursor
to the beginning of the current line and then delete it. Replacing it
with just "\n" will make it work for me, but I am not sure how that
will be when no ncurses is available.


Please test the attached patch (tty-newline-1.patch) with and without ncurses.



___
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


___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-18 Thread Dave Mielke
[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 14:06 +0200]

>Ok, I found a problem: I compiled it without ncurses support
>originally (because you have to give ncurses as explicit dependency
>in your nix-shell) and it worked.
>
>With ncurses support, only the dot display is shown, and I think I
>have located the problem: [1] says that Newline does a clrtoeol,
>which deletes the current line. So addstr("\r\n") will set the cursor
>to the beginning of the current line and then delete it. Replacing it
>with just "\n" will make it work for me, but I am not sure how that
>will be when no ncurses is available.

Please test the attached patch (tty-newline-1.patch) with and without ncurses.

-- 
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 a8c3317..2230199 100644
--- a/Drivers/Braille/TTY/braille.c
+++ b/Drivers/Braille/TTY/braille.c
@@ -39,10 +39,13 @@ static iconv_t conversionDescriptor = NULL;
 #include "unicode.h"
 #include "get_curses.h"
 
-#ifndef GOT_CURSES
+#ifdef GOT_CURSES
+#define newline() addstr("\n")
+#else /* GOT_CURSES */
 #define addstr(string) serialWriteData(ttyDevice, string, strlen(string))
 #define addch(character) do { unsigned char __c = (character); 
serialWriteData(ttyDevice, &__c, 1); } while(0)
 #define getch() my_getch()
+#define newline() addstr("\r\n")
 #endif /* GOT_CURSES */
 
 #ifdef GOT_CURSES
@@ -286,7 +289,7 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) {
 #ifdef GOT_CURSES
   clear();
 #else /* GOT_CURSES */
-  addstr("\r\n");
+  newline();
 #endif /* GOT_CURSES */
 
   {
@@ -310,11 +313,11 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t 
*text) {
 ;
   }
 
-  addstr("\r\n");
+  newline();
   writeText(braille, brl->textColumns);
 
   if (row < (brl->textRows - 1)) {
-addstr("\r\n");
+newline();
   }
 }
   }
@@ -332,7 +335,7 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) {
 addch('\r');
 writeText(text, brl->cursor);
   } else {
-addstr("\r\n");
+newline();
   }
 #endif /* GOT_CURSES */
 
___
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

Re: [BRLTTY] Adding a dot display to tt driver

2016-09-18 Thread Christoph-Simon Senjak

Hello.

Ok, I found a problem: I compiled it without ncurses support originally 
(because you have to give ncurses as explicit dependency in your 
nix-shell) and it worked.


With ncurses support, only the dot display is shown, and I think I have 
located the problem: [1] says that Newline does a clrtoeol, which 
deletes the current line. So addstr("\r\n") will set the cursor to the 
beginning of the current line and then delete it. Replacing it with just 
"\n" will make it work for me, but I am not sure how that will be when 
no ncurses is available.


Regards,
Christoph-Simon Senjak

[1]:http://invisible-island.net/ncurses/man/curs_addch.3x.html

On 18.09.2016 01:27, Dave Mielke wrote:

[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 00:57 +0200]


It appears to work.


Thanks for testing it.


Will you add this patch to the git repo?


Done.


___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-17 Thread Dave Mielke
[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 00:57 +0200]

>It appears to work. 

Thanks for testing it.

>Will you add this patch to the git repo?

Done.

-- 
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/
___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-17 Thread Christoph-Simon Senjak

Hi.

Thank you. It appears to work. Will you add this patch to the git repo?

Best Regards
Christoph-Simon Senjak

On 17.09.2016 23:21, Dave Mielke wrote:

[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.



___
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


___
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


Re: [BRLTTY] Adding a dot display to tt driver

2016-09-17 Thread Dave Mielke
[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; rowtextRows; row++) {
-  writeText([row*brl->textColumns], brl->textColumns);
-  if (row < brl->textRows-1)
+wchar_t braille[brl->textColumns];
+
+for (unsigned int row=0; rowtextRows; row++) {
+  unsigned int offset = row * brl->textColumns;
+
+  for (unsigned int column=0; columntextColumns; 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([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

Re: [BRLTTY] Adding a dot display to tt driver

2016-09-17 Thread Samuel Thibault
Hello,

Thanks!

Christoph-Simon Senjak, on Sat 17 Sep 2016 21:54:21 +0200, wrote:
>  int row;
>  for (row=0; rowtextRows; row++) {
>writeText([row*brl->textColumns], brl->textColumns);
> +  addstr("\r\n");
> +
> +  wchar_t converted[brl->textColumns];
> +  int col;
> +  for (col = 0; col < brl->textColumns; ++col) {
> +   /* from the XW driver */
> +   unsigned char c = brl->buffer[col];

Here you need to add row*brl->textColumns to col, to get the proper line
from brl->buffer. Apart from that, the patch looks good.  An option could
be useful, but it shouldn't be too bad to always print it, on most
systems nowadays it will be fine.

> +   c =
> + (!!(c_DOT1))<<0
> + |(!!(c_DOT2))<<1
> + |(!!(c_DOT3))<<2
> + |(!!(c_DOT4))<<3
> + |(!!(c_DOT5))<<4
> + |(!!(c_DOT6))<<5
> + |(!!(c_DOT7))<<6
> + |(!!(c_DOT8))<<7;
> +   converted[col] = 0x2800 | c;
> +  }
> +  writeText(converted, brl->textColumns);
> +
> +  //  writeText([row*brl->textColumns], 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
> 

-- 
Samuel
 ça gaze ?
 prout
 -+- #ens-mim - ouvrez les fenêtres ! -+-
___
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