[BRLTTY] control characters not registering using brltty with screen on Mac Yosemite with Braille Edge - kbdkeys added
Dave Mielke
dave at mielke.cc
Mon Jul 6 01:54:04 EDT 2015
Please try the attached patch and let me know what difference it does (or
doesn't) make.
--
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: Dave at Mielke.cc | Canada K2A 1H7 | http://FamilyRadio.org/
-------------- next part --------------
diff --git a/Drivers/Screen/Screen/screen.c b/Drivers/Screen/Screen/screen.c
index 3767e25..daa26e4 100644
--- a/Drivers/Screen/Screen/screen.c
+++ b/Drivers/Screen/Screen/screen.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -41,6 +42,7 @@ static int shmFileDescriptor = -1;
#include "log.h"
#include "hostcmd.h"
#include "charset.h"
+#include "ascii.h"
#include "scr_driver.h"
#include "screen.h"
@@ -129,7 +131,7 @@ doScreenCommand (const char *command, ...) {
int count = 0;
va_start(args, command);
- while (va_arg(args, char *)) ++count;
+ while (va_arg(args, char *)) count += 1;
va_end(args);
{
@@ -206,7 +208,7 @@ static int
insertKey_ScreenScreen (ScreenKey key) {
const unsigned char flags = getAuxiliaryData()[1];
wchar_t character = key & SCR_KEY_CHAR_MASK;
- char buffer[3];
+ char buffer[10];
char *sequence;
logMessage(LOG_DEBUG, "insert key: %04X", key);
@@ -264,12 +266,22 @@ insertKey_ScreenScreen (ScreenKey key) {
if (byte == EOF) {
logMessage(LOG_WARNING, "character not supported in local character set: 0X%04X", key);
+ return 0;
}
sequence = buffer + sizeof(buffer);
- *--sequence = 0;
- *--sequence = byte;
- if (key & SCR_KEY_ALT_LEFT) *--sequence = 0X1B;
+
+ if (isprint(byte)) {
+ *--sequence = 0;
+ *--sequence = byte;
+ if (byte == '\\') *--sequence = byte;
+ } else {
+ size_t size = 5;
+ sequence -= size;
+ snprintf(sequence, size, "\\%03o", byte);
+ }
+
+ if (key & SCR_KEY_ALT_LEFT) *--sequence = ESC;
}
return doScreenCommand("stuff", sequence, NULL);
More information about the BRLTTY
mailing list