devc-con, devc-con-hid
Simple VGA console and keyboard I/O manager (QNX OS)
Syntax:
devc-con [options] [-d [file]] [-k]
[-i number] [-L [P][N][C][S]]
[-N [name]] [-n num_ports]
[-r rate[,delay]] &
devc-con-hid [options] [-d [file]] [-hk]
[-L [P][N][C][S]]
[-N [name]] [-n num_ports]
[-r rate[,delay]] &
Runs on:
QNX OS
Targets:
x86_64
Options:
- -e
- The default is
edited
mode, notraw
mode (-E). - -F
- Disable hardware flow control.
Hardware flow control isn't supported in
edited
mode. - -I size
- Size of input buffer in bytes (default 256).
- -O size
- Size of output buffer in bytes (default default 3×256).
- -s
- Enable software flow control.
- -d file
- File directory of keyboard mapping.
- -h
- (devc-con-hid only) Don't connect to the io-hid server; read from the keyboard controller instead.
- -i number
- (devc-con only) Specify the interrupt vector for a keyboard device (default 1).
- -k
- Disable the keyboard (don't attach to the keyboard interrupt).
- -L [P][C][N][S]
- Set the initial state of the keyboard and its LEDs (default all off):
- P — preserve the keyboard state. This overrides all the other -L options.
- C — turn CapsLock on.
- N — turn NumLock on.
- S — turn ScrollLock on.
- -n num_ports
- The number of virtual console ports to create.
The default is
4
; the maximum is9
. - -N
- Give a specific name for the device node i.e."/dev/<name>".
- -r rate[,delay]
- Specify the initial keyboard typematic rate (in Hz) and, optionally, the initial keyboard delay
(in ms). The default values are 30 Hz and 500 ms.
The keyboard typematic rate is the number of times per second that a depressed key repeats. On a PC/AT-compatible system, this ranges from 2 to 30 characters per second. If the option -r 0 is specified, the keyboard typematic rate isn't set by the driver.
The keyboard delay is defined as the time from when a key is first pressed to when the start of the first repeated key is generated. On a PC/AT-compatible system, the keyboard delay can range from 250 to 1000 milliseconds.
Description:
The devc-con manager provides an interface to the VGA console screen and keyboard.
When devc-con starts, it creates and manages the devices /dev/con1, /dev/con2, and so on, up to the number of ports specified by the -n option.
The devc-con-hid manager is similar to devc-con, but works in conjunction with io-hid and supports PS2, USB, and all other human-interface devices.
If you read from /dev/console, these managers return the characters typed on the keyboard; if you write to /dev/console, the managers write to the screen.
[type=link] /dev/console = /dev/con1
The devc-con and devc-con-hid managers all emulate an 80×25 ANSI terminal.
Keyboard control
You can use the keyboard to switch between virtual consoles.
If you want to see: | Press: |
---|---|
The next active console | CtrlAltEnter or CtrlAlt+ (plus) |
The previous active console | CtrlAlt- (minus) |
If you want to see: | Press: |
---|---|
/dev/con1 | CtrlAlt1 |
/dev/con2 (if available) | CtrlAlt2 |
… | … |
/dev/con10 (if available) | CtrlAlt0 |
Character sets
The devc-con and devc-con-hid
managers let you choose the character
sets in use from a palette
of character sets, each of
which is independently programmable to contain one of several
builtin character sets.
0x00
through 0xff
.
Two of these regions
are fixed sets of control characters, while the other two are configurable
to contain a choice of character sets:
Hex: | Name: | May be set to one of: |
---|---|---|
0x00-0x1f | C0 (Control Zero) | Not configurable |
0x20-0x7f | GL (Graphics Left) | G0, G1, G2, G3 |
0x80-0x9f | C1 (Control One) | Not configurable |
0xa0-0xff | GR (Graphics Right) | G1, G2, G3 |
You can set each of the GL and GR in-use character sets to a choice of several character sets from the G0, G1, G2 and G3 character sets.
To set: | To: | Use: |
---|---|---|
GL | G0 | {LS0} = {SI} (0f) |
GL | G1 | {LS1} = {SO} (0e) |
GL | G2 | {LS2} = {ESC n} (1b 6e) or {SS2} (8e) |
GL | G3 | {LS3} = {ESC o} (1b 6f) or {SS3} (8f) |
GR | G1 | {LS1R}= {ESC ~} (1b 7e) |
GR | G2 | {LS2R}= {ESC }} (1b 7d) |
GR | G3 | {LS3R}= {ESC |} (1b 7c) |
The {LS*} codes stand for Locking Shift
. When character sets are
selected by these means, they remain in effect until another {LS*} code is sent.
The {SS*} codes stand for Single Shift
and affect the next
character only. After that character, the character set in effect
reverts to its previous setting. There are only two {SS*} codes,
{SS2} and {SS3} which maps G2 into GL and G3 into GL, respectively.
ESC g s
where:
g: | Sets: |
---|---|
( |
G0 |
) |
G1 |
* |
G2 |
+ |
G3 |
s: | Specifies: |
---|---|
B |
ASCII |
0 |
Special (DEC Graphic) |
< |
ISO-Latin1 Supplemental |
U |
PC Character Set |
Character set defaults
In-use char set: | Defaults to: |
---|---|
GR | G2 |
GL | G0 |
Char set: | Defaults to: |
---|---|
G0 | ASCII charset |
G1 | Special charset (DEC Graphic) |
G2 | Supplemental charset (ISO-Latin 1) |
G3 | Special charset (DEC Graphic) |
Character set example:
{ESC )U} 1e 29 55 (Set G1 to be the PC character set)
{SO} 0e (Set GL to G1)
.
. (Write chars in PC graphics char set)
.
{SI} 0f (Set GL to G0)
ANSI screen control codes
- (220+)
- A VT220 Level 2 function
- (NA)
- Not ANSI standard
- (NI)
- Not implemented
- (NFI)
- Not fully implemented
C0 control codes
ASCII | ANSI Mnemonic | Hex | Action |
---|---|---|---|
{NUL} | 00 | Null | |
{BEL} | 07 | Bell | |
{BS} | 08 | Back Space (VT100 defaults to no wrap from left margin) | |
{HT} | 09 | Horizontal Tab (VT100 defaults to no autowrap) | |
{LF} | 0A | Linefeed or Newline | |
{VT} | 0B | Same as LF | |
{FF} | 0C | Clears Screen (QNX Extension) | |
{CR} | 0D | Move cursor to left margin | |
{SO} | {LS1} | 0E | GL is set to G1 |
{SI} | {LS0} | 0F | GL is set to G0 (default) |
{XON} | {DC1} | 11 | XON |
{XOFF} | {DC0} | 13 | XOFF |
{CAN} | 18 | Cancels ESC sequence | |
{SUB} | 1A | Cancels ESC sequence and prints ? | |
{ESC} | 1B | Start of ESC sequence | |
{DEL} | 7F | Ignored on output |
ESC control sequences
String | Hex | Action |
---|---|---|
{ESC 7} | 1B 37 | Save cursor |
{ESC 8} | 1B 38 | Restore cursor |
{ESC =} | 1B 3D | Set application keypad mode |
{ESC >} | 1B 3E | Set numeric keypad mode (default) |
{ESC D} | 1B 44 | 7-bit codes for {IND} (84) |
{ESC E} | 1B 45 | 7-bit codes for {NEL} (85) |
{ESC H} | 1B 48 | 7-bit codes for {HTS} (88) |
{ESC M} | 1B 4D | 7-bit codes for {RI} (8D) |
{ESC N} | 1B 4E | 7-bit codes for {SS2} (8E) |
{ESC O} | 1B 4F | 7-bit codes for {SS3} (8F) |
{ESC P} | 1B 50 | 7-bit codes for {DCS} (90) |
{ESC [} | 1B 5B | 7-bit codes for {CSI} (9B) |
{ESC \} | 1B 5C | 7-bit codes for {ST} (9C) |
{ESC ]} | 1B 5D | 7-bit codes for {OSC} (9D) |
{ESC ^} | 1B 5E | 7-bit codes for {PM} (9E) |
{ESC _} | 1B 5F | 7-bit codes for {APC} (9F) |
{ESC Z} | 1B 5A | Identify terminal |
{ESC c} | 1B 63 | Hard Reset (clears screen) (use {CSI ! P} for soft reset) |
{ESC n} | 1B 6E | (LS2) GL is set to G2 (220+) |
{ESC o} | 1B 6F | (LS3) GL is set to G3 (220+) |
{ESC |} | 1B 7C | (LS3R) GR is set to G3 (220+) |
{ESC }} | 1B 7D | (LS2R) GR is set to G2 (220+) (default) |
{ESC ~} | 1B 7E | (LS1R) GR is set to G1 |
{ESC sp F} | 1B 20 46 | Keyboard generates 7-bit C1 codes (incl. CSI) (default) |
{ESC sp G} | 1B 20 47 | Keyboard generates 8-bit C1 codes (incl. CSI) (220+) |
{ESC ( 0} | 1B 28 30 | Set G0 to special charset |
{ESC ( <} | 1B 28 3C | Set G0 to supplemental charset |
{ESC ( A} | 1B 28 41 | Set G0 to U.K. charset (Not implemented; same as ASCII) |
{ESC ( B} | 1B 28 42 | Set G0 to ASCII charset (default) |
{ESC ( U} | 1B 28 55 | Set G0 to PCterm graphics |
{ESC ) 0} | 1B 29 30 | Set G1 to special charset (default) |
{ESC ) <} | 1B 29 3C | Set G1 to supplemental charset |
{ESC ) A} | 1B 29 41 | Set G1 to U.K. charset (NI; same as ASCII) |
{ESC ) B} | 1B 29 42 | Set G1 to ASCII charset |
{ESC ) U} | 1B 29 55 | Set G1 to PCterm graphics |
{ESC * 0} | 1B 2A 30 | Set G2 to special charset (220+) |
{ESC * <} | 1B 2A 3C | Set G2 to supplemental charset (220+) (default) |
{ESC * B} | 1B 2A 42 | Set G2 to ASCII charset (220+) |
{ESC * U} | 1B 2A 55 | Set G2 to PCterm graphics |
{ESC + 0} | 1B 2B 30 | Set G3 to special charset (220+) (default) |
{ESC + <} | 1B 2B 3C | Set G3 to supplemental charset (220+) |
{ESC + B} | 1B 2B 42 | Set G3 to ASCII charset (220+) |
{ESC + U} | 1B 2B 55 | Set G3 to PCterm graphics |
C1 control characters (220+)
ESC
followed
by the 8-bit code minus 0x40 hex.
For instance, you can represent the CSI (control sequence
introducer) in 8-bit mode as 0x9b, while in 7-bit mode you must express it
as ESC [
(0x1b 0x5b).
ASCII | Hex | Action |
---|---|---|
{IND} | 84 | Move cursor down with scroll |
{NEL} | 85 | Move to left margin on next line with scroll |
{HTS} | 88 | Set horizontal tab |
{RI} | 8D | Move cursor up with scroll |
{SS2} | 8E | GL is set to G2 for 1 character |
{SS3} | 8F | GL is set to G3 for 1 character |
{DCS} | 90 | Start of Device control string |
{CSI} | 9B | Control sequence introducer |
{ST} | 9C | End of Device control string |
{OSC} | 9D | Operating System Command |
{PM} | 9E | Privacy Message |
{APC} | 9F | Application Program Command |
CSI control sequences
ESC [
. In 8-bit mode, CSI is (hex)0x9B.
Use the ANSI specification to represent the variable n,
e.g., to print two spaces:
printf( "%c%c", 0x9b, 0x32 ) ;
ASCII | Hex | Action |
---|---|---|
{CSI [n] @} | 9B [n] 40 | Insert n spaces at cursor (default = 1 space) |
{CSI [n] A} | 9B [n] 41 | Cursor up n rows, no wrap (default = 1 row) |
{CSI [n] B} | 9B [n] 42 | Cursor down n rows, no wrap (default = 1 row) |
{CSI [n] C} | 9B [n] 43 | Cursor right n columns, no wrap (default = 1 column) |
{CSI [n] D} | 9B [n] 44 | Cursor left n columns, no wrap (default = 1 column) |
{CSI [n] F} | 9B [n] 46 | Cursor up n rows, positioned in first column (default = 1 row) |
{CSI [n] G} | 9B [n] 47 | Move cursor to column n (default = column 1) |
{CSI [r[;c]] H} | 9B [r [3B c]] 48 | Cursor position (default = row 1; column 1) |
{CSI [n] J} | 9B [n] 4A | Erase 0=cur-EOS 1=HOME-cur 2=screen (default = 0 (to end of screen)) |
{CSI [n] K} | 9B [n] 4B | Erase 0=cur-EOL 1=BOL-cur 2=line (default = 0 (to end of line)) |
{CSI [n] L} | 9B [n] 4C | Insert n lines (default = 1 line) |
{CSI [n] M} | 9B [n] 4D | Delete n lines (default = 1 line) |
{CSI [n] P} | 9B [n] 50 | Delete n chars (default = 1 char) |
{CSI [n] S} | 9B [n] 53 | Scroll forward n lines (default = 1 line) |
{CSI [n] T} | 9B [n] 54 | Scroll backward n lines (default = 1 line) |
{CSI [n] X} | 9B [n] 58 | Erase cur for n-1 chars (default = 1 (0 chars)) |
{CSI Z} | (9B 5A) | Back tab |
{c CSI [n] b} | c 9B [n] 62 | Repeat GR or GL character c, n times. c is the last displayable character; n defaults to 1 time. |
{CSI 0 c} | (9B 30 63) | Primary device attrib request |
{CSI [n] d} | 9B [n] 64 | Move cursor to line n (default = line 1) |
{CSI [n] g} | 9B [n] 67 | Tab clear 0=cursor 2=all (default = 0) |
{CSI [n[;n]...] h} | 9B [n[3B n]...] 68 | Standard Set mode (See modes table) (default=none) |
{CSI ? [n[;n]...] h} | 9B 3F [n[3B n]...] 68 | Private Set mode (See modes table) (default=none) |
{CSI [n[;n]...] l} | 9B [n[3B n]...] 6C | Standard Reset mode (See modes table) (default=none) |
{CSI ? [n[;n]...] l} | 9B 3F [n[3B n]...] 6C | Private Reset mode (See modes table) (default=none) |
{CSI [n[;n]...] m} | 9B [n[3B n]...] 6D | Select Graphic Rendition (See below) (default = 0) |
{CSI n n} | 9B n 6E | Device status 5=status 6=cursor/pos |
{CSI [r[;c]] r} | 9B [r [3B c]] 72 | Set scroll region and home cursor |
{CSI r} | 9B 72 | Disable scroll region & home cursor |
{CSI s} | 9B 73 | Save cursor |
{CSI u} | 9B 75 | Restore cursor |
{CSI ! p} | 9B 21 70 | Soft reset |
{CSI [n[;n]] ]} | 9B [n [3B n]...] 5D | Set default 1=underline 2=half-intensity 8=colorset (default=none) |
{CSI = [f [;d]] B} | 9B 3D [f [3B d]] 42 | Set frequency(Hz) and duration (ms) for bell (default=100Hz, 250ms) |
{CSI = [n] F} | 9B 3D [n] 46 | Set and Save foreground color |
{CSI = [n] G} | 9B 3D [n] 47 | Set and Save background color |
Graphic rendition
Number | Meaning |
---|---|
0 | All attributes off (except charset (10, 11, 12)) |
1 | Bold |
2 | Half intensity (default to cyan on color screen) |
4 | Underline (default to red on color screen) |
5 | Blink |
7 | Reverse |
9 | Invisible |
10 | Exit alternate char set (GR & GL are restored) |
11 | Enter PC-lower char set (GR & GL are ASCII; C0 & C1 are PC_LO except for ESC) |
12 | Enter PC-higher char set (GR, C1 & GL, C0 are PC_HI except for ESC) |
21 | Normal intensity (un-Bold) |
22 | Normal intensity (un-Half intensity) |
24 | Disable underline |
25 | Disable blink |
27 | Disable reverse |
29 | Visible |
30-37 | Set foreground color (30+color_number, see below) |
39 | Set foreground to saved |
40-47 | Set background color (40+color_number, see below) |
49 | Set background to saved |
Color numbers
color_number | Description |
---|---|
0 | Black |
1 | Red |
2 | Green |
3 | Brown |
4 | Blue |
5 | Violet |
6 | Cyan |
7 | White |
Modes
Mode string | Description |
---|---|
?1h | cursor key = Application |
?1l | cursor key = ANSI (default) |
?3h | 132 column (Not Implemented) |
?3l | 80 column (default) |
?5h | Reverse screen |
?5l | Not Reverse screen (default) |
?6h | Origin mode |
?6l | Absolute mode |
?7h | Auto wrap on |
?7l | Auto wrap off (default) |
?25h | Visible cursor (default) |
?25l | Invisible cursor |
?45h | Reverse wrap-around mode |
?45l | No reverse wrap-around |
?66h | keypad = Application |
?66l | keypad = ANSI |
?67h | Backspace key generates BS |
?67l | Backspace key generates DEL |
Mapping from QNX keyboard to ANSI keys
Key | Normal | Shift | Ctrl | Alt |
---|---|---|---|---|
Enter | CR |
CR |
CR |
CR |
Tab | TAB |
CSI Z |
CSI z |
|
BS | BS |
RUB |
RUB |
BS |
ESC | ESC |
ESC |
ESC |
ESC |
F1 | SS3 P |
SS3 p |
CSI 1~ |
CSI 17~ |
F2 | SS3 Q |
SS3 q |
CSI 2~ |
CSI 18~ |
F3 | SS3 R |
SS3 r |
CSI 3~ |
CSI 19~ |
F4 | SS3 S |
SS3 s |
CSI 4~ |
CSI 20~ |
F5 | SS3 T |
SS3 t |
CSI 5~ |
CSI 21~ |
F6 | SS3 U |
SS3 u |
CSI 6~ |
CSI 22~ |
F7 | SS3 V |
SS3 v |
CSI 7~ |
CSI 23~ |
F8 | SS3 W |
SS3 w |
CSI 8~ |
CSI 24~ |
F9 | SS3 X |
SS3 x |
CSI 9~ |
CSI 25~ |
F10 | SS3 Y |
SS3 y |
CSI 10~ |
CSI 26~ |
F11 | SS3 Z |
SS3 z |
CSI 11~ |
CSI 27~ |
F12 | SS3 A |
SS3 a |
CSI 12~ |
CSI 28~ |
Home | CSI H |
CSI h |
CSI H |
|
↑ | CSI A |
CSI a |
CSI A |
|
PgUp | CSI V |
CSI v |
CSI V |
|
Minus | CSI S |
CSI s |
CSI S |
|
← | CSI D |
CSI d |
CSI D |
|
kpd 5 | CSI G |
CSI g |
CSI G |
|
→ | CSI C |
CSI c |
CSI C |
|
Plus | CSI T |
CSI t |
CSI T |
|
End | CSI Y |
CSI y |
CSI Y |
|
↓ | CSI B |
CSI b |
CSI B |
|
PgDn | CSI U |
CSI u |
CSI U |
|
Ins | CSI @ |
CSI ` |
CSI @ |
|
Del | CSI P |
CSI p |
CSI P |
|
Prt | NOP |
NOP |
NOP |
NOP |
SysRq | NOP |
NOP |
NOP |
NOP |
a | a |
A |
SOH |
SS2 a |
b | b |
B |
STX |
SS2 b |
c | c |
C |
ETX |
SS2 c |
d | d |
D |
EOT |
SS2 d |
e | e |
E |
ENQ |
SS2 e |
f | f |
F |
ACK |
SS2 f |
g | g |
G |
BEL |
SS2 g |
h | h |
H |
BS |
SS2 h |
i | i |
I |
HT |
SS2 i |
j | j |
J |
LF |
SS2 j |
k | k |
K |
VT |
SS2 k |
l | l |
L |
FF |
SS2 l |
m | m |
M |
CR |
SS2 m |
n | n |
N |
SO |
SS2 n |
o | o |
O |
SI |
SS2 o |
p | p |
P |
DLE |
SS2 p |
q | q |
Q |
DC1 |
SS2 q |
r | r |
R |
DC2 |
SS2 r |
s | s |
S |
DC3 |
SS2 s |
t | t |
T |
DC4 |
SS2 t |
u | u |
U |
NAK |
SS2 u |
v | v |
V |
SYN |
SS2 v |
w | w |
W |
ETB |
SS2 w |
x | x |
X |
CAN |
SS2 x |
y | y |
Y |
EM |
SS2 y |
z | z |
Z |
SUB |
SS2 z |
International keyboard layouts
The devc-con and devc-con-hid managers support international keyboard layouts. By default, they use the original US-101 layout.
If the file /etc/kbd.tbl is present when you start devc-con or devc-con-hid, it's loaded and used instead. You can reload this file at runtime by pressing CtrlAltSpace. (If you're using VMWare, you may need to press this twice).
- kbd.tbl.de
- DE-102 (German) layout.
- kbd.tbl.us
- US-101 layout (the default).
- If the file contains 5 × 96 entries, the left and right Alt keys are both treated as regular Alt keys.
- If the file has 6 × 96 entries, the right Alt key is treated as an AltGr key, and the last 96 entries must define key codes for each key with AltGr pressed.
Entries must be no longer than 4 hex digits (16 bits) each.
Comments start with a number sign (#
) and extend to the end of the line.
Entries: | Define semantics for keys: |
---|---|
000–095 | Without any modifiers |
096–191 | With Shift pressed |
192–287 | With Ctrl pressed |
288–383 | With Alt pressed |
384–479 | With CtrlAlt pressed |
480–575 | With AltGr (right Alt) pressed |
0 1 2 3 4 5 6 7 8 9 A B C D E F
, Esc, '1', '2', '3', '4', '5', '6' '7', '8', '9', '0', '-', '=', Rub, Tab ; 00
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i' 'o', 'p', '[', ']', Ent, Ctl, 'a', 's' ; 10
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';' ''', '', Shf, '\', 'z', 'x', 'c', 'v' ; 20
'b', 'n', 'm', ',', '.', '/', Rsh, '*' Alt, SP, Cap, F1, F2, F3, F4, F5 ; 30
F6, F7, F8, F9, F10, Num, Scr, Hom Up, PgU, K-, Lft, K5, Rig, K+, End ; 40
Dwn, PgD, Ins, Del, , , , F11 F12, , , , , , , ; 50
For every scan code, two bytes of data are given by the entries. The high byte defines a number of flags for the key (see below), while the low byte usually carries the actual data to be given to the user when the key is pressed. For Shift, Lock, and special keys, the low byte carries additional, function-dependent information (see below).
- 00 — Data key
- 01 — Function key
- 02 — Shift key:
- 0201 — Shift
- 0202 — Ctrl
- 0204 — Alt
- 0208 — Rshift
- 04 — NumLock-dependent
- 08 — Lock key:
- 0801 — ScrollLock
- 0802 — NumLock
- 0804 — CapsLock
- 10 — Dead key
- 20 — CapsLock-dependent
- 40 — Special:
- 4001 — reboot ( Ctrl Alt Del )
- 4002 — debug ( Ctrl Alt Esc )
- 4003 — next console ( Ctrl Alt + or Ctrl Alt Enter )
- 4004 — previous console ( Ctrl Alt - )
- 4005 — console 1 ( Ctrl Alt 1 )
- 4006 — console 2 (
Ctrl
Alt
2
)
...
- 400C — console 8 ( Ctrl Alt 8 )
- 400D — console 9 ( Ctrl Alt 9 )
- 400E — console 10 ( Ctrl Alt 0 )
- 400F — increase font size ( Ctrl Alt > )
- 4010 — decrease font size ( Ctrl Alt < )
- 4011 — help ( Ctrl Alt ? )
- 4012 — break ( Ctrl Break )
- 4013 — hang up ( Ctrl Alt End )
- 4020 — print screen ( Ctrl Alt PrtScn )
- 4021 — hot1 ( Ctrl Alt F1 )
- 4022 — hot2 (
Ctrl
Alt
F2
)
...
- 402B — reload ( Ctrl Alt Space )
- 80 — invalid key
Examples:
devc-con -n4
Files:
- /dev/con1, /dev/con2, …
- Console port devices.
- /etc/kbd.tbl
- The keyboard layout; see
International keyboard layouts,
above.
Errors:
If an error occurs, the keyboard doesn't work in text mode.