Question

How should the response from the DA escape sequence (\e[c) be interpreted?

When running the command in urxvt i get 1;2, in linux console (and st) i get 6; and in xterm i get 64;1;2;6;9;15;18;21;22.

From what I have been able to find on the internet these strings are supposed to somehow identify the terminals capabilities. http://www.vt100.net/docs/vt100-ug/chapter3.html#DA

No options                  ESC [?1;0c
Processor option (STP)      ESC [?1;1c
Advanced video option (AVO) ESC [?1;2c
AVO and STP                 ESC [?1;3c
Graphics option (GPO)       ESC [?1;4c
GPO and STP                 ESC [?1;5c
GPO and AVO                 ESC [?1;6c
GPO, STP and AVO            ESC [?1;7c

This seems to fit with the response from urxvt (and possibly xterm) but not with the others. All the mentioned terminals seems to be fairly VT-102 compatible and as far as I know that would map to 1;2 (AVO).

Anyone out there who knows?

Was it helpful?

Solution

documentation for the xterm response is readily found in XTerm Control Sequences

note as with all X window apps there is a resource to change the response to whatever you want..

       
CSI Ps c  Send Device Attributes (Primary DA).
            Ps = 0  or omitted ⇒  request attributes from terminal.  The
          response depends on the decTerminalID resource setting.
            ⇒  CSI ? 1 ; 2 c  ("VT100 with Advanced Video Option")
            ⇒  CSI ? 1 ; 0 c  ("VT101 with No Options")
            ⇒  CSI ? 6 c  ("VT102")
            ⇒  CSI ? 6 2 ; Psc  ("VT220")
            ⇒  CSI ? 6 3 ; Psc  ("VT320")
            ⇒  CSI ? 6 4 ; Psc  ("VT420")

          The VT100-style response parameters do not mean anything by
          themselves.  VT220 (and higher) parameters do, telling the
          host what features the terminal supports:
            Ps = 1  ⇒  132-columns.
            Ps = 2  ⇒  Printer.
            Ps = 3  ⇒  ReGIS graphics.
            Ps = 4  ⇒  Sixel graphics.
            Ps = 6  ⇒  Selective erase.
            Ps = 8  ⇒  User-defined keys.
            Ps = 9  ⇒  National Replacement Character sets.
            Ps = 1 5  ⇒  Technical characters.
            Ps = 1 6  ⇒  Locator port.
            Ps = 1 7  ⇒  Terminal state interrogation.
            Ps = 1 8  ⇒  User windows.
            Ps = 2 1  ⇒  Horizontal scrolling.
            Ps = 2 2  ⇒  ANSI color, e.g., VT525.
            Ps = 2 8  ⇒  Rectangular editing.
            Ps = 2 9  ⇒  ANSI text locator (i.e., DEC Locator mode).
xt locator (i.e., DEC Locator mode)

my WAG some emulators don't implement this completely/correctly so if you depend on it you need to go on a case by case basis.

OTHER TIPS

According to VT100.net, 64 appears to designate VT-420 capabilities:

VT420 DA* CSI ? 64; 1; 2; 6; 7; 8; 9; 15; 18; 19; 21 c VT420 terminal

But as george noted, and having hacked a few termcap entries back in the day, there is very little consistency in even what a single terminal type will answer in reply to inquiries.

There's a ton of information at that site, all of which should be considered "best effort" by the authors as "authoritative" really cannot be achieved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top