-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNOTES
42 lines (32 loc) · 1.84 KB
/
NOTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
This program reads a character string and translates it into virtual
keystrokes that are entered into the system via /dev/uinput.
The key difficulty (pun intended) is to map characters to keystrokes.
These are the principal bits and pieces involved, along with
highly-simplified descriptions:
- Character Encoding: This defines the representation of a character
by a numeric value (or a sequence of numeric values) in the input
character string. On modern, western systems, a typical character
encoding is UTF-8.
- Console Keymap: Each key on the keyboard has an associated Keycode
(or Event Code, defined as KEY_... macros in
linux/input-event-codes.h). The Console Keymap maps a Keycode (or a
combination of Keycodes, if modifier or compose keys are pressed) to
an Action Code representing a character (or some other action,
defined as K_... macros in linux/keyboard.h). This mapping is
determined by the active keymap (as loaded by the loadkeys utility).
- The mapping from Action Code to characters is quite complicated and
can be traced in the dumpkeys utility. It appears that for
ISO-8859-1 characters (0..255), the lower byte of the Action Code
equals the ISO-8859-1 (= UTF-8) character code.
Thus, for ISO-8859-1 characters, this mapping is essentially the
identity mapping. This is all this program implements so far;
therefore, it is currently limited to ISO-8859-1 characters.
Generally, the Action Code of a character appears to be closely
related to their Unicode code point.
To enter a character via /dev/uinput, a corresponding sequence of
Keycodes is written to this device. This can be done via the
following steps:
1. Map the character to its corresponding Action Code.
2. Map the Action Code to a corresponding (sequence of) Keycode(s) via
an inverse keyboard mapping.
3. Write the Keycode(s) to /dev/uinput.