doc:appunti:linux:sa:remap_keyboard_keys
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:remap_keyboard_keys [2021/12/07 10:54] – [Customize events using udev] niccolo | doc:appunti:linux:sa:remap_keyboard_keys [2021/12/07 11:50] (current) – [xmodmap] niccolo | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| </ | </ | ||
| - | It is possibile to customize the ACPI events to reassign the brightness keys to plain function keys, but it is not the preferred way (see [[# | + | It is possibile to customize the ACPI events to reassign the brightness keys to plain function keys, but it is not the preferred way (see [[# |
| It seems that the LCD (DISPLAYTOGGLE) multimedia function is intercepted by the hardware and it is not handled as an input event nor as an ACPI event by the operating system. | It seems that the LCD (DISPLAYTOGGLE) multimedia function is intercepted by the hardware and it is not handled as an input event nor as an ACPI event by the operating system. | ||
| Line 181: | Line 181: | ||
| ===== Configuration example for the Teclast F6 notebook ===== | ===== Configuration example for the Teclast F6 notebook ===== | ||
| - | The following is the file **/ | + | The following is the file **/ |
| < | < | ||
| - | # / | + | # / |
| - | # | + | # |
| # Keyboard remapping for the Teclast F6 notebook. | # Keyboard remapping for the Teclast F6 notebook. | ||
| - | # 2021-05-13 Niccolo Rigacci < | + | # 2021-12-07 Niccolo Rigacci < |
| # | # | ||
| # The following udev hwdb configuration swaps the Fn behaviour | # The following udev hwdb configuration swaps the Fn behaviour | ||
| - | # on keys F2, F3, F4, F8, F9, F10, F11 and F12. | + | # on keys F2, F3, F4, F6, F7, F8, F9, F10, F11 and F12. |
| # It also binds the Fn+ESC to Ctrl+LeftWinLogo+Esc, | # It also binds the Fn+ESC to Ctrl+LeftWinLogo+Esc, | ||
| # be used as keyboard shortcut into XFCE or other desktop | # be used as keyboard shortcut into XFCE or other desktop | ||
| # environments to execute a script and toggle the touchpad. | # environments to execute a script and toggle the touchpad. | ||
| # | # | ||
| - | # Function | + | # Function |
| - | # udev Hardware Database (as far as I know). | + | # Database (as far as I know). |
| # | # | ||
| - | # To make this file effective execute: | + | # To make this file effective execute |
| + | # input number using lsinput): | ||
| # | # | ||
| # | # | ||
| + | # | ||
| # | # | ||
| - | # To view current | + | # To view current |
| # | # | ||
| # | # | ||
| Line 217: | Line 219: | ||
| # | # | ||
| # | # | ||
| - | # Function keys F1, F6 and F7 do not generate events | + | # Fn+F6 and Fn+F7 produce keys 64 and 65 (0x40 and 0x41). |
| - | # (verified with evtest | + | |
| - | # be remapped. | + | |
| - | # | + | |
| - | # The following EV_KEY do not work: | + | |
| - | # | + | |
| - | # | + | |
| - | # | + | |
| # | # | ||
| + | # Function keys F1 does not generate events (verified with | ||
| + | # evtest and showkey), so it cannot be remapped. | ||
| + | |||
| + | # Teclast AT Keyboard input device. | ||
| evdev: | evdev: | ||
| | | ||
| Line 238: | Line 237: | ||
| | | ||
| | | ||
| + | | ||
| + | | ||
| | | ||
| | | ||
| Line 244: | Line 245: | ||
| | | ||
| | | ||
| + | |||
| + | # F6 and F7 are connected to input "Intel HID events", | ||
| + | evdev: | ||
| + | | ||
| + | | ||
| </ | </ | ||
| Line 287: | Line 293: | ||
| </ | </ | ||
| - | These keysyms do not produce the expected action; i.e. they don't do anything, despite I associate them to a key and depite | + | These keysyms do not produce the expected action; i.e. they don't do anything, despite I associate them to a key and despite |
| * XF86TouchpadToggle, | * XF86TouchpadToggle, | ||
| Line 293: | Line 299: | ||
| ===== ACPI and evemu ===== | ===== ACPI and evemu ===== | ||
| + | |||
| + | **WARNING**: | ||
| With this recipe we simulate a **keyboard event** (e.g. a function key press/ | With this recipe we simulate a **keyboard event** (e.g. a function key press/ | ||
| Line 330: | Line 338: | ||
| WARNING: The **sleep** command was determined empirically, | WARNING: The **sleep** command was determined empirically, | ||
| - | Once the acpid service is restarted, every time you press the **BrightnessDown** and **BrightnessUp** keys, you get the brightness adjusted and also the key **F6** or **F7** simulated events. | + | Once the acpid service is restarted, every time you press the **BrightnessDown** and **BrightnessUp** keys, you get the key **F6** or **F7** simulated events |
| - | Now you have to disable the default brightness control behaviour. | + | To disable |
| - | If the brightness keys are sent as **keyboard | + | On different hardware, if the multimedia key generates a plain **keyboard |
| - | + | ||
| - | < | + | |
| - | xmodmap -display :0.0 -pke | grep -i monbright | + | |
| - | keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown | + | |
| - | keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp | + | |
| - | </ | + | |
| - | + | ||
| - | So we can disable keycodes 232 and 233: | + | |
| - | + | ||
| - | < | + | |
| - | xmodmap -e 'keycode 232 =' | + | |
| - | xmodmap | + | |
| - | </ | + | |
| - | + | ||
| - | Unfortunately this is not the case with the Teclast F6; the BrightnessDown and BrightnessUp events are not reported as keyboard keycodes. They are instead input events generated by the **Intel HID events** device. Use **lsinput** and **input-events** | + | |
| - | + | ||
| - | < | + | |
| - | lsinput | + | |
| - | ... | + | |
| - | / | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | bits ev : (null) (null) (null) | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | input-events -t 10 7 | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | 18: | + | |
| - | </ | + | |
| - | + | ||
| - | It is possible | + | |
| - | + | ||
| - | < | + | |
| - | xinput | + | |
| - | ... | + | |
| - | ↳ Intel HID events | + | |
| - | </ | + | |
| - | + | ||
| - | and disable it: | + | |
| - | + | ||
| - | < | + | |
| - | xinput disable 12 | + | |
| - | </ | + | |
| ===== Web References ===== | ===== Web References ===== | ||
doc/appunti/linux/sa/remap_keyboard_keys.1638870847.txt.gz · Last modified: by niccolo
