Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

11
  • Thanks! So you're saying that it's MATE Terminal that produces the output of Device Status Report. And that VT100 did similarly. So far, so good. But what does my keyboard have to do with it? Commented Jul 17 at 2:14
  • The terminal driver is aware of both the keyboard device, and the display on which it is echoing the input from that keyboard. Your stdout might be redirected anywhere. Commented Jul 17 at 12:47
  • @Paul_Pedant, sorry, I don't follow. Do you mean that I can redirect stdout anywhere? Commented Jul 17 at 13:58
  • 1
    @Mike Rather the other way round. If you redirect stdout, it becomes difficult to send the commands to the terminal at all. If you redirect stdin, you are not even sending the query to the terminal. And anything you type at the command line changes the cursor position from what it was before you started to ask. As your command line terminator is Newline, the column index will always be 1, and the row number will be +1 (or more if the command wrapped over further lines, or unchanged if the whole screen just racked up). If you need to know x,y you really need a full ncurses treatment. Commented Jul 17 at 17:37
  • 1
    @Mike Stdin is only a default. You can reassign stdin to read the output of another process (with a pipe) or from a file (with the < operator). Then sending the DSR request to stdin will not go to the tty, so you won't get any sensible response. As in a previous comment, a tty is inherently a bidirectional device (so you can maintain a conversation), and stdin is generally read/write. Try: echo 'Take That!' 1>&0 : which redirects stdout to stdin. Commented Jul 17 at 22:41