How to use a custom line discipline
Kernel code, as stated, can register a new line discipline with the tty subsystem, and this is also available to modularized code. You could, therefore, write your own line discipline and register it. Each line discipline is identified by a number, and a symbolic name for it is available, as common with C programming. Assigned numbers are given a name byinclude/asm/termios.h.
The default tty line discipline is identified by a number of
N_TTY
, PPP uses N_PPP
and so on. Unfortunately, no line discipline numbers have currently been reserved for ``local use'', so you can only experiment with the numbers that are not used on your system. Actually, no official driver currently used N_MOUSE
, so this is a good bet for your custom line discipline.
In order to activate the
N_MOUSE
line discipline, the user space program must use this code:
#include
int i = N_MOUSE;
ioctl(fd, TIOCSETD, &i);
No comments:
Post a Comment