Settings services: Difference between revisions
Timschneeb (talk | contribs) Add format info about the binary buffer returned by GetKeyCodeMap |
|||
| Line 61: | Line 61: | ||
== GetKeyCodeMap == | == GetKeyCodeMap == | ||
Takes a type-0x16 output buffer containing KeyCodeMap, official sw uses fixed size 0x1000. This is | Takes a type-0x16 output buffer containing KeyCodeMap, official sw uses fixed size 0x1000. This is related to the USB HID keyboard. | ||
The returned buffer consists of a 0x20-byte header followed by an array of key mapping structures. All fields within this response are stored in Big-Endian byte order. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || Magic number? (0x01000001) | |||
|- | |||
| 0x4 || 0x4 || Keyboard/layout group (e.g. 4 = Latin) | |||
|- | |||
| 0x8 || 0x4 || Map count | |||
|- | |||
| 0xC || 0x4 || Layout ID (e.g. 3 = German QWERTZ) | |||
|- | |||
| 0x10 || 0x10 || Reserved | |||
|- | |||
| 0x20 || 0x8 * MapCount || Array of <code>KeyMapEntry</code> structures. Indexed by the standard USB HID Usage ID (Keyboard/Keypad page 0x07). | |||
|- | |||
| ... || ... || Padding (remaining space up to 0x1000) | |||
|} | |||
=== KeyMapEntry === | |||
8-byte structure defining the output characters and modifier behaviors for a single physical key. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x2 || Normal char: UTF-16 code point when no modifiers are pressed. Dead keys map directly to Unicode combining characters (like U+0301 for combining acute accent). | |||
|- | |||
| 0x2 || 0x2 || Flags: Bitmask for character behavior and modifier rules. | |||
|- | |||
| 0x4 || 0x2 || AltGr char: UTF-16 code point emitted when AltGr is held. | |||
|- | |||
| 0x6 || 0x2 || Shift char: UTF-16 code point emitted when Shift is held. | |||
|} | |||
==== Flags Bitmask ==== | |||
The <code>Flags</code> field changes how state changes are handled (like Caps Lock or NumLock) for that specific code point: | |||
* '''0x1001''': Standard character. Uses standard Shift and Caps Lock rules. | |||
* '''0x1000''': Static/dead character (e.g., Space). | |||
* '''0x20FF''': Keypad modifier. State influenced by NumLock. | |||
== GetFirmwareVersionForDebug == | == GetFirmwareVersionForDebug == | ||