VT102 escape codes

Massimiliano Cialdi massimiliano.cialdi at powersoft.com
Mon Feb 18 09:35:46 GMT 2019


I use minicom to communicate, via serial line, with a device that dumps 
the characters received in hexadecimal. I do this to see the escape 
codes for some keys. I tried minicom once with VT102 terminal emulation 
and once ANSI.

For both VT102 and ANSI, the arrow keys correspond to

     Up:    Esc [ A
     Down:  Esc [ B
     Right: Esc [ C
     Left:  Esc [ D

This is matches what I find in several websites, for example 
https://vt100.net/docs/vt102-ug/appendixc.htmlor 
https://vt100.net/docs/vt102-ug/contents.html

I tried other keys for which I cannot find any reference throughout the web:

                 VT102         ANSI
     Home:     Esc [ 1 ~      Esc [ H
     End:      Esc O F        Esc O F
     Insert:   Esc [ 2 ~      Esc [ @

Are these codes standard? And what standard? where can I find a match on 
the internet?

If I try by command line (xfce-terminal), pressing Home, End and Insert 
in this order:

     $ cat | hexdump -C
     ^[[H^[[F^[[2~00000000  1b 5b 48 1b 5b 46 1b 5b  32 
7e                    |.[H.[F.[2~|

It seems that Home is equal to Minicom ANSI sequence, End change the 'O' 
into '[', and Insert is equal to Minicom VT102 escape sequence.
The same running GtkTerm.

I tried also with TeraTerm on Windows, with still different results.

Summarising

                Minicom VT102        Minicom ANSI xfce-terminal & 
GtkTerm    TeraTerm VT100/VT102
     Home:         Esc [ 1 ~           Esc [ H              Esc [ 
H                   Esc [ 1 ~
     End:          Esc O F             Esc O F              Esc [ 
F                   Esc [ 4 ~
     Insert:       Esc [ 2 ~           Esc [ @              Esc [ 2 
~                 Esc [ 2 ~

I need to write a command line interpreter to handle a small subset of 
these escape codes. I don't know which escape codes to use, since the 
standards don't include the keys I intend to use.


best regards

Max




More information about the minicom-devel mailing list