I never really understood how a terminal emulator (be it e.g. XTerm or the Linux virtual console) works. What transformations happen to the input (key up/down events) to produce the output (usually the standard input of the application that is running in the terminal, a signal being sent and so on)? What is actually the input for the terminal and what is already handled by the input drivers (in the kernel, X server, ...). How and where do the terminal capabilities databases like terminfo or termcap enter this process? How are "special" keys like arrows processed? And conversely: how does it work the other way round: application standard output/error → medium (screen, paper)?
Asked
Active
Viewed 163 times
1
-
3some answers there. You might want to break this down into several questions. Otherwise it's going to be too broad. – Stéphane Chazelas Sep 29 '14 at 20:35
-
Well, I wouldn't say exactly "broad" but definitely "long". I'll read your answer on the other question thoroughly and will try to refactor this question into several (linked) parts tomorrow. Thanks! – peterph Sep 29 '14 at 21:10
-
@StéphaneChazelas actually your answer in the other question provided me with an important search term: line discipline. I'll have to read about that a bit more to make sure what pieces of the puzzle will be still missing. – peterph Sep 29 '14 at 21:26
-
http://www.linusakesson.net/programming/tty/ – Olivier Dulac Sep 29 '14 at 23:11
-
I'm voting to close as a duplicate of http://unix.stackexchange.com/questions/116629/how-do-keyboard-input-and-text-output-work which presents a high-level view. Together with Stéphane's excellent detailed answer, I think this provides as good a presentation of what you're asking here as it gets. You're welcome to edit your question if there are points that you feel are missing. – Gilles 'SO- stop being evil' Sep 29 '14 at 23:26
-
More there on line disciplines. – Stéphane Chazelas Sep 30 '14 at 06:33
-
@Gilles I'm perfectly fine with that. I'll probably ask for reopening once I get through all the referenced sources - even if just to create an answer that would gather it all in one place with a little bit of glue. Thanks. – peterph Sep 30 '14 at 09:39