Simple VGA console and keyboard I/O manager (QNX Neutrino)
You must be root to start this manager. |
devc-con [options] & devc-con-hid [options] &
Neutrino
x86
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 - 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 - 1000 milliseconds.
The devc-con manager provides an interface to the VGA console screen and keyboard. It's usually started as a system startup procedure (see diskboot).
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.
The devc-con-hid manager was added in QNX Momentics 6.3.0 Service Pack 3; diskboot starts it instead of devc-con. |
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.
If your application uses /dev/console,
you should create a link from it to one of
/dev/con1, /dev/con2, … by adding
a line like this to the buildfile used by mkifs:
[type=link] /dev/console = /dev/con1 |
The devc-con and devc-con-hid managers all emulate an 80×25 ANSI terminal.
You can use the keyboard to switch between virtual consoles.
Each virtual console can run different applications that use the entire screen. The keyboard is attached to the virtual console that's currently visible. You can switch from one virtual console to another — and thus from one application to another — by entering the following keychords:
If you want to see: | Press: |
---|---|
The next active console | Ctrl-Alt-Enter or Ctrl-Alt-+ (plus) |
The previous active console | Ctrl-Alt-- (minus) |
The + (plus) and - (minus) keys used in the console-switching keychords are those found on the numeric keypad. |
You can also jump to a specific console by using the Ctrl-Alt-n, where n is a numeric digit that represents the console number of a virtual console. For instance:
If you want to see: | Press: |
---|---|
/dev/con1 | Ctrl-Alt-1 |
/dev/con2 (if available) | Ctrl-Alt-2 |
… | … |
/dev/con10 (if available) | Ctrl-Alt-0 |
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.
The in-use range of characters is divided into four regions which span character numbers (in hexadecimal) 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.
The screen control codes to set GL and GR are as follows:
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.
The G0 through G3 characters sets may each be set to any of the available builtin fonts. The control code to do this is:
ESC g s
Where:
g: | Sets: |
---|---|
( | G0 |
) | G1 |
* | G2 |
+ | G3 |
And:
s: | Specifies: |
---|---|
B | ASCII |
0 | Special (DEC Graphic) |
< | ISO-Latin1 Supplemental |
U | PC Character Set |
The in-use character sets are as follows:
In-use char set: | Defaults to: |
---|---|
GR | G2 |
GL | G0 |
The character set codes are as follows:
Char set: | Defaults to: |
---|---|
G0 | ASCII charset |
G1 | Special charset (DEC Graphic) |
G2 | Supplemental charset (ISO-Latin 1) |
G3 | Special charset (DEC Graphic) |
Set the GL in-service character set (0x20-0x7f) to the PC character set through G1, write some characters, then switch GL back to G0:
{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)
Note the following abbreviations used in the tables:
|
The C0 control codes are as follows:
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 |
The ESC control sequence codes are as follows:
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 |
You can do any 8-bit C1 code with 7-bit 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). |
The C1 control character codes are as follows:
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 |
In 7-bit mode, CSI is 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 ) ; |
The CSI control sequence codes are as follows:
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]] 46 | 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 |
The graphic rendition codes are as follows:
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 |
The color codes are as follows:
color_number | Description |
---|---|
0 | Black |
1 | Red |
2 | Green |
3 | Brown |
4 | Blue |
5 | Violet |
6 | Cyan |
7 | White |
Modes are as follows:
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 |
The ANSI key mapping codes are as follows:
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 |
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 Ctrl-Alt-Space. (If you're using VMWare, you may need to press this twice).
This, like all other key combinations, is subject to configuration! However, it isn't possible to redefine compose sequences. |
We provide the following layout files, in ${QNX_TARGET}/etc/:
The keyboard-layout file's structure is very simple and rigid. It must contain either exactly 5 × 96 or exactly 6 × 96 hexadecimal entries, separated by whitespace, newlines, or commas:
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.
Each run of 96 entries defines the semantics of up to 96 different keys under certain conditions:
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 Ctrl-Alt pressed |
480–575 | With AltGr (right Alt) pressed |
The 96 entries in a run are indexed by keyboard scan codes. You'll need to know those scan codes in order to make up your own keyboard definition. Given below is the scancode/symbol-mapping for a US-101 keyboard:
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).
The entries' high bits are as follows:
...
...
Typical command line:
devc-con -n4
If an error occurs, the keyboard doesn't work in text mode.
Using the Command Line and Controlling How Neutrino Starts in the Neutrino User's Guide