I have a Microsoft All-in-One wireless media keyboard (n9z-00001) which behaves weirdly with my current distribution, Arch Linux. (Linux 3.19.3-3-ARCH #1 SMP PREEMPT Wed Apr 8 14:10:00 CEST 2015 x86_64 GNU/Linux
)
$ lsusb | grep -i micro
Bus 001 Device 008: ID 045e:0800 Microsoft Corp.
And this is what xinput yields. Note that there are two keyboards for this device, one with the peculiar (keys)
$ xinput list | grep -i micro
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 id=12 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 id=11 [slave pointer (2)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 (keys) id=10 [slave keyboard (3)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 id=9 [slave keyboard (3)]
I can listen to the keys directly with evtest
. Although it is the same keyboard
$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Lid Switch
/dev/input/event1: Power Button
/dev/input/event2: Video Bus
/dev/input/event3: Video Bus
/dev/input/event4: AT Translated Set 2 keyboard
/dev/input/event5: Microsoft Microsoft® Nano Transceiver v2.0
/dev/input/event6: Microsoft Microsoft® Nano Transceiver v2.0
/dev/input/event7: Microsoft Microsoft® Nano Transceiver v2.0
/dev/input/event8: ThinkPad Extra Buttons
/dev/input/event9: HDA Digital PCBeep
/dev/input/event10: HDA Intel PCH Mic
/dev/input/event11: HDA Intel PCH Headphone
/dev/input/event12: HDA Intel HDMI HDMI/DP,pcm=3
/dev/input/event13: HDA Intel HDMI HDMI/DP,pcm=7
/dev/input/event14: HDA Intel HDMI HDMI/DP,pcm=8
/dev/input/event15: SynPS/2 Synaptics TouchPad
/dev/input/event16: Integrated Camera
/dev/input/event17: Logitech M705
/dev/input/event18: TPPS/2 IBM TrackPoint
/dev/input/event19: daskeyboard
/dev/input/event20: daskeyboard
Select the device event number [0-20]:
- The device id 9 from
xinput
corresponds to/dev/input/event5
, which has all the regular keys except some of the media keys. - id 10 corresponds to
/dev/input/event7
, and has the media keys onF1-F4
and 6 other keys related to volume control and other microsoft stuff. - I am guessing that
/dev/input/event6
corresponds to the touchpad on the keyboard.
The problem is with the function keys. Media keys that are placed where F1-F5
should be are assigned to the "(keys)
" device, whereas F6-F12
are assigned with the other one. I want to map the media keys back to the function keys so that I don't have to press Fn every time.
Problem 1: Media keys (keys that are channeled through input device 10, the (keys)
one) are not registered by xev
. They generate output with showkey --scancodes
and evtest
, but they are not picked up by X. How to solve that?
Problem 2:
Media keys that work through input device 9
send multiple scancodes, and AFAIK there is no way of remapping multiple keys with hwdb
, as shown in here. The following are the scancodes sent by the media key on F7
Event: time 1430059493.552417, -------------- EV_SYN ------------
Event: time 1430059493.560416, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1430059493.560416, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1430059493.560416, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1430059493.560416, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1430059493.560416, -------------- EV_SYN ------------
I have no idea how to bind multiple scan codes to a single event; right now X is detecting all the individual keys and maps them to the respective events. For example, according to the output above, media key on F7
sends Ctrl+Alt+Scanner
. How can I do this, since googling left me with no results?