, ,

Character-Device Drivers QNX | QNX Tutorials 2025

Character-Device Drivers QNX : When you type something on your keyboard, the character-device driver is the first part of the system that reads and understands your input.

The specific driver used depends on your hardware. To find out which one applies to your setup, check the documentation for devc-* drivers in the Utilities Reference.

Note: Some keys might work differently depending on how your system is set up. For more details, see the Character I/O section in the System Architecture Guide.

Input Modes

Character-device drivers can work in two different input modes:

  • Raw mode: Input is sent directly without any processing.
  • Canonical (or edited) mode: Input is processed and edited (e.g., backspace works, input is sent after pressing Enter).

Terminal Support

Some programs like vi need to know the capabilities of your terminal (like moving the cursor or clearing the screen). This is handled using:

  • The TERM environment variable, which tells the system what kind of terminal you’re using.
  • The /usr/share/terminfo directory, which contains data about different terminal types.

Telnet Usage

If you’re using Telnet to connect two QNX systems (like QNX 4 or QNX Neutrino), use the -8 option to allow full 8-bit data transmission.
If you’re connecting from a non-QNX system and the terminal behaves oddly, exit Telnet and restart it with the -8 option.

Keyboard Overview

The character-device drivers instantly process what you type. The system interprets different keys and combinations (keychords) in specific ways, which are listed in a table (not shown here).

Physical and Virtual Consoles

The combination of your display adapter, monitor, and keyboard is known as the physical console, which is managed by a console driver.
In addition, QNX supports virtual consoles, which allow multiple login sessions on the same screen.

Here’s a beginner-friendly and easy-to-understand version of your paragraph:

Input Modes

Character-device drivers can work in two different modes:

  • Raw input mode: Every character you type is sent straight to the program immediately, as soon as it’s typed.
  • Canonical (or edited) input mode: The program receives your input only after you’ve typed a full line and pressed Enter.

In simple terms:

  • Raw mode = character-by-character input.
  • Edited mode = line-by-line input.

Here’s a beginner-friendly version of your Terminal Support section:

Terminal Support

Some programs like vi need to know what your terminal is capable of—such as moving the cursor, clearing the screen, and more—so they can work properly.

This is where the TERM environment variable comes in. It tells the system what type of terminal you’re using.

The terminal capabilities are stored in the /usr/share/terminfo directory. Inside it, you’ll find folders named a to z, each holding data for different types of terminals.

Some older applications may use /etc/termcap, which is an older, single-file version of the terminal database.

By default, the terminal type in QNX is set to qansi-m, which is QNX’s version of an ANSI terminal.

To learn how to change or set the terminal type, refer to “Terminal types” in the Configuring Your Environment guide.

Here’s a beginner-friendly version of your Telnet section:

Telnet

If you’re using Telnet to connect between two QNX systems (like QNX 4 and QNX Neutrino), you should use the -8 option. This enables 8-bit data communication, which helps ensure all characters are transmitted correctly.

If you’re connecting to a QNX Neutrino system from another type of operating system and things look weird on your screen (like wrong characters or display issues), try this:

  1. Exit Telnet.
  2. Restart it using the -8 option.

Also, if you’re using Windows to connect to a QNX Neutrino system using Telnet, set your terminal type to ansi or vt100 to make sure the display works correctly.

Here’s a more human-readable version of the Keyboard at a Glance section:

The Keyboard at a Glance

Character-device drivers immediately handle the keys you press, including combinations of keys (called keychords). These drivers interpret the input right when you type it.

However, if your keyboard isn’t behaving as expected, it might be due to one of the following reasons:

  • The system is using raw input mode instead of edited input mode.
  • The application you’re working with has its own rules for keyboard behavior.
  • The terminal you’re using might have some keyboard limitations.

Common Keyboard Actions

Here’s a quick reference for some common keyboard actions:

ActionKey(s) to Press
Move the cursor to the left← (Left Arrow)
Move the cursor to the right→ (Right Arrow)
Move the cursor to the start of the lineHome
Move the cursor to the end of the lineEnd
Delete the character left of the cursorBackspace
Delete the character at the cursorDel
Delete all characters on a lineCtrl + U
Toggle between insert and typeover modesIns
Submit a line of input or start a new lineEnter
Recall a previous command↑ or ↓ (Arrow Keys)
Suspend the displaying of outputCtrl + S
Resume the displaying of outputCtrl + Q
Attempt to kill a processCtrl + C or Ctrl + Break
Indicate end of input (EOF)Ctrl + D
Clear the terminalCtrl + L

When you press the up or down arrow keys, the driver sends a “back” or “forward” command to the shell, which then recalls the actual command you typed earlier.

Here’s a more human-readable version of your Physical and Virtual Consoles section:

Physical and Virtual Consoles

The physical console includes your display adapter (the hardware that connects the screen), the screen itself, and the system keyboard. All of these components are controlled by a console driver.

Not all systems include a console driver, especially in embedded systems, which may only have a serial driver (like devc-ser*). The devc-con and devc-con-hid drivers are currently only supported on x86 platforms.

Virtual Consoles

QNX Neutrino allows you to run multiple sessions at once through virtual consoles. These virtual consoles are numbered like /dev/con1, /dev/con2, etc. They allow you to switch between different applications without closing them.

When the system starts the devc-con or devc-con-hid drivers, it can specify how many virtual consoles to enable using the -n option. You can have up to nine virtual consoles at once.

Managing Virtual Consoles

You can configure your system to launch different programs on various consoles at startup. This can be done using the tinit program, which reads the /etc/config/ttys file to decide which programs to start on each console. By default, tinit starts a login prompt on the consoles.

If you add more consoles, make sure to update the /etc/config/ttys file so that tinit knows which programs to launch on them.

Each virtual console can run its own application in the foreground, using the entire screen. The keyboard is connected to the virtual console that’s currently in focus.

Switching Between Virtual Consoles

You can easily switch between virtual consoles by pressing specific key combinations (called keychords):

  • To switch to the next active console:
    Ctrl + Alt + Enter or Ctrl + Alt + +
    (Use the + key on the numeric keypad)
  • To switch to the previous active console:
    Ctrl + Alt + −
    (Use the - key on the numeric keypad)

You can also jump directly to a specific console by pressing Ctrl + Alt + n, where n is the number of the virtual console you want to switch to. For example, to go to /dev/con2, press Ctrl + Alt + 2.

Ending a Session

When you finish working on a console, you can end the session by typing logout or exit, or by pressing Ctrl + D. After this, the console will be idle and won’t appear in the cycle when using the console-switching key combinations. The only exception is console 1, which usually restarts the login prompt.

For more information about how the consoles work, check the devc-con and devc-con-hid drivers in the Utilities Reference, and the “Console devices” section in the System Architecture Guide.

Leave a Reply

Your email address will not be published. Required fields are marked *