User Tools

Site Tools


characterresources

This is an old revision of the document!


Character Resources

When you press a key on the Twiddler, or any physical USB keyboard for that matter, it doesn't send the letter “A” or a Unicode character directly to the computer. Instead, it initiates a two-part translation process.

The fundamental difference lies in where the data is handled and what that data represents: USB HID Scan Codes are hardware-level, layout-agnostic position indicators sent by the keyboard, while Host-Side Character Encoding is software-level interpretation that turns those positions into meaningful text.

1. USB HID Keyboard Scan Codes (The Twiddler4 Level)

A USB HID (Human Interface Device) Scan Code is a raw, numerical value that the Twiddler sends to the host computer to report the physical press or release of a key.

  • Location: Generated on the Twiddler's internal microcontroller and transmitted over the USB bus.
  • Nature: It is entirely layout-agnostic and represents physical location rather than a specific character.
  • How it works: Under the USB HID standard, every key on a standard keyboard matrix is assigned a fixed hex value. For example, the physical key located to the right of the Caps Lock key always sends the scan code 0x04.
  • The catch: The keyboard hardware has absolutely no idea whether you are typing in English, French, or Japanese. It simply reports: “The key at position 0x04 has been pressed.”

2. Host-Side Character Encoding (The Operating System Level)

Host-Side Character Encoding is the final step in the software chain where numerical values are translated into specific visual characters (like “A”, “\n”, or “€”) based on digital standards like ASCII, UTF-8, or UTF-16.

  • Location: Handled entirely by the Host Operating System (Windows, macOS, Linux) and the active application.
  • Nature: It is context-dependent and relies heavily on the operating system's active Keyboard Layout (e.g., QWERTY, AZERTY, Dvorak) and the application's encoding configuration.
  • How it works: The OS receives the raw scan code, checks the active language layout, maps it to a virtual key, and then converts it into a character code (such as Unicode U+0061 for a lowercase “a”).
characterresources.1780342928.txt.gz · Last modified: by tony