0

The keystrokes mapped to signals in line discipline can be viewed by stty -e. The output is

enter image description here

ALT+Fn keystroke is not in the list. So, is the keystroke handled by TTY driver?

I read that line discipline is part of TTY driver. Is it true? If true, then why the keystroke is not handled by line discipline? What separates line discipline and TTY driver if line discipline is part of TTY driver?

1

The terminal driver only knows about single bytes of data. Flow control (a feature of line discipline) for example is seen in the start and stop features shown in stty output.

Function keys are different. Unlike the control characters which the terminal driver may recognize, function keys can be multiple bytes of data.

  • Conventionally (excluding things like the tab key), the special keys on your keyboard send an escape character first in a sequence of multiple bytes.
  • Applications (not the terminal driver) recognize these sequences.
  • They may do this using the terminal database, or using hardcoded behavior, relying on the format of the sequence of bytes or simply matching against a known string.
  • I don't really understand. Let's say I use Ubuntu server which does not have X (GUI). ALT+Fn can be used to have another virtual console. If line discipline and TTY driver are not the ones who handle it and there is no X installed, who else handle it? – Ron Vince Mar 14 '16 at 0:14
  • That's done via a special ioctl, not really a feature one would associate with "terminal driver". See control_ioctl(4). – Thomas Dickey Mar 14 '16 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.