3

I bought a new keyboard similar to an old one. The old one works, the new one not. The new keyboard has an unusual HID Descriptor and sends one extra data byte. Is there a Linux driver which support such keyboard (descriptor)?


Communication log via cat /sys/kernel/debug/usb/usbmon/3u, byte sequences only (press A, release A; press Shift, press A, release A, release Shift sequence):

Non-working 9-byte keyboard communication:

00000400 00000000 71
00000000 00000000 71
02000000 00000000 71
02000400 00000000 71
02000000 00000000 71
00000000 00000000 71

Working old keyboard communication:

00000400 00000000
00000000 00000000
02000000 00000000
02000400 00000000
02000000 00000000
00000000 00000000

Bonus: What is the extra byte? (I always saw 0x71 there.)


HID Descriptors of the new keyboard via cat /sys/kernel/debug/hid/<interface>/rdesc:

Interface 0003:17EF:609B.0089:

05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 75 01 95 08 81 02 75 08 95 01 81 01 05 08 19 01 29 03 75 01 95 03 91 02 95 01 75 05 91 01 15 00 26 ff 00 19 00 2a ff 00 05 07 75 08 95 06 81 00 05 01 0a 68 01 15 80 25 7f 95 01 75 08 81 02 c0 

  INPUT[INPUT]
    Field(0)
      Application(GenericDesktop.Keyboard)
      Usage(8)
        Keyboard.00e0
        Keyboard.00e1
        Keyboard.00e2
        Keyboard.00e3
        Keyboard.00e4
        Keyboard.00e5
        Keyboard.00e6
        Keyboard.00e7
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(8)
      Report Offset(0)
      Flags( Variable Absolute )
    Field(1)
      Application(GenericDesktop.Keyboard)
      Usage(256)
        LED.0000
        LED.NumLock
        LED.CapsLock
        LED.ScrollLock
        LED.Compose
        LED.Kana
        LED.0006
        LED.0007
        LED.0008
        LED.0009
        ... LED sequence left out
        LED.0049
        LED.004a
        LED.GenericIndicator
        LED.004c
        LED.004d
        LED.004e
        LED.004f
        ... LED sequence left out
        LED.00fd
        LED.00fe
        LED.00ff
      Logical Minimum(0)
      Logical Maximum(255)
      Report Size(8)
      Report Count(6)
      Report Offset(16)
      Flags( Array Absolute )
    Field(2)
      Application(GenericDesktop.Keyboard)
      Usage(1)
        GenericDesktop.0168
      Logical Minimum(-128)
      Logical Maximum(127)
      Report Size(8)
      Report Count(1)
      Report Offset(64)
      Flags( Variable Absolute )
  OUTPUT[OUTPUT]
    Field(0)
      Application(GenericDesktop.Keyboard)
      Usage(3)
        LED.NumLock
        LED.CapsLock
        LED.ScrollLock
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(3)
      Report Offset(0)
      Flags( Variable Absolute )

Keyboard.00e0 ---> Key.LeftControl
Keyboard.00e1 ---> Key.LeftShift
Keyboard.00e2 ---> Key.LeftAlt
Keyboard.00e3 ---> Key.LeftMeta
Keyboard.00e4 ---> Key.RightCtrl
Keyboard.00e5 ---> Key.RightShift
Keyboard.00e6 ---> Key.RightAlt
Keyboard.00e7 ---> Key.RightMeta
LED.0000 ---> Sync.Report
LED.NumLock ---> LED.NumLock
LED.CapsLock ---> LED.CapsLock
LED.ScrollLock ---> LED.ScrollLock
LED.Compose ---> LED.Compose
LED.Kana ---> LED.Kana
LED.0006 ---> Sync.Report
LED.0007 ---> Sync.Report
LED.0008 ---> Sync.Report
LED.0009 ---> LED.Mute
LED.000a ---> Sync.Report
LED.000b ---> Sync.Report
... Sync.Report lines left out
LED.0017 ---> Sync.Report
LED.0018 ---> Sync.Report
LED.0019 ---> LED.?
LED.001a ---> Sync.Report
LED.001b ---> Sync.Report
... Sync.Report lines left out
LED.0025 ---> Sync.Report
LED.0026 ---> Sync.Report
LED.0027 ---> LED.Sleep
LED.0028 ---> Sync.Report
LED.0029 ---> Sync.Report
... Sync.Report lines left out
LED.0049 ---> Sync.Report
LED.004a ---> Sync.Report
LED.GenericIndicator ---> LED.Misc
LED.004c ---> LED.Suspend
LED.004d ---> LED.?
LED.004e ---> Sync.Report
LED.004f ---> Sync.Report
... Sync.Report lines left out
LED.00fe ---> Sync.Report
LED.00ff ---> Sync.Report
GenericDesktop.0168 ---> Absolute.Misc
LED.NumLock ---> LED.?
LED.CapsLock ---> LED.?
LED.ScrollLock ---> LED.?

Interface 0003:17EF:609B.008B:

05 0c 09 01 a1 01 85 01 19 00 2a 3c 02 15 00 26 3c 02 95 01 75 10 81 00 05 01 0a 68 01 15 80 25 7f 95 01 75 08 81 02 c0 05 01 09 80 a1 01 85 02 19 81 29 83 15 00 25 01 75 01 95 03 81 02 95 05 81 01 05 01 0a 68 01 15 80 25 7f 95 01 75 08 81 02 c0 06 01 ff 09 01 a1 01 85 05 95 07 75 08 15 00 26 ff 00 09 20 b1 03 c0 

  INPUT(1)[INPUT]
    Field(0)
      Application(Consumer.0001)
      Usage(573)
        Consumer.0000
        Consumer.0001
        Consumer.0002
        Consumer.0003
        Consumer.0004
        ... Consumer sequence left out
        Consumer.0235
        Consumer.0236
        Consumer.0237
        Consumer.HorizontalWheel
        Consumer.0239
        Consumer.023a
        Consumer.023b
        Consumer.023c
      Logical Minimum(0)
      Logical Maximum(572)
      Report Size(16)
      Report Count(1)
      Report Offset(0)
      Flags( Array Absolute )
    Field(1)
      Application(Consumer.0001)
      Usage(1)
        GenericDesktop.0168
      Logical Minimum(-128)
      Logical Maximum(127)
      Report Size(8)
      Report Count(1)
      Report Offset(16)
      Flags( Variable Absolute )
  INPUT(2)[INPUT]
    Field(0)
      Application(GenericDesktop.SystemControl)
      Usage(3)
        GenericDesktop.SystemPowerDown
        GenericDesktop.SystemSleep
        GenericDesktop.SystemWakeUp
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(3)
      Report Offset(0)
      Flags( Variable Absolute )
    Field(1)
      Application(GenericDesktop.SystemControl)
      Usage(1)
        GenericDesktop.0168
      Logical Minimum(-128)
      Logical Maximum(127)
      Report Size(8)
      Report Count(1)
      Report Offset(8)
      Flags( Variable Absolute )
  FEATURE(5)[FEATURE]
    Field(0)
      Application(ff01.0001)
      Usage(7)
        ff01.0020
        ff01.0020
        ff01.0020
        ff01.0020
        ff01.0020
        ff01.0020
        ff01.0020
      Logical Minimum(0)
      Logical Maximum(255)
      Report Size(8)
      Report Count(7)
      Report Offset(0)
      Flags( Constant Variable Absolute )

Consumer.0000 ---> Sync.Report
Consumer.0001 ---> Key.Unknown
Consumer.0002 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.002e ---> Key.Unknown
Consumer.002f ---> Key.Unknown
Consumer.0030 ---> Key.Power
Consumer.0031 ---> Key.Restart
Consumer.0032 ---> Key.Sleep
Consumer.0033 ---> Key.Unknown
Consumer.0034 ---> Key.Sleep
Consumer.0035 ---> Key.KbdIlluminationToggle
Consumer.0036 ---> Key.Btn0
Consumer.0037 ---> Key.Unknown
Consumer.0038 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.003e ---> Key.Unknown
Consumer.003f ---> Key.Unknown
Consumer.0040 ---> Key.Menu
Consumer.0041 ---> Key.Select
Consumer.0042 ---> Key.Up
Consumer.0043 ---> Key.Down
Consumer.0044 ---> Key.Left
Consumer.0045 ---> Key.Right
Consumer.0046 ---> Key.Esc
Consumer.0047 ---> Key.KPPlus
Consumer.0048 ---> Key.KPMinus
Consumer.0049 ---> Key.Unknown
Consumer.004a ---> Key.Unknown
... Key.Unknown lines left out
Consumer.005e ---> Key.Unknown
Consumer.005f ---> Key.Unknown
Consumer.0060 ---> Key.Info
Consumer.0061 ---> Key.Subtitle
Consumer.0062 ---> Key.Unknown
Consumer.0063 ---> Key.VCR
Consumer.0064 ---> Key.Unknown
Consumer.0065 ---> Key.Camera
Consumer.0066 ---> Key.Unknown
Consumer.0067 ---> Key.Unknown
Consumer.0068 ---> Key.Unknown
Consumer.0069 ---> Key.Red
Consumer.006a ---> Key.Green
Consumer.006b ---> Key.Blue
Consumer.006c ---> Key.Yellow
Consumer.006d ---> Key.Zoom
Consumer.006e ---> Key.Unknown
Consumer.006f ---> Key.BrightnessUp
Consumer.0070 ---> Key.BrightnessDown
Consumer.0071 ---> Key.Unknown
Consumer.0072 ---> Key.?
Consumer.0073 ---> Key.BrightnessMin
Consumer.0074 ---> Key.BrightnessMax
Consumer.0075 ---> Key.BrightnessAuto
Consumer.0076 ---> Key.Unknown
Consumer.0077 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.0080 ---> Key.Unknown
Consumer.0081 ---> Key.Unknown
Consumer.0082 ---> Key.?
Consumer.0083 ---> Key.Last
Consumer.0084 ---> Key.Enter
Consumer.0085 ---> Key.Unknown
Consumer.0086 ---> Key.Unknown
Consumer.0087 ---> Key.Unknown
Consumer.0088 ---> Key.PC
Consumer.0089 ---> Key.TV
Consumer.008a ---> Key.WWW
Consumer.008b ---> Key.DVD
Consumer.008c ---> Key.Phone
Consumer.008d ---> Key.Program
Consumer.008e ---> Key.?
Consumer.008f ---> Key.?
Consumer.0090 ---> Key.Memo
Consumer.0091 ---> Key.CD
Consumer.0092 ---> Key.VCR
Consumer.0093 ---> Key.Tuner
Consumer.0094 ---> Key.Exit
Consumer.0095 ---> Key.Help
Consumer.0096 ---> Key.Tape
Consumer.0097 ---> Key.TV2
Consumer.0098 ---> Key.Sat
Consumer.0099 ---> Key.Unknown
Consumer.009a ---> Key.PVR
Consumer.009b ---> Key.Unknown
Consumer.009c ---> Key.ChannelUp
Consumer.009d ---> Key.ChannelDown
Consumer.009e ---> Key.Unknown
Consumer.009f ---> Key.Unknown
Consumer.00a0 ---> Key.VCR2
Consumer.00a1 ---> Key.Unknown
Consumer.00a2 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.00ae ---> Key.Unknown
Consumer.00af ---> Key.Unknown
Consumer.00b0 ---> Key.Play
Consumer.00b1 ---> Key.Pause
Consumer.00b2 ---> Key.Record
Consumer.00b3 ---> Key.FastForward
Consumer.00b4 ---> Key.Rewind
Consumer.00b5 ---> Key.NextSong
Consumer.00b6 ---> Key.PreviousSong
Consumer.00b7 ---> Key.StopCD
Consumer.00b8 ---> Key.EjectCD
Consumer.00b9 ---> Key.Shuffle
Consumer.00ba ---> Key.Unknown
Consumer.00bb ---> Key.Unknown
Consumer.00bc ---> Key.?
Consumer.00bd ---> Key.Unknown
Consumer.00be ---> Key.Unknown
Consumer.00bf ---> Key.Slow
Consumer.00c0 ---> Key.Unknown
Consumer.00c1 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.00cb ---> Key.Unknown
Consumer.00cc ---> Key.Unknown
Consumer.00cd ---> Key.PlayPause
Consumer.00ce ---> Key.Unknown
Consumer.00cf ---> Key.VoiceCommand
Consumer.00d0 ---> Key.Unknown
Consumer.00d1 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.00de ---> Key.Unknown
Consumer.00df ---> Key.Unknown
Consumer.00e0 ---> Absolute.Volume
Consumer.00e1 ---> Key.Unknown
Consumer.00e2 ---> Key.Mute
Consumer.00e3 ---> Key.Unknown
Consumer.00e4 ---> Key.Unknown
Consumer.00e5 ---> Key.BassBoost
Consumer.00e6 ---> Key.Unknown
Consumer.00e7 ---> Key.Unknown
Consumer.00e8 ---> Key.Unknown
Consumer.00e9 ---> Key.VolumeUp
Consumer.00ea ---> Key.VolumeDown
Consumer.00eb ---> Key.Unknown
Consumer.00ec ---> Key.Unknown
... Key.Unknown lines left out
Consumer.00f3 ---> Key.Unknown
Consumer.00f4 ---> Key.Unknown
Consumer.00f5 ---> Key.Slow
Consumer.00f6 ---> Key.Unknown
Consumer.00f7 ---> Key.Unknown
... Key.Unknown lines left out
Consumer.017f ---> Key.Unknown
Consumer.0180 ---> Key.Unknown
Consumer.0181 ---> Key.ButtonConfig
Consumer.0182 ---> Key.Bookmarks
Consumer.0183 ---> Key.Config
Consumer.0184 ---> Key.?
Consumer.0185 ---> Key.?
Consumer.0186 ---> Key.?
Consumer.0187 ---> Key.?
Consumer.0188 ---> Key.?
Consumer.0189 ---> Key.?
Consumer.018a ---> Key.Mail
Consumer.018b ---> Key.?
Consumer.018c ---> Key.?
Consumer.018d ---> Key.?
Consumer.018e ---> Key.Calendar
Consumer.018f ---> Key.TaskManager
Consumer.0190 ---> Key.Journal
Consumer.0191 ---> Key.Finance
Consumer.0192 ---> Key.Calc
Consumer.0193 ---> Key.Player
Consumer.0194 ---> Key.File
Consumer.0195 ---> Key.Unknown
Consumer.0196 ---> Key.WWW
Consumer.0197 ---> Key.Unknown
Consumer.0198 ---> Key.Unknown
Consumer.0199 ---> Key.Chat
Consumer.019a ---> Key.Unknown
Consumer.019b ---> Key.Unknown
Consumer.019c ---> Key.Logoff
Consumer.019d ---> Key.Unknown
Consumer.019e ---> Key.Coffee
Consumer.019f ---> Key.ControlPanel
Consumer.01a0 ---> Key.Unknown
Consumer.01a1 ---> Key.Unknown
Consumer.01a2 ---> Key.AppSelect
Consumer.01a3 ---> Key.Next
Consumer.01a4 ---> Key.Previous
Consumer.01a5 ---> Key.Unknown
Consumer.01a6 ---> Key.Help
Consumer.01a7 ---> Key.Documents
Consumer.01a8 ---> Key.Unknown
Consumer.01a9 ---> Key.Unknown
Consumer.01aa ---> Key.Unknown
Consumer.01ab ---> Key.SpellCheck
Consumer.01ac ---> Key.Unknown
Consumer.01ad ---> Key.Unknown
Consumer.01ae ---> Key.Keyboard
Consumer.01af ---> Key.Unknown
Consumer.01b0 ---> Key.Unknown
Consumer.01b1 ---> Key.ScreenSaver
Consumer.01b2 ---> Key.Unknown
Consumer.01b3 ---> Key.Unknown
Consumer.01b4 ---> Key.File
Consumer.01b5 ---> Key.Unknown
Consumer.01b6 ---> Key.?
Consumer.01b7 ---> Key.Audio
Consumer.01b8 ---> Key.Video
Consumer.01b9 ---> Key.Unknown
Consumer.01ba ---> Key.Unknown
Consumer.01bb ---> Key.Unknown
Consumer.01bc ---> Key.?
Consumer.01bd ---> Key.Info
Consumer.01be ---> Key.Unknown
Consumer.01bf ---> Key.Unknown
... Key.Unknown lines left out
Consumer.01ff ---> Key.Unknown
Consumer.0200 ---> Key.Unknown
Consumer.0201 ---> Key.New
Consumer.0202 ---> Key.Open
Consumer.0203 ---> Key.Close
Consumer.0204 ---> Key.Exit
Consumer.0205 ---> Key.Unknown
Consumer.0206 ---> Key.Unknown
Consumer.0207 ---> Key.Save
Consumer.0208 ---> Key.Print
Consumer.0209 ---> Key.Props
Consumer.020a ---> Key.Unknown
Consumer.020b ---> Key.Unknown
... Key.Unknown lines left out
Consumer.0218 ---> Key.Unknown
Consumer.0219 ---> Key.Unknown
Consumer.021a ---> Key.Undo
Consumer.021b ---> Key.Copy
Consumer.021c ---> Key.Cut
Consumer.021d ---> Key.Paste
Consumer.021e ---> Key.Unknown
Consumer.021f ---> Key.Find
Consumer.0220 ---> Key.Unknown
Consumer.0221 ---> Key.Search
Consumer.0222 ---> Key.Goto
Consumer.0223 ---> Key.HomePage
Consumer.0224 ---> Key.Back
Consumer.0225 ---> Key.Forward
Consumer.0226 ---> Key.Stop
Consumer.0227 ---> Key.Refresh
Consumer.0228 ---> Key.Unknown
Consumer.0229 ---> Key.Unknown
Consumer.022a ---> Key.Bookmarks
Consumer.022b ---> Key.Unknown
Consumer.022c ---> Key.Unknown
Consumer.022d ---> Key.?
Consumer.022e ---> Key.?
Consumer.022f ---> Key.?
Consumer.0230 ---> Key.Unknown
Consumer.0231 ---> Key.Unknown
Consumer.0232 ---> Key.Unknown
Consumer.0233 ---> Key.ScrollUp
Consumer.0234 ---> Key.ScrollDown
Consumer.0235 ---> Key.Unknown
Consumer.0236 ---> Key.Unknown
Consumer.0237 ---> Key.Unknown
Consumer.HorizontalWheel ---> Relative.HWheel
Consumer.0239 ---> Key.Unknown
Consumer.023a ---> Key.Unknown
Consumer.023b ---> Key.Unknown
Consumer.023c ---> Key.Unknown
GenericDesktop.0168 ---> Absolute.Misc
GenericDesktop.SystemPowerDown ---> Key.Power
GenericDesktop.SystemSleep ---> Key.Sleep
GenericDesktop.SystemWakeUp ---> Key.WakeUp
GenericDesktop.0168 ---> Sync.Report

HID Descriptor of the old keyboard, interface 0003:17EF:6022.0087 (only one keyboard interface):

05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 75 01 95 08 81 02 95 01 75 08 81 01 15 00 26 a4 00 19 00 2a a4 00 05 07 75 08 95 06 81 00 c0 

  INPUT[INPUT]
    Field(0)
      Application(GenericDesktop.Keyboard)
      Usage(8)
        Keyboard.00e0
        Keyboard.00e1
        Keyboard.00e2
        Keyboard.00e3
        Keyboard.00e4
        Keyboard.00e5
        Keyboard.00e6
        Keyboard.00e7
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(8)
      Report Offset(0)
      Flags( Variable Absolute )
    Field(1)
      Application(GenericDesktop.Keyboard)
      Usage(165)
        Keyboard.0000
        Keyboard.0001
        Keyboard.0002
        Keyboard.0003
        Keyboard.0004
        ... Keyboard sequence left out
        Keyboard.009f
        Keyboard.00a0
        Keyboard.00a1
        Keyboard.00a2
        Keyboard.00a3
        Keyboard.00a4
      Logical Minimum(0)
      Logical Maximum(164)
      Report Size(8)
      Report Count(6)
      Report Offset(16)
      Flags( Array Absolute )

Keyboard.00e0 ---> Key.LeftControl
Keyboard.00e1 ---> Key.LeftShift
Keyboard.00e2 ---> Key.LeftAlt
Keyboard.00e3 ---> Key.LeftMeta
Keyboard.00e4 ---> Key.RightCtrl
Keyboard.00e5 ---> Key.RightShift
Keyboard.00e6 ---> Key.RightAlt
Keyboard.00e7 ---> Key.RightMeta
Keyboard.0000 ---> Sync.Report
Keyboard.0001 ---> Sync.Report
Keyboard.0002 ---> Sync.Report
Keyboard.0003 ---> Sync.Report
Keyboard.0004 ---> Key.A
Keyboard.0005 ---> Key.B
Keyboard.0006 ---> Key.C
Keyboard.0007 ---> Key.D
Keyboard.0008 ---> Key.E
Keyboard.0009 ---> Key.F
Keyboard.000a ---> Key.G
Keyboard.000b ---> Key.H
Keyboard.000c ---> Key.I
Keyboard.000d ---> Key.J
Keyboard.000e ---> Key.K
Keyboard.000f ---> Key.L
Keyboard.0010 ---> Key.M
Keyboard.0011 ---> Key.N
Keyboard.0012 ---> Key.O
Keyboard.0013 ---> Key.P
Keyboard.0014 ---> Key.Q
Keyboard.0015 ---> Key.R
Keyboard.0016 ---> Key.S
Keyboard.0017 ---> Key.T
Keyboard.0018 ---> Key.U
Keyboard.0019 ---> Key.V
Keyboard.001a ---> Key.W
Keyboard.001b ---> Key.X
Keyboard.001c ---> Key.Y
Keyboard.001d ---> Key.Z
Keyboard.001e ---> Key.1
Keyboard.001f ---> Key.2
Keyboard.0020 ---> Key.3
Keyboard.0021 ---> Key.4
Keyboard.0022 ---> Key.5
Keyboard.0023 ---> Key.6
Keyboard.0024 ---> Key.7
Keyboard.0025 ---> Key.8
Keyboard.0026 ---> Key.9
Keyboard.0027 ---> Key.0
Keyboard.0028 ---> Key.Enter
Keyboard.0029 ---> Key.Esc
Keyboard.002a ---> Key.Backspace
Keyboard.002b ---> Key.Tab
Keyboard.002c ---> Key.Space
Keyboard.002d ---> Key.Minus
Keyboard.002e ---> Key.Equal
Keyboard.002f ---> Key.LeftBrace
Keyboard.0030 ---> Key.RightBrace
Keyboard.0031 ---> Key.BackSlash
Keyboard.0032 ---> Key.BackSlash
Keyboard.0033 ---> Key.Semicolon
Keyboard.0034 ---> Key.Apostrophe
Keyboard.0035 ---> Key.Grave
Keyboard.0036 ---> Key.Comma
Keyboard.0037 ---> Key.Dot
Keyboard.0038 ---> Key.Slash
Keyboard.0039 ---> Key.CapsLock
Keyboard.003a ---> Key.F1
Keyboard.003b ---> Key.F2
Keyboard.003c ---> Key.F3
Keyboard.003d ---> Key.F4
Keyboard.003e ---> Key.F5
Keyboard.003f ---> Key.F6
Keyboard.0040 ---> Key.F7
Keyboard.0041 ---> Key.F8
Keyboard.0042 ---> Key.F9
Keyboard.0043 ---> Key.F10
Keyboard.0044 ---> Key.F11
Keyboard.0045 ---> Key.F12
Keyboard.0046 ---> Key.SysRq
Keyboard.0047 ---> Key.ScrollLock
Keyboard.0048 ---> Key.Pause
Keyboard.0049 ---> Key.Insert
Keyboard.004a ---> Key.Home
Keyboard.004b ---> Key.PageUp
Keyboard.004c ---> Key.Delete
Keyboard.004d ---> Key.End
Keyboard.004e ---> Key.PageDown
Keyboard.004f ---> Key.Right
Keyboard.0050 ---> Key.Left
Keyboard.0051 ---> Key.Down
Keyboard.0052 ---> Key.Up
Keyboard.0053 ---> Key.NumLock
Keyboard.0054 ---> Key.KPSlash
Keyboard.0055 ---> Key.KPAsterisk
Keyboard.0056 ---> Key.KPMinus
Keyboard.0057 ---> Key.KPPlus
Keyboard.0058 ---> Key.KPEnter
Keyboard.0059 ---> Key.KP1
Keyboard.005a ---> Key.KP2
Keyboard.005b ---> Key.KP3
Keyboard.005c ---> Key.KP4
Keyboard.005d ---> Key.KP5
Keyboard.005e ---> Key.KP6
Keyboard.005f ---> Key.KP7
Keyboard.0060 ---> Key.KP8
Keyboard.0061 ---> Key.KP9
Keyboard.0062 ---> Key.KP0
Keyboard.0063 ---> Key.KPDot
Keyboard.0064 ---> Key.102nd
Keyboard.0065 ---> Key.Compose
Keyboard.0066 ---> Key.Power
Keyboard.0067 ---> Key.KPEqual
Keyboard.0068 ---> Key.F13
Keyboard.0069 ---> Key.F14
Keyboard.006a ---> Key.F15
Keyboard.006b ---> Key.F16
Keyboard.006c ---> Key.F17
Keyboard.006d ---> Key.F18
Keyboard.006e ---> Key.F19
Keyboard.006f ---> Key.F20
Keyboard.0070 ---> Key.F21
Keyboard.0071 ---> Key.F22
Keyboard.0072 ---> Key.F23
Keyboard.0073 ---> Key.F24
Keyboard.0074 ---> Key.Open
Keyboard.0075 ---> Key.Help
Keyboard.0076 ---> Key.Props
Keyboard.0077 ---> Key.Front
Keyboard.0078 ---> Key.Stop
Keyboard.0079 ---> Key.Again
Keyboard.007a ---> Key.Undo
Keyboard.007b ---> Key.Cut
Keyboard.007c ---> Key.Copy
Keyboard.007d ---> Key.Paste
Keyboard.007e ---> Key.Find
Keyboard.007f ---> Key.Mute
Keyboard.0080 ---> Key.VolumeUp
Keyboard.0081 ---> Key.VolumeDown
Keyboard.0082 ---> Key.Unknown
Keyboard.0083 ---> Key.Unknown
Keyboard.0084 ---> Key.Unknown
Keyboard.0085 ---> Key.KPComma
Keyboard.0086 ---> Key.Unknown
Keyboard.0087 ---> Key.RO
Keyboard.0088 ---> Key.Katakana/Hiragana
Keyboard.0089 ---> Key.Yen
Keyboard.008a ---> Key.Henkan
Keyboard.008b ---> Key.Muhenkan
Keyboard.008c ---> Key.KPJpComma
Keyboard.008d ---> Key.Unknown
Keyboard.008e ---> Key.Unknown
Keyboard.008f ---> Key.Unknown
Keyboard.0090 ---> Key.Hangeul
Keyboard.0091 ---> Key.Hanja
Keyboard.0092 ---> Key.Katakana
Keyboard.0093 ---> Key.HIRAGANA
Keyboard.0094 ---> Key.Zenkaku/Hankaku
Keyboard.0095 ---> Key.Unknown
Keyboard.0096 ---> Key.Unknown
    ... Key.Unknown lines left out
Keyboard.009a ---> Key.Unknown
Keyboard.009b ---> Key.Unknown
Keyboard.009c ---> Key.Delete
Keyboard.009d ---> Key.Unknown
Keyboard.009e ---> Key.Unknown
    ... Key.Unknown lines left out
Keyboard.00a3 ---> Key.Unknown
Keyboard.00a4 ---> Key.Unknown

(Issue experienced on Lenovo Professional Wireless Keyboard, an ASUS keyboard... both wireless keyboards manufactured by Primax.)

(Issue not experienced on Windows and GRUB.)

(Yves Trudeau has already played with it and implemented a driver which ignores the extra byte, but I would rather use something from vanilla kernel and something less hacky.)

2

A proper fix was merged into the Linux kernel: https://lkml.org/lkml/2019/3/27/350

It'll be available whenever version 5.2 comes out, and probably back-ported on some distributions.

| improve this answer | |
3

Here is a translation of the raw HID descriptor of 0003:17EF:609B.0089 (the new keyboard) using hidrd:

05 01      Usage Page (Desktop),               ; Generic desktop controls (01h)
09 06      Usage (Keyboard),                   ; Keyboard (06h, application collection)
a1 01      Collection (Application),
05 07          Usage Page (Keyboard),          ; Keyboard/keypad (07h)
19 e0          Usage Minimum (KB Leftcontrol), ; Keyboard left control (E0h, dynamic value)
29 e7          Usage Maximum (KB Right GUI),   ; Keyboard right GUI (E7h, dynamic value)
15 00          Logical Minimum (0),
25 01          Logical Maximum (1),
75 01          Report Size (1),
95 08          Report Count (8),
81 02          Input (Variable),

75 08          Report Size (8),
95 01          Report Count (1),
81 01          Input (Constant),

05 08          Usage Page (LED),               ; LEDs (08h)
19 01          Usage Minimum (01h),
29 03          Usage Maximum (03h),
75 01          Report Size (1),
95 03          Report Count (3),
91 02          Output (Variable),
95 01          Report Count (1),
75 05          Report Size (5),
91 01          Output (Constant),

15 00          Logical Minimum (0),
26 ff 00       Logical Maximum (255),
19 00          Usage Minimum (00h),
2a ff 00       Usage Maximum (FFh),
05 07          Usage Page (Keyboard),          ; Keyboard/keypad (07h)
75 08          Report Size (8),
95 06          Report Count (6),
81 00          Input,

05 01          Usage Page (Desktop),           ; Generic desktop controls (01h)
0a 68 01       Usage (0168h),
15 80          Logical Minimum (-128),
25 7f          Logical Maximum (127),
95 01          Report Count (1),
75 08          Report Size (8),
81 02          Input (Variable),
c0         End Collection

It contains both Input fields (reports from the keyboard) and Output fields (control messages sent to the keyboard), and they are jumbled together, which is nothing unusual. The input fields are also pretty standard: The first byte has bits for modifier keys (left and right shift/ctrl/alt/meta), followed by a constant zero byte, followed by 6 bytes for up to 6 simultanously pressed keys. As you can see from the report examples, this is also exactly what the keyboard sends.

The last extra byte has a range of -128 to 127 (so 71 is -15), and is described as "Generic Desktop" with a usage index of 0x168. This index is not assigned in the publicly available HID Usage Table (HUT) version 1.12, so I don't know what it means. It must be some kind of analog range (keyboard tilt? pressure? some other sensor?). It's also not particularly important what it is, it would be just get ignored by the HID translation layer.

The output message is also standard: One byte, of which 3 bits control the keyboard LEDs (num lock, caps lock, scroll lock), and 5 bits are unused.

However, the switch to Usage Page (Keyboard) in the next input field from Usage Page (LED) in the output field occurs in the middle of the block, and apparently that confuses the kernel HID descriptor parser, so that it interprets this input field also as "LEDs", which makes no sense at all, and prevents it from translating the keys as it should.

That's a bug: Either in the kernel HID descriptor parser, or in the HID descriptor. In the first case, it should be fixed, in the last case, the descriptor should get a quirk in the kernel so it can be fixed. In any way, report it as a bug to the kernel maintainers.

As soon as it is fixed, the kernel should recognize keyboard events normally. There's no need for an extra driver (though it doesn't hurt to use one as a workaround until the bug is fixed).

The kernel HID parser is in drivers/hid/hid-core.c, in case you want to have a got at fixing it yourself.

| improve this answer | |
2

Just to add to @jan-molnar's efforts to resolve the HID parsing, My key board has very similar rdesc as it too is driven by a Primax USB chip (PiD 4e63):

root@Ub-RL85:~# cat /sys/kernel/debug/hid/*2/rdesc
05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 75 01 95 08 81 02 75 08 95 01 81 01 05 08 19 01 29 03 75 01 95 03 91 02 95 01 75 05 91 01 15 00 26 ff 00 19 00 2a ff 00 05 07 75 08 95 06 81 00 c0 

  INPUT[INPUT]
    Field(0)
      Application(GenericDesktop.Keyboard)
      Usage(8)
        Keyboard.00e0
        Keyboard.00e1
        Keyboard.00e2
        Keyboard.00e3
        Keyboard.00e4
        Keyboard.00e5
        Keyboard.00e6
        Keyboard.00e7
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(8)
      Report Offset(0)
      Flags( Variable Absolute )
    Field(1)
      Application(GenericDesktop.Keyboard)
      Usage(256)
        LED.0000
        LED.NumLock
        LED.CapsLock
        LED.ScrollLock
        LED.Compose
        LED.Kana
        LED.0006
        LED.0007
        LED.0008
        LED.0009
        LED.000a
        LED.000b
        LED.000c
        LED.000d
        LED.000e
        LED.000f
        LED.0010
        LED.0011
        LED.0012
        LED.0013
        LED.0014
        LED.0015
        LED.0016
        LED.0017
        LED.0018
        LED.0019
        LED.001a
        LED.001b
        LED.001c
        LED.001d
        LED.001e
        LED.001f
        LED.0020
        LED.0021
        LED.0022
        LED.0023
        LED.0024
        LED.0025
        LED.0026
        LED.0027
        LED.0028
        LED.0029
        LED.002a
        LED.002b
        LED.002c
        LED.002d
        LED.002e
        LED.002f
        LED.0030
        LED.0031
        LED.0032
        LED.0033
        LED.0034
        LED.0035
        LED.0036
        LED.0037
        LED.0038
        LED.0039
        LED.003a
        LED.003b
        LED.003c
        LED.003d
        LED.003e
        LED.003f
        LED.0040
        LED.0041
        LED.0042
        LED.0043
        LED.0044
        LED.0045
        LED.0046
        LED.0047
        LED.0048
        LED.0049
        LED.004a
        LED.GenericIndicator
        LED.004c
        LED.004d
        LED.004e
        LED.004f
        LED.0050
        LED.0051
        LED.0052
        LED.0053
        LED.0054
        LED.0055
        LED.0056
        LED.0057
        LED.0058
        LED.0059
        LED.005a
        LED.005b
        LED.005c
        LED.005d
        LED.005e
        LED.005f
        LED.0060
        LED.0061
        LED.0062
        LED.0063
        LED.0064
        LED.0065
        LED.0066
        LED.0067
        LED.0068
        LED.0069
        LED.006a
        LED.006b
        LED.006c
        LED.006d
        LED.006e
        LED.006f
        LED.0070
        LED.0071
        LED.0072
        LED.0073
        LED.0074
        LED.0075
        LED.0076
        LED.0077
        LED.0078
        LED.0079
        LED.007a
        LED.007b
        LED.007c
        LED.007d
        LED.007e
        LED.007f
        LED.0080
        LED.0081
        LED.0082
        LED.0083
        LED.0084
        LED.0085
        LED.0086
        LED.0087
        LED.0088
        LED.0089
        LED.008a
        LED.008b
        LED.008c
        LED.008d
        LED.008e
        LED.008f
        LED.0090
        LED.0091
        LED.0092
        LED.0093
        LED.0094
        LED.0095
        LED.0096
        LED.0097
        LED.0098
        LED.0099
        LED.009a
        LED.009b
        LED.009c
        LED.009d
        LED.009e
        LED.009f
        LED.00a0
        LED.00a1
        LED.00a2
        LED.00a3
        LED.00a4
        LED.00a5
        LED.00a6
        LED.00a7
        LED.00a8
        LED.00a9
        LED.00aa
        LED.00ab
        LED.00ac
        LED.00ad
        LED.00ae
        LED.00af
        LED.00b0
        LED.00b1
        LED.00b2
        LED.00b3
        LED.00b4
        LED.00b5
        LED.00b6
        LED.00b7
        LED.00b8
        LED.00b9
        LED.00ba
        LED.00bb
        LED.00bc
        LED.00bd
        LED.00be
        LED.00bf
        LED.00c0
        LED.00c1
        LED.00c2
        LED.00c3
        LED.00c4
        LED.00c5
        LED.00c6
        LED.00c7
        LED.00c8
        LED.00c9
        LED.00ca
        LED.00cb
        LED.00cc
        LED.00cd
        LED.00ce
        LED.00cf
        LED.00d0
        LED.00d1
        LED.00d2
        LED.00d3
        LED.00d4
        LED.00d5
        LED.00d6
        LED.00d7
        LED.00d8
        LED.00d9
        LED.00da
        LED.00db
        LED.00dc
        LED.00dd
        LED.00de
        LED.00df
        LED.00e0
        LED.00e1
        LED.00e2
        LED.00e3
        LED.00e4
        LED.00e5
        LED.00e6
        LED.00e7
        LED.00e8
        LED.00e9
        LED.00ea
        LED.00eb
        LED.00ec
        LED.00ed
        LED.00ee
        LED.00ef
        LED.00f0
        LED.00f1
        LED.00f2
        LED.00f3
        LED.00f4
        LED.00f5
        LED.00f6
        LED.00f7
        LED.00f8
        LED.00f9
        LED.00fa
        LED.00fb
        LED.00fc
        LED.00fd
        LED.00fe
        LED.00ff
      Logical Minimum(0)
      Logical Maximum(255)
      Report Size(8)
      Report Count(6)
      Report Offset(16)
      Flags( Array Absolute )
  OUTPUT[OUTPUT]
    Field(0)
      Application(GenericDesktop.Keyboard)
      Usage(3)
        LED.NumLock
        LED.CapsLock
        LED.ScrollLock
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(3)
      Report Offset(0)
      Flags( Variable Absolute )

Keyboard.00e0 ---> Key.LeftControl
Keyboard.00e1 ---> Key.LeftShift
Keyboard.00e2 ---> Key.LeftAlt
Keyboard.00e3 ---> Key.LeftMeta
Keyboard.00e4 ---> Key.RightCtrl
Keyboard.00e5 ---> Key.RightShift
Keyboard.00e6 ---> Key.RightAlt
Keyboard.00e7 ---> Key.RightMeta
LED.0000 ---> Sync.Report
LED.NumLock ---> LED.NumLock
LED.CapsLock ---> LED.CapsLock
LED.ScrollLock ---> LED.ScrollLock
LED.Compose ---> LED.Compose
LED.Kana ---> LED.Kana
LED.0006 ---> Sync.Report
LED.0007 ---> Sync.Report
LED.0008 ---> Sync.Report
LED.0009 ---> LED.Mute
LED.000a ---> Sync.Report
LED.000b ---> Sync.Report
LED.000c ---> Sync.Report
LED.000d ---> Sync.Report
LED.000e ---> Sync.Report
LED.000f ---> Sync.Report
LED.0010 ---> Sync.Report
LED.0011 ---> Sync.Report
LED.0012 ---> Sync.Report
LED.0013 ---> Sync.Report
LED.0014 ---> Sync.Report
LED.0015 ---> Sync.Report
LED.0016 ---> Sync.Report
LED.0017 ---> Sync.Report
LED.0018 ---> Sync.Report
LED.0019 ---> LED.?
LED.001a ---> Sync.Report
LED.001b ---> Sync.Report
LED.001c ---> Sync.Report
LED.001d ---> Sync.Report
LED.001e ---> Sync.Report
LED.001f ---> Sync.Report
LED.0020 ---> Sync.Report
LED.0021 ---> Sync.Report
LED.0022 ---> Sync.Report
LED.0023 ---> Sync.Report
LED.0024 ---> Sync.Report
LED.0025 ---> Sync.Report
LED.0026 ---> Sync.Report
LED.0027 ---> LED.Sleep
LED.0028 ---> Sync.Report
LED.0029 ---> Sync.Report
LED.002a ---> Sync.Report
LED.002b ---> Sync.Report
LED.002c ---> Sync.Report
LED.002d ---> Sync.Report
LED.002e ---> Sync.Report
LED.002f ---> Sync.Report
LED.0030 ---> Sync.Report
LED.0031 ---> Sync.Report
LED.0032 ---> Sync.Report
LED.0033 ---> Sync.Report
LED.0034 ---> Sync.Report
LED.0035 ---> Sync.Report
LED.0036 ---> Sync.Report
LED.0037 ---> Sync.Report
LED.0038 ---> Sync.Report
LED.0039 ---> Sync.Report
LED.003a ---> Sync.Report
LED.003b ---> Sync.Report
LED.003c ---> Sync.Report
LED.003d ---> Sync.Report
LED.003e ---> Sync.Report
LED.003f ---> Sync.Report
LED.0040 ---> Sync.Report
LED.0041 ---> Sync.Report
LED.0042 ---> Sync.Report
LED.0043 ---> Sync.Report
LED.0044 ---> Sync.Report
LED.0045 ---> Sync.Report
LED.0046 ---> Sync.Report
LED.0047 ---> Sync.Report
LED.0048 ---> Sync.Report
LED.0049 ---> Sync.Report
LED.004a ---> Sync.Report
LED.GenericIndicator ---> LED.Misc
LED.004c ---> LED.Suspend
LED.004d ---> LED.?
LED.004e ---> Sync.Report
LED.004f ---> Sync.Report
LED.0050 ---> Sync.Report
LED.0051 ---> Sync.Report
LED.0052 ---> Sync.Report
LED.0053 ---> Sync.Report
LED.0054 ---> Sync.Report
LED.0055 ---> Sync.Report
LED.0056 ---> Sync.Report
LED.0057 ---> Sync.Report
LED.0058 ---> Sync.Report
LED.0059 ---> Sync.Report
LED.005a ---> Sync.Report
LED.005b ---> Sync.Report
LED.005c ---> Sync.Report
LED.005d ---> Sync.Report
LED.005e ---> Sync.Report
LED.005f ---> Sync.Report
LED.0060 ---> Sync.Report
LED.0061 ---> Sync.Report
LED.0062 ---> Sync.Report
LED.0063 ---> Sync.Report
LED.0064 ---> Sync.Report
LED.0065 ---> Sync.Report
LED.0066 ---> Sync.Report
LED.0067 ---> Sync.Report
LED.0068 ---> Sync.Report
LED.0069 ---> Sync.Report
LED.006a ---> Sync.Report
LED.006b ---> Sync.Report
LED.006c ---> Sync.Report
LED.006d ---> Sync.Report
LED.006e ---> Sync.Report
LED.006f ---> Sync.Report
LED.0070 ---> Sync.Report
LED.0071 ---> Sync.Report
LED.0072 ---> Sync.Report
LED.0073 ---> Sync.Report
LED.0074 ---> Sync.Report
LED.0075 ---> Sync.Report
LED.0076 ---> Sync.Report
LED.0077 ---> Sync.Report
LED.0078 ---> Sync.Report
LED.0079 ---> Sync.Report
LED.007a ---> Sync.Report
LED.007b ---> Sync.Report
LED.007c ---> Sync.Report
LED.007d ---> Sync.Report
LED.007e ---> Sync.Report
LED.007f ---> Sync.Report
LED.0080 ---> Sync.Report
LED.0081 ---> Sync.Report
LED.0082 ---> Sync.Report
LED.0083 ---> Sync.Report
LED.0084 ---> Sync.Report
LED.0085 ---> Sync.Report
LED.0086 ---> Sync.Report
LED.0087 ---> Sync.Report
LED.0088 ---> Sync.Report
LED.0089 ---> Sync.Report
LED.008a ---> Sync.Report
LED.008b ---> Sync.Report
LED.008c ---> Sync.Report
LED.008d ---> Sync.Report
LED.008e ---> Sync.Report
LED.008f ---> Sync.Report
LED.0090 ---> Sync.Report
LED.0091 ---> Sync.Report
LED.0092 ---> Sync.Report
LED.0093 ---> Sync.Report
LED.0094 ---> Sync.Report
LED.0095 ---> Sync.Report
LED.0096 ---> Sync.Report
LED.0097 ---> Sync.Report
LED.0098 ---> Sync.Report
LED.0099 ---> Sync.Report
LED.009a ---> Sync.Report
LED.009b ---> Sync.Report
LED.009c ---> Sync.Report
LED.009d ---> Sync.Report
LED.009e ---> Sync.Report
LED.009f ---> Sync.Report
LED.00a0 ---> Sync.Report
LED.00a1 ---> Sync.Report
LED.00a2 ---> Sync.Report
LED.00a3 ---> Sync.Report
LED.00a4 ---> Sync.Report
LED.00a5 ---> Sync.Report
LED.00a6 ---> Sync.Report
LED.00a7 ---> Sync.Report
LED.00a8 ---> Sync.Report
LED.00a9 ---> Sync.Report
LED.00aa ---> Sync.Report
LED.00ab ---> Sync.Report
LED.00ac ---> Sync.Report
LED.00ad ---> Sync.Report
LED.00ae ---> Sync.Report
LED.00af ---> Sync.Report
LED.00b0 ---> Sync.Report
LED.00b1 ---> Sync.Report
LED.00b2 ---> Sync.Report
LED.00b3 ---> Sync.Report
LED.00b4 ---> Sync.Report
LED.00b5 ---> Sync.Report
LED.00b6 ---> Sync.Report
LED.00b7 ---> Sync.Report
LED.00b8 ---> Sync.Report
LED.00b9 ---> Sync.Report
LED.00ba ---> Sync.Report
LED.00bb ---> Sync.Report
LED.00bc ---> Sync.Report
LED.00bd ---> Sync.Report
LED.00be ---> Sync.Report
LED.00bf ---> Sync.Report
LED.00c0 ---> Sync.Report
LED.00c1 ---> Sync.Report
LED.00c2 ---> Sync.Report
LED.00c3 ---> Sync.Report
LED.00c4 ---> Sync.Report
LED.00c5 ---> Sync.Report
LED.00c6 ---> Sync.Report
LED.00c7 ---> Sync.Report
LED.00c8 ---> Sync.Report
LED.00c9 ---> Sync.Report
LED.00ca ---> Sync.Report
LED.00cb ---> Sync.Report
LED.00cc ---> Sync.Report
LED.00cd ---> Sync.Report
LED.00ce ---> Sync.Report
LED.00cf ---> Sync.Report
LED.00d0 ---> Sync.Report
LED.00d1 ---> Sync.Report
LED.00d2 ---> Sync.Report
LED.00d3 ---> Sync.Report
LED.00d4 ---> Sync.Report
LED.00d5 ---> Sync.Report
LED.00d6 ---> Sync.Report
LED.00d7 ---> Sync.Report
LED.00d8 ---> Sync.Report
LED.00d9 ---> Sync.Report
LED.00da ---> Sync.Report
LED.00db ---> Sync.Report
LED.00dc ---> Sync.Report
LED.00dd ---> Sync.Report
LED.00de ---> Sync.Report
LED.00df ---> Sync.Report
LED.00e0 ---> Sync.Report
LED.00e1 ---> Sync.Report
LED.00e2 ---> Sync.Report
LED.00e3 ---> Sync.Report
LED.00e4 ---> Sync.Report
LED.00e5 ---> Sync.Report
LED.00e6 ---> Sync.Report
LED.00e7 ---> Sync.Report
LED.00e8 ---> Sync.Report
LED.00e9 ---> Sync.Report
LED.00ea ---> Sync.Report
LED.00eb ---> Sync.Report
LED.00ec ---> Sync.Report
LED.00ed ---> Sync.Report
LED.00ee ---> Sync.Report
LED.00ef ---> Sync.Report
LED.00f0 ---> Sync.Report
LED.00f1 ---> Sync.Report
LED.00f2 ---> Sync.Report
LED.00f3 ---> Sync.Report
LED.00f4 ---> Sync.Report
LED.00f5 ---> Sync.Report
LED.00f6 ---> Sync.Report
LED.00f7 ---> Sync.Report
LED.00f8 ---> Sync.Report
LED.00f9 ---> Sync.Report
LED.00fa ---> Sync.Report
LED.00fb ---> Sync.Report
LED.00fc ---> Sync.Report
LED.00fd ---> Sync.Report
LED.00fe ---> Sync.Report
LED.00ff ---> Sync.Report
LED.NumLock ---> LED.?
LED.CapsLock ---> LED.?
LED.ScrollLock ---> LED.?

I asked here

Dont think Yves Trudeau's "driver" is the answer. I'm willing to help.

| improve this answer | |
  • Looks like the same problem: Kernel parser is confused by HID descriptor. So that's a bug that needs to be fixed ... – dirkt Jul 15 '17 at 16:57
2

I have got the Lenovo Professional Wireless Keyboard (4X30H56854). Yves Trudeau's "driver" works* for me after changing the product id from 609b to 609c (ATTRS{idProduct}=="609c").

*almost, but not the "Windows"/"Super" key.

| improve this answer | |
  • There is apparently a typo/undocumented feature on lines 257, 365 and 431. Meta is mapped to the "copy to clipboard" key, i.e. KEY_COPY. It should be mapped to KEY_LEFTMETA instead. Change that, recompile, and it works. – mikołak Jul 3 '18 at 11:03
2

This is finally fixed! I test it in Ubuntu 18.04 kernel: 4.15.0-64, Ubuntu 18.04.3 kernel: 5.0.0-29.

The keyboard and mouse seems to work fine with no issues! I had to disable a workaround used to make it work! https://github.com/y-trudeau/linux_lenovo_ultraslim_plus

It was also fixed in Fedora 30 according to this report: https://bugzilla.redhat.com/show_bug.cgi?id=1625415

| improve this answer | |
1

Due to I have the problem with a wireless Lenovo Essential Keyboard also I were forced to look deeper into the issue. Thanks to dirkt answer I could come up with a solution for me and now also for the Lenovo Professional Wireless Keyboard (now that I got one).

Updated 25.11.2018:

Now we are on 4.18.20 kernel and the patch changed because there are now devices with the same IDs but with correct HID descriptor where the fixup is a make it not work. But to be positive I know now how the HID descriptor should look like and therfore the fix should be more correct now.

I added the primax fix also (untested) which probably will work for the ASUS keyboard also. Sorry for the delay but fixing some AMDGPU issues had kept me more then busy.

diff -Naur current/drivers/hid/hid-ids.h igelworkdir/drivers/hid/hid-ids.h
--- current/drivers/hid/hid-ids.h   2018-11-25 00:15:18.384090521 +0100
+++ igelworkdir/drivers/hid/hid-ids.h   2018-11-25 00:18:26.210612649 +0100
@@ -698,6 +698,8 @@
 #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
 #define USB_DEVICE_ID_LENOVO_X1_COVER  0x6085
 #define USB_DEVICE_ID_LENOVO_X1_TAB    0x60a3
+#define USB_DEVICE_ID_LENOVO_WIRELESS_ESSENTIAL 0x60a9
+#define USB_DEVICE_ID_LENOVO_WIRELESS_PROFESSIONAL 0x609b

 #define USB_VENDOR_ID_LG       0x1fd2
 #define USB_DEVICE_ID_LG_MULTITOUCH    0x0064
@@ -1191,6 +1193,7 @@
 #define USB_VENDOR_ID_PRIMAX   0x0461
 #define USB_DEVICE_ID_PRIMAX_MOUSE_4D22    0x4d22
 #define USB_DEVICE_ID_PRIMAX_KEYBOARD  0x4e05
+#define USB_DEVICE_ID_PRIMAX_KEYBOARD_NEW  0x4e80
 #define USB_DEVICE_ID_PRIMAX_REZEL 0x4e72


diff -Naur current/drivers/hid/hid-lenovo.c igelworkdir/drivers/hid/hid-lenovo.c
--- current/drivers/hid/hid-lenovo.c    2018-11-25 00:15:18.148092378 +0100
+++ igelworkdir/drivers/hid/hid-lenovo.c    2018-11-25 00:18:51.654412438 +0100
@@ -64,6 +64,43 @@
    0x2a, 0xff, 0xff,   /*  Usage Maximum (65535)       */
 };

+/* gottwald@igel.com function to fix HID descriptor of primax based lenovo keyboards */
+
+static void fix_lenovo_hid_descriptor_primax(__u8 *rdesc)
+{
+   __u8 desc[16];
+   int i=0;
+
+   /* There are variants which do not have the issue these must be excluded */
+   if (rdesc[46] == 0x05 && rdesc[47] == 0x07 && rdesc[48] == 0x19 &&
+       rdesc[49] == 0x00 && rdesc[50] == 0x2A && rdesc[51] == 0xFF &&
+       rdesc[52] == 0x00 && rdesc[53] == 0x15 && rdesc[54] == 0x00 &&
+       rdesc[55] == 0x26 && rdesc[56] == 0xFF && rdesc[57] == 0x00 &&
+       rdesc[58] == 0x95 && rdesc[59] == 0x06 && rdesc[60] == 0x75 &&
+       rdesc[61] == 0x08)
+       return;
+
+   desc[0] = rdesc[56];
+   desc[1] = rdesc[57];
+   desc[2] = rdesc[51];
+   desc[3] = rdesc[52];
+   desc[4] = rdesc[53];
+   desc[5] = rdesc[54];
+   desc[6] = rdesc[55];
+   desc[7] = rdesc[46];
+   desc[8] = rdesc[47];
+   desc[9] = rdesc[48];
+   desc[10] = rdesc[49];
+   desc[11] = rdesc[50];
+   desc[12] = rdesc[60];
+   desc[13] = rdesc[61];
+   desc[14] = rdesc[58];
+   desc[15] = rdesc[59];
+   for (i=46;i<=61;i++) {
+       rdesc[i] = desc[i-46];
+   }
+}
+
 static __u8 *lenovo_report_fixup(struct hid_device *hdev, __u8 *rdesc,
        unsigned int *rsize)
 {
@@ -80,6 +117,23 @@
            rdesc[152] = 0x00;
        }
        break;
+   /* gottwald@igel.com Workaround to get Primax based Lenovo wireless keyboards working */
+
+   case USB_DEVICE_ID_LENOVO_WIRELESS_PROFESSIONAL:
+       if (*rsize == 80) {
+           // Not the keyboard if the rdesc[3] is not 0x06
+
+           if (rdesc[3] != 0x06)
+               return rdesc;
+
+           fix_lenovo_hid_descriptor_primax(rdesc);
+       }
+       break;
+   case USB_DEVICE_ID_LENOVO_WIRELESS_ESSENTIAL:
+       if (*rsize == 65) {
+           fix_lenovo_hid_descriptor_primax(rdesc);
+       }
+       break;
    }
    return rdesc;
 }
@@ -913,6 +967,9 @@
    { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
    { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
+   /* gottwald@igel.com load driver for Lenovo wireless keyboards which needs a workaround */
+   { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_WIRELESS_ESSENTIAL) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_WIRELESS_PROFESSIONAL) },
    { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) },
    { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) },
    { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) },
diff -Naur current/drivers/hid/hid-primax.c igelworkdir/drivers/hid/hid-primax.c
--- current/drivers/hid/hid-primax.c    2018-11-25 00:15:18.392090458 +0100
+++ igelworkdir/drivers/hid/hid-primax.c    2018-11-25 00:19:17.970205362 +0100
@@ -22,11 +22,65 @@

 #include "hid-ids.h"

+/* gottwald@igel.com function to fix HID descriptor of primax based keyboards */
+
+static void fix_hid_descriptor_primax(__u8 *rdesc)
+{
+        __u8 desc[16];
+        int i=0;
+
+        /* There are variants which do not have the issue these must be excluded */
+        if (rdesc[46] == 0x05 && rdesc[47] == 0x07 && rdesc[48] == 0x19 &&
+            rdesc[49] == 0x00 && rdesc[50] == 0x2A && rdesc[51] == 0xFF &&
+            rdesc[52] == 0x00 && rdesc[53] == 0x15 && rdesc[54] == 0x00 &&
+            rdesc[55] == 0x26 && rdesc[56] == 0xFF && rdesc[57] == 0x00 &&
+            rdesc[58] == 0x95 && rdesc[59] == 0x06 && rdesc[60] == 0x75 &&
+            rdesc[61] == 0x08)
+                return;
+
+        desc[0] = rdesc[56];
+        desc[1] = rdesc[57];
+        desc[2] = rdesc[51];
+        desc[3] = rdesc[52];
+        desc[4] = rdesc[53];
+        desc[5] = rdesc[54];
+        desc[6] = rdesc[55];
+        desc[7] = rdesc[46];
+        desc[8] = rdesc[47];
+        desc[9] = rdesc[48];
+        desc[10] = rdesc[49];
+        desc[11] = rdesc[50];
+        desc[12] = rdesc[60];
+        desc[13] = rdesc[61];
+        desc[14] = rdesc[58];
+        desc[15] = rdesc[59];
+        for (i=46;i<=61;i++) {
+                rdesc[i] = desc[i-46];
+        }
+}
+
+static __u8 *primax_report_fixup(struct hid_device *hid, __u8 *rdesc,
+                unsigned int *rsize)
+{
+        switch (hid->product) {
+        /* gottwald@igel.com Workaround to get Primax based keyboards working */
+        case USB_DEVICE_ID_PRIMAX_KEYBOARD_NEW:
+                if (*rsize > 61) {
+                        fix_hid_descriptor_primax(rdesc);
+                }
+                break;
+        }
+        return rdesc;
+}
+
 static int px_raw_event(struct hid_device *hid, struct hid_report *report,
     u8 *data, int size)
 {
    int idx = size;

+   if (hid->product == USB_DEVICE_ID_PRIMAX_KEYBOARD_NEW)
+       return 0;
+
    switch (report->id) {
    case 0:     /* keyboard input */
        /*
@@ -66,6 +120,7 @@

 static const struct hid_device_id px_devices[] = {
    { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD_NEW) },
    { }
 };
 MODULE_DEVICE_TABLE(hid, px_devices);
@@ -74,6 +129,7 @@
    .name = "primax",
    .id_table = px_devices,
    .raw_event = px_raw_event,
+   .report_fixup = primax_report_fixup,
 };
 module_hid_driver(px_driver);

diff -Naur current/drivers/hid/hid-quirks.c igelworkdir/drivers/hid/hid-quirks.c
--- current/drivers/hid/hid-quirks.c    2018-11-25 00:15:18.440090081 +0100
+++ igelworkdir/drivers/hid/hid-quirks.c    2018-11-25 00:19:44.781994384 +0100
@@ -427,6 +427,8 @@
    { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
    { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_WIRELESS_ESSENTIAL) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_WIRELESS_PROFESSIONAL) },
 #endif
 #if IS_ENABLED(CONFIG_HID_LOGITECH)
    { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
@@ -558,6 +560,7 @@
 #endif
 #if IS_ENABLED(CONFIG_HID_PRIMAX)
    { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD_NEW) },
 #endif
 #if IS_ENABLED(CONFIG_HID_PRODIKEYS)
    { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },

You could not copy the patch to a file and then patch, I don't know how to integrate a Patch correctly but it should help you to do the changes yourself.

| improve this answer | |
  • I've hit a similar issue with an Asus keyboard using similar Primax chips. As far as I see it, the issue is the same that the HID report is bonkers. Could you help me figure out what needs to be swapped and where? Here's a dump of the descriptor and the general sub infos gist.github.com/karalabe/5034e8cb44665a7d10e592afc8840a85 – Péter Szilágyi Aug 9 '18 at 16:23
  • @PéterSzilágyi I updated the whole thing and it should probably also work for the Asus keyboard. – S. Gottwald Nov 24 '18 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.