[BRLTTY] [PATCH 6/6] Alva BC6xx: assimilate second routing key events to what they actually are

Nicolas Pitre nico at fluxnic.net
Wed Jan 23 15:36:35 EST 2013


The BC6xx series have the ability to emulate a second row of cursor routing
keys as used to be available on the 5xx series.  This works with a press
delay which is very obnoxious to use.  Now that no more bindings are
using those, let's assimilate those 2nd row key events to what they
actually are, i.e. standard routing keys.  That allows this feature to
remain active in the display in case some other screen reader packages
depend on those events without impacting BRLTTY's reliability too much.
It is still adviseable to disable that feature in the BC6xx internal
menu if only BRLTTY is used.

In case someone absolutely insists on binding those key events in BRLTTY,
a driver parameter can be used to restore the previous behavior.  I do
think that implementing such functionality i.e. a held key attribute for
BRLTTY key bindings, would be much more reliable if done in BRLTTY's core
code.
---
 Drivers/Braille/Alva/braille.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/Drivers/Braille/Alva/braille.c b/Drivers/Braille/Alva/braille.c
index 2e74d8b..cb6d5b3 100644
--- a/Drivers/Braille/Alva/braille.c
+++ b/Drivers/Braille/Alva/braille.c
@@ -112,8 +112,14 @@
 #include "timing.h"
 #include "ascii.h"
 #include "hidkeys.h"
+#include "parse.h"
 #include "brltty.h"
 
+typedef enum {
+  PARM_ALLOW_2ND_ROUTING_EMUL
+} DriverParameter;
+#define BRLPARMS "allow_2nd_routing_row_emul"
+
 #define BRL_STATUS_FIELDS sfAlphabeticCursorCoordinates, sfAlphabeticWindowCoordinates, sfStateLetter
 #define BRL_HAVE_STATUS_CELLS
 #include "brl_driver.h"
@@ -955,6 +961,7 @@ static const ProtocolOperations protocol1Operations = {
 static uint32_t firmwareVersion2;
 static unsigned char splitOffset2;
 static HidKeyboardPacket hidKeyboardPacket2;
+static unsigned int allow_2ndRoutingEmul;
 
 static void
 initializeVariables2 (void) {
@@ -1033,6 +1040,17 @@ interpretKeyEvent2 (BrailleDisplay *brl, unsigned char group, unsigned char key)
       unsigned char secondary = key & 0X80;
       key &= ~secondary;
 
+      /* 
+       * The 6xx series don't have a second row of routing keys but
+       * pretend having them to aid compatibility with the 5xx series
+       * using an obnoxious press delay.  It is adviseable to turn that
+       * functionality off in the display, but in case it is left active
+       * we just assimilate such reported keys as actual RoutingKeys1 by
+       * default, unless overriden by a driver param.
+       */
+      if (!allow_2ndRoutingEmul)
+        secondary = 0;
+
       if (firmwareVersion2 < 0X011102)
         if (key >= splitOffset2)
           key -= splitOffset2;
@@ -1698,6 +1716,11 @@ brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
   if (io->openPort(device)) {
     protocol->initializeVariables();
 
+    if (*parameters[PARM_ALLOW_2ND_ROUTING_EMUL])
+      if (!validateYesNo(&allow_2ndRoutingEmul, parameters[PARM_ALLOW_2ND_ROUTING_EMUL]))
+        logMessage(LOG_WARNING, "%s: %s", "invalid allow_2nd_routing_row_emul setting",
+                   parameters[PARM_ALLOW_2ND_ROUTING_EMUL]);
+
     if (protocol->detectModel(brl)) {
       makeOutputTable(dotsTable_ISO11548_1);
 
-- 
1.8.0



More information about the BRLTTY mailing list