[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Remove IEXTEN to XKEY mapping (fixes nano arrow keys)



On 10/02/2013 19:29, Andreas Schwab wrote:
Do you believe that mapping IEXTEN to XKEY is correct?

I don't think so.  The main function of IEXTEN is to enable extra
characters that perform local tty control functions (see the example of
enabling backslash to quote the next character).  As such it should only
change how characters are intercepted at the tty level, but should not
alter the characters that are sent through to the read queue.

For memories:

- XKEY is a kernel flag which generates escape sequences when function keys (such arrows) are pressed.

- IEXTEN is a termios flag to change the interpretation of some special characters.

We agreed that the MiNTLib mapping from IEXTEN to XKEY was incorrect.

Here is a patch which disables that mapping. This fixes the arrow keys with nano on the BIOS console.

IEXTEN.patch
Remove IEXTEN to XKEY mapping. Contributed by Vincent Riviere.

Alan, please commit!

NB: If software needs to disable the XKEY feature, they must use Fcntl(TIOCSETN), just like XaAES does.

--
Vincent Rivière
diff -aurN -x CVS mintlib.orig/termios/tcgetattr.c mintlib/termios/tcgetattr.c
--- mintlib.orig/termios/tcgetattr.c	2013-12-19 11:27:13.234375000 +0100
+++ mintlib/termios/tcgetattr.c	2014-10-06 00:52:47.093750000 +0200
@@ -71,7 +71,6 @@
 			| ((sg.sg_flags & ODDP) ? (PARENB | PARODD) : 0));
   stp->c_lflag = (tcflag_t) ((sg.sg_flags & (TOSTOP | NOFLSH | ECHOCTL))
 			| ((sg.sg_flags & ECHO) ? (ECHO | ECHOE | ECHOK) : 0)
-			| ((sg.sg_flags & XKEY) ? IEXTEN : 0)
 			| ((sg.sg_flags & RAW)
 				? 0 
 				: ISIG | (sg.sg_flags & CBREAK ? 0 : ICANON)));
diff -aurN -x CVS mintlib.orig/termios/tcsetattr.c mintlib/termios/tcsetattr.c
--- mintlib.orig/termios/tcsetattr.c	2002-04-24 08:54:11.000000000 +0200
+++ mintlib/termios/tcsetattr.c	2014-10-06 00:52:47.093750000 +0200
@@ -42,7 +42,7 @@
     return -1;
   }
   sg.sg_flags &= ~(CRMOD | TANDEM | RTSCTS | EVENP | ODDP | TOSTOP 
-			| NOFLSH | ECHOCTL | RAW | CBREAK | ECHO | XKEY);
+			| NOFLSH | ECHOCTL | RAW | CBREAK | ECHO);
   sg.sg_flags |= (((stp->c_iflag & ICRNL) ? CRMOD : 0)
 			| (((stp->c_iflag & (IXON | IXOFF)) == (IXON | IXOFF)) ? TANDEM : 0)
 			| ((stp->c_cflag & CRTSCTS) ? RTSCTS : 0));
@@ -55,7 +55,6 @@
 			? ((stp->c_cflag & PARODD) ? ODDP : EVENP)
 			: 0);
   sg.sg_flags |= ((stp->c_lflag & (TOSTOP | NOFLSH | ECHOCTL | ECHO))
-			| ((stp->c_lflag & IEXTEN) ? XKEY : 0)
 			| ((stp->c_lflag & ISIG)
 			   ? (stp->c_lflag & ICANON ? 0 : CBREAK) : RAW));
   sg.sg_ispeed = (char) stp->_c_ispeed;