document updated 12 years ago, on Jun 6, 2012
There are a few
ANSI codes that the server-side can send, to request some information from the client side.
Run ansi_replies.sh to see how a particular terminal responds.
query cursor position
query: <ESC>[6n
response: <ESC>[{row};{column}R
query: ^E
response: {stationid}
The response is usually user-configurable. For example, xterm's default response is blank, but this can be set via an .Xresources of answerbackString.
query device status
query: <ESC>[5n
responses:
- <ESC>[0n — Ready, no malfunctions detected.
- <ESC>[3n — Malfunction, error in self-test. Reset and retry.
query printer status
query: <ESC>[?15n
responses:
- <ESC>[?13n — Printer not connected to terminal. Data terminal ready (DTR) signal of the printer has not been on since terminal turned on.
- <ESC>[?11n — Printer not ready to print. Printer DTR was on, but is now off.
- <ESC>[?10n — Printer ready to print. Printer DTR is on.
query device attributes
query: <ESC>[c or <ESC>Z
responses:
- <ESC>[1;0c — No options
- <ESC>[1;1c — Processor option (STP)
- <ESC>[1;2c — Advanced video option (AVO)
- <ESC>[1;3c — AVO and STP
- <ESC>[1;4c — Graphics option (GPO)
- <ESC>[1;5c — GPO and STP
- <ESC>[1;6c — GPO and AVO
- <ESC>[1;7c — GPO, STP and AVO