Keyboard special keys not being detected

I am using the Microsoft natural ergonomic keyboard 4000
1750867352843.png
The special keys, the silver ones, are not detected when using xev.
My /boot/loader.conf:
Code:
kern.geom.label.disk_indent.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
hw.usb.usbhid.enable="1"
usbhid_load="YES"
hkbd_load="YES"
hidraw_load="YES"
The modules are not visible when using kldstat
Code:
Id Refs Address                Size Name
 1   58 0xffffffff80200000  1f41458 kernel
 2    1 0xffffffff82142000     79b0 hidraw.ko
 3    1 0xffffffff8214a000     7808 cryptodev.ko
 4    1 0xffffffff82152000   5e9340 zfs.ko
 5    1 0xffffffff83310000   1507d8 nvidia-modeset.ko
 6    1 0xffffffff83600000  52ef728 nvidia.ko
 7    2 0xffffffff83461000    30b08 linux.ko
 8    3 0xffffffff83492000     c2a8 linux_common.ko
 9    1 0xffffffff8349f000     21e8 hcons.ko
10    3 0xffffffff834a2000     30a8 hidmap.ko
11    1 0xffffffff834a6000     21e8 hms.ko
12    1 0xffffffff834a9000     21e8 hsctrl.ko
13    1 0xffffffff834ac000     4250 ichsmb.ko
14    1 0xffffffff834b1000     2178 smbus.ko
15    1 0xffffffff834b4000     2110 pchtherm.ko
Using dmesg to check the active kernel modules and grepping for the drivers:
dmesg | grep usbhid:
Code:
usbhid0 on uhub0
usbhid0: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus0: <HID bus> on usbhid0
usbhid1 on uhub0
usbhid1: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus1: <HID bus> on usbhid1
usbhid2 on uhub0
usbhid2: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus2: <HID bus> on usbhid2
usbhid3 on uhub0
usbhid3: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus3: <HID bus> on usbhid3
usbhid0 on uhub0
usbhid0: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus0: <HID bus> on usbhid0
usbhid1 on uhub0
usbhid1: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus1: <HID bus> on usbhid1
usbhid2 on uhub0
usbhid2: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus2: <HID bus> on usbhid2
usbhid3 on uhub0
usbhid3: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus3: <HID bus> on usbhid3
usbhid0 on uhub0
usbhid0: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus0: <HID bus> on usbhid0
usbhid1 on uhub0
usbhid1: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus1: <HID bus> on usbhid1
usbhid2 on uhub0
usbhid2: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus2: <HID bus> on usbhid2
usbhid3 on uhub0
usbhid3: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus3: <HID bus> on usbhid3
usbhid0 on uhub0
usbhid0: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus0: <HID bus> on usbhid0
usbhid1 on uhub0
usbhid1: <Microsoft Natural Ergonomic Keyboard 4000, class 0/0, rev 2.00/1.73, addr 1> on usbus0
hidbus1: <HID bus> on usbhid1
usbhid2 on uhub0
usbhid2: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus2: <HID bus> on usbhid2
usbhid3 on uhub0
usbhid3: <Logitech G502 HERO Gaming Mouse, class 0/0, rev 2.00/27.03, addr 2> on usbus0
hidbus3: <HID bus> on usbhid3
dmesg | grep hkbd:
Code:
hkbd0: <Microsoft Natural Ergonomic Keyboard 4000> on hidbus0
kbd2 at hkbd0
hkbd1: <Logitech G502 HERO Gaming Mouse Keyboard> on hidbus3
kbd3 at hkbd1
hkbd0: <Microsoft Natural Ergonomic Keyboard 4000> on hidbus0
kbd2 at hkbd0
hkbd1: <Logitech G502 HERO Gaming Mouse Keyboard> on hidbus3
kbd3 at hkbd1
hkbd0: <Microsoft Natural Ergonomic Keyboard 4000> on hidbus0
kbd2 at hkbd0
hkbd1: <Logitech G502 HERO Gaming Mouse Keyboard> on hidbus3
kbd3 at hkbd1
hkbd0: <Microsoft Natural Ergonomic Keyboard 4000> on hidbus0
kbd2 at hkbd0
hkbd1: <Logitech G502 HERO Gaming Mouse Keyboard> on hidbus3
kbd3 at hkbd1
dmesg | grep hidraw:
Code:
hidraw0: <Microsoft Natural Ergonomic Keyboard 4000 Raw HID Device> on hidbus0
hidraw1: <Microsoft Natural Ergonomic Keyboard 4000 Raw HID Device> on hidbus1
hidraw2: <Logitech G502 HERO Gaming Mouse Raw HID Device> on hidbus2
hidraw3: <Logitech G502 HERO Gaming Mouse Raw HID Device> on hidbus3

The drivers detect the keyboard, and yet the silver keys do not function.
 
That may depend on WM/DE you are using, do have shortcuts to control multimedia attached to these keys? What sound server are you using?
 
Doesn´t work, unfortunately.
-layout gb and variant -intl results in a completely wrong layout, with the tilda being in place of the pipe, different, and for some reason delayed in response (it takes about 2 seconds after the key is pressed for the symbol to output), double quotes.

evtest detects the existence of the silver keys, but when they are pressed there is no output.
Code:
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x45e product 0xdb version 0x173
Input device name: "Microsoft Natural Ergonomic Keyboard 4000"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 0 (KEY_RESERVED)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
    Event code 5 (KEY_4)
    Event code 6 (KEY_5)
    Event code 7 (KEY_6)
    Event code 8 (KEY_7)
    Event code 9 (KEY_8)
    Event code 10 (KEY_9)
    Event code 11 (KEY_0)
    Event code 12 (KEY_MINUS)
    Event code 13 (KEY_EQUAL)
    Event code 14 (KEY_BACKSPACE)
    Event code 15 (KEY_TAB)
    Event code 16 (KEY_Q)
    Event code 17 (KEY_W)
    Event code 18 (KEY_E)
    Event code 19 (KEY_R)
    Event code 20 (KEY_T)
    Event code 21 (KEY_Y)
    Event code 22 (KEY_U)
    Event code 23 (KEY_I)
    Event code 24 (KEY_O)
    Event code 25 (KEY_P)
    Event code 26 (KEY_LEFTBRACE)
    Event code 27 (KEY_RIGHTBRACE)
    Event code 28 (KEY_ENTER)
    Event code 29 (KEY_LEFTCTRL)
    Event code 30 (KEY_A)
    Event code 31 (KEY_S)
    Event code 32 (KEY_D)
    Event code 33 (KEY_F)
    Event code 34 (KEY_G)
    Event code 35 (KEY_H)
    Event code 36 (KEY_J)
    Event code 37 (KEY_K)
    Event code 38 (KEY_L)
    Event code 39 (KEY_SEMICOLON)
    Event code 40 (KEY_APOSTROPHE)
    Event code 41 (KEY_GRAVE)
    Event code 42 (KEY_LEFTSHIFT)
    Event code 43 (KEY_BACKSLASH)
    Event code 44 (KEY_Z)
    Event code 45 (KEY_X)
    Event code 46 (KEY_C)
    Event code 47 (KEY_V)
    Event code 48 (KEY_B)
    Event code 49 (KEY_N)
    Event code 50 (KEY_M)
    Event code 51 (KEY_COMMA)
    Event code 52 (KEY_DOT)
    Event code 53 (KEY_SLASH)
    Event code 54 (KEY_RIGHTSHIFT)
    Event code 55 (KEY_KPASTERISK)
    Event code 56 (KEY_LEFTALT)
    Event code 57 (KEY_SPACE)
    Event code 58 (KEY_CAPSLOCK)
    Event code 59 (KEY_F1)
    Event code 60 (KEY_F2)
    Event code 61 (KEY_F3)
    Event code 62 (KEY_F4)
    Event code 63 (KEY_F5)
    Event code 64 (KEY_F6)
    Event code 65 (KEY_F7)
    Event code 66 (KEY_F8)
    Event code 67 (KEY_F9)
    Event code 68 (KEY_F10)
    Event code 69 (KEY_NUMLOCK)
    Event code 70 (KEY_SCROLLLOCK)
    Event code 71 (KEY_KP7)
    Event code 72 (KEY_KP8)
    Event code 73 (KEY_KP9)
    Event code 74 (KEY_KPMINUS)
    Event code 75 (KEY_KP4)
    Event code 76 (KEY_KP5)
    Event code 77 (KEY_KP6)
    Event code 78 (KEY_KPPLUS)
    Event code 79 (KEY_KP1)
    Event code 80 (KEY_KP2)
    Event code 81 (KEY_KP3)
    Event code 82 (KEY_KP0)
    Event code 83 (KEY_KPDOT)
    Event code 85 (KEY_ZENKAKUHANKAKU)
    Event code 86 (KEY_102ND)
    Event code 87 (KEY_F11)
    Event code 88 (KEY_F12)
    Event code 89 (KEY_RO)
    Event code 90 (KEY_KATAKANA)
    Event code 91 (KEY_HIRAGANA)
    Event code 92 (KEY_HENKAN)
    Event code 93 (KEY_KATAKANAHIRAGANA)
    Event code 94 (KEY_MUHENKAN)
    Event code 95 (KEY_KPJPCOMMA)
    Event code 96 (KEY_KPENTER)
    Event code 97 (KEY_RIGHTCTRL)
    Event code 98 (KEY_KPSLASH)
    Event code 99 (KEY_SYSRQ)
    Event code 100 (KEY_RIGHTALT)
    Event code 102 (KEY_HOME)
    Event code 103 (KEY_UP)
    Event code 104 (KEY_PAGEUP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 107 (KEY_END)
    Event code 108 (KEY_DOWN)
    Event code 109 (KEY_PAGEDOWN)
    Event code 110 (KEY_INSERT)
    Event code 111 (KEY_DELETE)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 116 (KEY_POWER)
    Event code 117 (KEY_KPEQUAL)
    Event code 119 (KEY_PAUSE)
    Event code 121 (KEY_KPCOMMA)
    Event code 122 (KEY_HANGUEL)
    Event code 123 (KEY_HANJA)
    Event code 124 (KEY_YEN)
    Event code 125 (KEY_LEFTMETA)
    Event code 126 (KEY_RIGHTMETA)
    Event code 127 (KEY_COMPOSE)
    Event code 128 (KEY_STOP)
    Event code 129 (KEY_AGAIN)
    Event code 130 (KEY_PROPS)
    Event code 131 (KEY_UNDO)
    Event code 132 (KEY_FRONT)
    Event code 133 (KEY_COPY)
    Event code 134 (KEY_OPEN)
    Event code 135 (KEY_PASTE)
    Event code 136 (KEY_FIND)
    Event code 137 (KEY_CUT)
    Event code 138 (KEY_HELP)
    Event code 140 (KEY_CALC)
    Event code 142 (KEY_SLEEP)
    Event code 150 (KEY_WWW)
    Event code 152 (KEY_SCREENLOCK)
    Event code 158 (KEY_BACK)
    Event code 159 (KEY_FORWARD)
    Event code 161 (KEY_EJECTCD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 173 (KEY_REFRESH)
    Event code 176 (KEY_EDIT)
    Event code 177 (KEY_SCROLLUP)
    Event code 178 (KEY_SCROLLDOWN)
    Event code 183 (KEY_F13)
    Event code 184 (KEY_F14)
    Event code 185 (KEY_F15)
    Event code 186 (KEY_F16)
    Event code 187 (KEY_F17)
    Event code 188 (KEY_F18)
    Event code 189 (KEY_F19)
    Event code 190 (KEY_F20)
    Event code 191 (KEY_F21)
    Event code 192 (KEY_F22)
    Event code 193 (KEY_F23)
    Event code 194 (KEY_F24)
  Event type 17 (EV_LED)
    Event code 0 (LED_NUML) state 0
    Event code 1 (LED_CAPSL) state 0
    Event code 2 (LED_SCROLLL) state 0
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value      0
    Repeat code 1 (REP_PERIOD)
      Value      0

I tried setxkbmap -model microsoft4000 on its own, doesn't make a difference.
Output of setxkbmap -print -verbose 10:
Code:
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   microsoft(natural)
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)"    };
    xkb_types     { include "complete"    };
    xkb_compat    { include "complete"    };
    xkb_symbols   { include "pc+us+inet(evdev)"    };
    xkb_geometry  { include "microsoft(natural)"    };
};
So it definitely sets it correctly.
 
I have almost exactly the same problem as the original poster, and I though I would share some more details to get some help to work out the (same?) problem, or to see if this is a different one.
As the OP, I'm experiencing an issue with my Microsoft Natural Ergonomic Keyboard 4000 on FreeBSD 14.3 running KDE Plasma. Specifically, the multimedia keys are not generating any events. The standard keyboard functionality works as expected.

I'm a recent Linux convert and haven't touched BSD since 1999, so I apologize if I've overlooked anything obvious or being ignorant in general. In particular, I'd like to apologize in advance for the horrendous work formatting the post properly.

Overview​

The dedicated multimedia keys (e.g., volume, play/pause) on my Microsoft Natural Ergonomic Keyboard 4000 are completely unresponsive and do not produce any input events.

Investigation Steps and Observations​

  1. xev:
    • No events are reported when any multimedia key is pressed.
    • Standard keys (e.g., 'a', 'b', 'c') are reported correctly.
  2. USB Device Recognition (usbconfig and dmesg):
    • usbconfig identifies the keyboard as:
      ugen2.8: Natural Ergonomic Keyboard 4000 V1.0 Microsoft Corp. at usbus2, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)

    • dmesg shows two separate HID devices being attached:
      hkbd1: Microsoft Natural Ergonomic Keyboard 4000 on hidbus5
      hcons2: Microsoft Natural Ergonomic Keyboard 4000 Consumer Control on hidbus6
      This may suggest (?) that the system recognizes both the standard keyboard and a separate "Consumer Control" interface for the multimedia keys.
  3. Kernel Modules:
    • I believe the necessary kernel modules (hid, hcons, usbhid, and evdev) are loaded (but then again I'm a FreeBSD newbie with little concepts of what's compiled in
      and what's dynamically loaded and how to tell the difference).
  4. Xorg Input Devices (xinput list):
    • Two keyboard devices are reported by Xorg:
      Code:
      ↳ Microsoft Natural Ergonomic Keyboard 4000 Consumer Control       id=8    [slave  keyboard (3)]
      ↳ Microsoft Natural Ergonomic Keyboard 4000        id=20   [slave  keyboard (3)]
    • I confirmed with xinput list-props that id=8 (Consumer Control) is associated with /dev/input/event10, and id=20 (standard keyboard) is with /dev/input/event5.
  5. Event Testing (evtest):
    • sudo evtest /dev/input/event5 (standard keyboard):
      This correctly reports events for standard key presses. As expected, it does not show events for multimedia keys.

    • sudo evtest /dev/input/event10 (Consumer Control):
      Crucially, this command yields no output or events whatsoever, regardless of which keys (standard or multimedia) are pressed. I believe this is unexpected, as this device should be responsible for the multimedia key events. Right?
  6. /dev/hidraw:
    • Unlike the original poster, there are no /dev/hidraw devices present on my system. I am unsure if these are expected or necessary for this type of functionality on FreeBSD.

Device Descriptors​

For further diagnostics / clues / leads, here are the raw device descriptors:
  • usbconfig dump_device_desc ugen2.8 output:
    Code:
    bLength = 0x0012
    bDescriptorType = 0x0001
    bcdUSB = 0x0200
    bDeviceClass = 0x0000
    Probed by interface class
    bDeviceSubClass = 0x0000
    bDeviceProtocol = 0x0000
    bMaxPacketSize0 = 0x0008
    idVendor = 0x045e
    idProduct = 0x00db
    bcdDevice = 0x0173
    iManufacturer = 0x0001
    Microsoft
    iProduct = 0x0002
    Natural Ergonomic Keyboard 4000
    iSerialNumber = 0x0000
    bNumConfigurations = 0x0001
  • usbhid-dump -d 045e:00db -f output (HID Report Descriptors):

    Code:
    002:008:001:DESCRIPTOR         
    1751266253.293479
    05 0C 09 01 A1 01 85 01 05 0C 19 00 2A FF 03 95
    01 75 10 15 00 27 FF 03 00 00 81 00 05 07 19 00
    29 FF 75 08 26 FF 00 81 00 81 01 06 00 FF 0A 03
    FE 0A 04 FE 95 02 75 01 25 01 81 02 0A 05 FF 95
    01 75 05 25 1F 81 02 75 09 81 01 0A 02 FF 26 FF
    00 75 08 81 02 C0
    
    002:008:000:DESCRIPTOR
    1751266253.301317
    05 01 09 06 A1 01 05 08 19 01 29 03 15 00 25 01
    75 01 95 03 91 02 09 4B 95 01 91 02 95 04 91 01
    05 07 19 E0 29 E7 95 08 81 02 75 08 95 01 81 01
    19 00 29 91 26 FF 00 95 06 81 00 C0

System Configuration and Details​

  • Operating System: FreeBSD 14.3 (64-bit)
  • Kernel Version: 14.3-RELEASE
  • Desktop Environment: KDE Plasma 6.3.5
  • KDE Frameworks Version: 6.14.0
  • Qt Version: 6.8.3
  • Graphics Platform: X11
  • Memory: 63.9 GiB
  • Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2
  • Manufacturer: Gigabyte Technology Co., Ltd.
  • Product Name: X570 AORUS PRO
  • System Version: -CF
  • /boot/loader.conf content:

    Code:
    vfs.mountroot.timeout="10"
    kernels_autodetect="NO"
    vfs.root.mountfrom="ufs:/dev/da6p2"
    hw.usb.usbhid.enable="1"
    hw.usb.kbd.allow=0
  • /etc/rc.conf content:

    Code:
    hostname="beastie"
    keymap="se.kbd"
    ifconfig_igb0="DHCP"
    sshd_enable="YES"
    ntpd_enable="YES"
    powerd_enable="YES"
    moused_nondefault_enable="NO"
    dumpdev="AUTO"
    sddm_enable="YES"
    kld_list="nvidia-modeset evdev hid hcons"
    linux_enable="YES"
    dbus_enable="YES"
    powerd_enable="YES"
    acpid_enable="YES"
    cupsd_enable="YES"
    devfs_system_ruleset="system"
    devfs_enable="YES"
It seems that while the "Consumer Control" device is detected and associated with /dev/input/event10, it's not actually reporting any events when tested with evtest. Any guidance on how to troubleshoot this further or potential solutions would be greatly appreciated.

Thank you for your time.
 
thorman, thank you for the exemplary problem report!

Please try the following:
  1. Enable debug output from the keyboard driver with the command sysctl hw.hid.hkbd.debug=100
  2. Press normal keys like letters and numbers. Observe what appears on the console and in dmesg.
  3. Press multimedia keys. Again, observe what appears on the console and in dmesg.
  4. Disable debug output with sysctl hw.hid.hkbd.debug=0
Separately, try:
  1. Enable debug output from the hcons driver with the command sysctl dev.hcons.X.debug=100. Here X should be the number of the hcons device.
  2. Press multimedia keys on the keyboard. Observe what appears on the console and in dmesg.
  3. Disable debug output.

vfs.root.mountfrom="ufs:/dev/da6p2"
This line from your /boot/loader.conf contains a device name that is not guaranteed not to change. A simple act like inserting a USB flash drive into one of the USB ports may cause the root device to appear with a different number and the next boot attempt to fail. Best practice is to use some form of device/partition/filesystem labels. The labels remain the same no matter how many extra devices appear and in what order the devices are enumerated by the BIOS or the kernel. You can check whether your partitions are already labeled with gpart show -l and assign them labels with gpart modify -l. In /boot/loader.conf and /etc/fstab you will use device names like /dev/gpt/mylabel.
 
Back
Top