Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#757356: evtest: doesn't output scan codes for some keys

438 views
Skip to first unread message

Vincent Lefevre

unread,
Aug 7, 2014, 8:10:03 AM8/7/14
to
Package: evtest
Version: 1:1.31-1
Severity: important

For the 3 keys I want to remap, evtest doesn't output scan codes:

# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: AT Translated Set 2 keyboard
/dev/input/event1: Apple, Inc Apple Keyboard
/dev/input/event2: Apple, Inc Apple Keyboard
/dev/input/event3: PixArt USB Optical Mouse
/dev/input/event4: Video Bus
/dev/input/event5: Lid Switch
/dev/input/event6: Power Button
/dev/input/event7: Sleep Button
/dev/input/event8: PC Speaker
/dev/input/event9: HDA Digital PCBeep
/dev/input/event10: HDA Intel Headphone
/dev/input/event11: HDA Intel Dock Line Out
/dev/input/event12: HDA Intel Mic
/dev/input/event13: HDA Intel Dock Mic
/dev/input/event14: Dell WMI hotkeys
/dev/input/event15: DualPoint Stick
/dev/input/event16: AlpsPS/2 ALPS DualPoint TouchPad
/dev/input/event17: Laptop_Integrated_Webcam_0.3M
/dev/input/event18: ACPI Virtual Keyboard Device
Select the device event number [0-18]: 1
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x5ac product 0x221 version 0x111
Input device name: "Apple, Inc Apple Keyboard"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
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 120 (KEY_SCALE)
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 179 (KEY_KPLEFTPAREN)
Event code 180 (KEY_KPRIGHTPAREN)
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 code 204 (KEY_DASHBOARD)
Event code 224 (KEY_BRIGHTNESSDOWN)
Event code 225 (KEY_BRIGHTNESSUP)
Event code 227 (KEY_SWITCHVIDEOMODE)
Event code 228 (KEY_KBDILLUMTOGGLE)
Event code 229 (KEY_KBDILLUMDOWN)
Event code 230 (KEY_KBDILLUMUP)
Event code 240 (KEY_UNKNOWN)
Event code 464 (KEY_FN)
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Event type 17 (EV_LED)
Event code 0 (LED_NUML)
Event code 1 (LED_CAPSL)
Event code 2 (LED_SCROLLL)
Event code 3 (LED_COMPOSE)
Event code 4 (LED_KANA)
Properties:
Property type 20 (EV_REP)
Property code 0 (REP_DELAY)
Value 250
Property code 1 (REP_PERIOD)
Value 33
Testing ... (interrupt to exit)
Event: time 1407412701.199633, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
Event: time 1407412701.199633, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1407412701.199633, -------------- SYN_REPORT ------------
Event: time 1407412704.359675, type 1 (EV_KEY), code 86 (KEY_102ND), value 1
Event: time 1407412704.359675, -------------- SYN_REPORT ------------
Event: time 1407412704.463676, type 1 (EV_KEY), code 86 (KEY_102ND), value 0
Event: time 1407412704.463676, -------------- SYN_REPORT ------------
Event: time 1407412705.519661, type 1 (EV_KEY), code 41 (KEY_GRAVE), value 1
Event: time 1407412705.519661, -------------- SYN_REPORT ------------
Event: time 1407412705.607659, type 1 (EV_KEY), code 41 (KEY_GRAVE), value 0
Event: time 1407412705.607659, -------------- SYN_REPORT ------------
Event: time 1407412706.615714, type 1 (EV_KEY), code 464 (KEY_FN), value 1
Event: time 1407412706.615714, -------------- SYN_REPORT ------------
Event: time 1407412706.695677, type 1 (EV_KEY), code 464 (KEY_FN), value 0
Event: time 1407412706.695677, -------------- SYN_REPORT ------------
Event: time 1407412709.791885, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1407412709.791885, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1407412709.791885, -------------- SYN_REPORT ------------
Event: time 1407412710.039703, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1407412710.039703, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1407412710.039703, -------------- SYN_REPORT ------------
^C

-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.11-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages evtest depends on:
ii libc6 2.19-7

Versions of packages evtest recommends:
ii evemu-tools 1.2.0-2

evtest suggests no packages.

-- debconf-show failed


--
To UNSUBSCRIBE, email to debian-bugs-...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Vincent Lefevre

unread,
Aug 7, 2014, 8:50:02 AM8/7/14
to
On 2014-08-07 13:59:44 +0200, Vincent Lefevre wrote:
> For the 3 keys I want to remap, evtest doesn't output scan codes:
[...]
> Event: time 1407412701.199633, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
> Event: time 1407412701.199633, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
> Event: time 1407412701.199633, -------------- SYN_REPORT ------------
> Event: time 1407412704.359675, type 1 (EV_KEY), code 86 (KEY_102ND), value 1
> Event: time 1407412704.359675, -------------- SYN_REPORT ------------
> Event: time 1407412704.463676, type 1 (EV_KEY), code 86 (KEY_102ND), value 0
> Event: time 1407412704.463676, -------------- SYN_REPORT ------------
> Event: time 1407412705.519661, type 1 (EV_KEY), code 41 (KEY_GRAVE), value 1
> Event: time 1407412705.519661, -------------- SYN_REPORT ------------
> Event: time 1407412705.607659, type 1 (EV_KEY), code 41 (KEY_GRAVE), value 0
> Event: time 1407412705.607659, -------------- SYN_REPORT ------------
> Event: time 1407412706.615714, type 1 (EV_KEY), code 464 (KEY_FN), value 1
> Event: time 1407412706.615714, -------------- SYN_REPORT ------------
> Event: time 1407412706.695677, type 1 (EV_KEY), code 464 (KEY_FN), value 0

Actually, for the third key, that's not the Fn key I wanted to remap,
but anyway the missing scan code on it is still a bug.

/lib/udev/keymap had the same problem

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=654936

but I could patch it to get the wanted information.

--
Vincent Lef�vre <vin...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Stephen Kitt

unread,
Aug 8, 2014, 2:40:02 AM8/8/14
to
Control: reassign -1 src:linux

Salut Vincent,

On Thu, 7 Aug 2014 14:45:50 +0200, Vincent Lefevre <vin...@vinc17.net> wrote:
> On 2014-08-07 13:59:44 +0200, Vincent Lefevre wrote:
> > For the 3 keys I want to remap, evtest doesn't output scan codes:
> [...]
> > Event: time 1407412701.199633, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> > 70028 Event: time 1407412701.199633, type 1 (EV_KEY), code 28
> > (KEY_ENTER), value 0 Event: time 1407412701.199633, --------------
> > SYN_REPORT ------------ Event: time 1407412704.359675, type 1 (EV_KEY),
> > code 86 (KEY_102ND), value 1 Event: time 1407412704.359675,
> > -------------- SYN_REPORT ------------ Event: time 1407412704.463676,
> > type 1 (EV_KEY), code 86 (KEY_102ND), value 0 Event: time
> > 1407412704.463676, -------------- SYN_REPORT ------------ Event: time
> > 1407412705.519661, type 1 (EV_KEY), code 41 (KEY_GRAVE), value 1 Event:
> > time 1407412705.519661, -------------- SYN_REPORT ------------ Event:
> > time 1407412705.607659, type 1 (EV_KEY), code 41 (KEY_GRAVE), value 0
> > Event: time 1407412705.607659, -------------- SYN_REPORT ------------
> > Event: time 1407412706.615714, type 1 (EV_KEY), code 464 (KEY_FN), value
> > 1 Event: time 1407412706.615714, -------------- SYN_REPORT ------------
> > Event: time 1407412706.695677, type 1 (EV_KEY), code 464 (KEY_FN), value 0
>
> Actually, for the third key, that's not the Fn key I wanted to remap,
> but anyway the missing scan code on it is still a bug.

Right, but it's a kernel bug, evtest is just the messenger; it doesn't print
a scan code because no scan code event is generated (EV_MSC).

Regards,

Stephen
signature.asc

Vincent Lefevre

unread,
Feb 3, 2016, 8:10:05 AM2/3/16
to
Control: retitle -1 Scan code event not generated for some keys of the Appple keyboard
Control: found -1 4.3.3-7

Things have improved since now the normal keys have their scan code.
This is not the case of the Fn key, but this may be normal since this
is a special key that modifies other keys. But this is not the case
either for Fn+F1, etc.

$ head /sys/module/hid_apple/parameters/*
==> /sys/module/hid_apple/parameters/fnmode <==
2

==> /sys/module/hid_apple/parameters/iso_layout <==

0

==> /sys/module/hid_apple/parameters/swap_opt_cmd <==

0

--
Vincent Lefèvre <vin...@vinc17.net> - Web: <https://www.vinc17.net/>

Vincent Lefevre

unread,
May 26, 2021, 4:00:03 AM5/26/21
to
Control: reopen -1
Control: found -1 5.10.38-1

On 2021-04-28 18:39:44 +0200, j...@debian.org wrote:
> This bug was filed for a very old kernel. If you can reproduce it with
> - the current version in unstable/testing
> - the latest kernel from buster.backports
> please reopen the bug, see https://www.debian.org/Bugs/server-control

Bug still reproducible with linux-image-5.10.0-7-amd64 5.10.38-1.

# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: AT Translated Set 2 keyboard
/dev/input/event1: Video Bus
/dev/input/event2: PS/2 Generic Mouse
/dev/input/event3: Apple, Inc Apple Keyboard
/dev/input/event4: Apple, Inc Apple Keyboard
/dev/input/event5: PixArt USB Optical Mouse
[...]
Select the device event number [0-24]: 3
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x5ac product 0x221 version 0x111
Input device name: "Apple, Inc Apple Keyboard"
[...]
Testing ... (interrupt to exit)
Event: time 1622014586.354418, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1622014586.354418, -------------- SYN_REPORT ------------
Event: time 1622014588.314431, type 1 (EV_KEY), code 59 (KEY_F1), value 1
Event: time 1622014588.314431, -------------- SYN_REPORT ------------
ÈEvent: time 1622014588.402405, type 1 (EV_KEY), code 59 (KEY_F1), value 0
Event: time 1622014588.402405, -------------- SYN_REPORT ------------
Event: time 1622014591.010396, type 1 (EV_KEY), code 60 (KEY_F2), value 1
Event: time 1622014591.010396, -------------- SYN_REPORT ------------
ËEvent: time 1622014591.130400, type 1 (EV_KEY), code 60 (KEY_F2), value 0
Event: time 1622014591.130400, -------------- SYN_REPORT ------------
Event: time 1622014593.266402, type 1 (EV_KEY), code 61 (KEY_F3), value 1
Event: time 1622014593.266402, -------------- SYN_REPORT ------------
ÍEvent: time 1622014593.418425, type 1 (EV_KEY), code 61 (KEY_F3), value 0
Event: time 1622014593.418425, -------------- SYN_REPORT ------------
Event: time 1622014594.258377, type 1 (EV_KEY), code 62 (KEY_F4), value 1
Event: time 1622014594.258377, -------------- SYN_REPORT ------------
ÎEvent: time 1622014594.410386, type 1 (EV_KEY), code 62 (KEY_F4), value 0
Event: time 1622014594.410386, -------------- SYN_REPORT ------------
Event: time 1622014595.186424, type 1 (EV_KEY), code 63 (KEY_F5), value 1
Event: time 1622014595.186424, -------------- SYN_REPORT ------------
‚Event: time 1622014595.306297, type 1 (EV_KEY), code 63 (KEY_F5), value 0
Event: time 1622014595.306297, -------------- SYN_REPORT ------------
Event: time 1622014595.898361, type 1 (EV_KEY), code 64 (KEY_F6), value 1
Event: time 1622014595.898361, -------------- SYN_REPORT ------------
ÓEvent: time 1622014596.018362, type 1 (EV_KEY), code 64 (KEY_F6), value 0
Event: time 1622014596.018362, -------------- SYN_REPORT ------------
Event: time 1622014596.546417, type 1 (EV_KEY), code 65 (KEY_F7), value 1
Event: time 1622014596.546417, -------------- SYN_REPORT ------------
ÙEvent: time 1622014596.666411, type 1 (EV_KEY), code 65 (KEY_F7), value 0
Event: time 1622014596.666411, -------------- SYN_REPORT ------------
Event: time 1622014597.130399, type 1 (EV_KEY), code 66 (KEY_F8), value 1
Event: time 1622014597.130399, -------------- SYN_REPORT ------------
˚Event: time 1622014597.234394, type 1 (EV_KEY), code 66 (KEY_F8), value 0
Event: time 1622014597.234394, -------------- SYN_REPORT ------------
Event: time 1622014597.714254, type 1 (EV_KEY), code 67 (KEY_F9), value 1
Event: time 1622014597.714254, -------------- SYN_REPORT ------------
‡Event: time 1622014597.842254, type 1 (EV_KEY), code 67 (KEY_F9), value 0
Event: time 1622014597.842254, -------------- SYN_REPORT ------------
Event: time 1622014598.354389, type 1 (EV_KEY), code 68 (KEY_F10), value 1
Event: time 1622014598.354389, -------------- SYN_REPORT ------------
˘Event: time 1622014598.458419, type 1 (EV_KEY), code 68 (KEY_F10), value 0
Event: time 1622014598.458419, -------------- SYN_REPORT ------------
Event: time 1622014598.962403, type 1 (EV_KEY), code 87 (KEY_F11), value 1
Event: time 1622014598.962403, -------------- SYN_REPORT ------------
ÔEvent: time 1622014599.058405, type 1 (EV_KEY), code 87 (KEY_F11), value 0
Event: time 1622014599.058405, -------------- SYN_REPORT ------------
Event: time 1622014599.826412, type 1 (EV_KEY), code 88 (KEY_F12), value 1
Event: time 1622014599.826412, -------------- SYN_REPORT ------------
ÁEvent: time 1622014599.938401, type 1 (EV_KEY), code 88 (KEY_F12), value 0
Event: time 1622014599.938401, -------------- SYN_REPORT ------------
Event: time 1622014601.242407, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70068
Event: time 1622014601.242407, type 1 (EV_KEY), code 110 (KEY_INSERT), value 1
Event: time 1622014601.242407, -------------- SYN_REPORT ------------
^[[2~Event: time 1622014601.378309, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70068
Event: time 1622014601.378309, type 1 (EV_KEY), code 110 (KEY_INSERT), value 0
Event: time 1622014601.378309, -------------- SYN_REPORT ------------
Event: time 1622014602.914266, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70069
Event: time 1622014602.914266, type 1 (EV_KEY), code 184 (KEY_F14), value 1
Event: time 1622014602.914266, -------------- SYN_REPORT ------------
Event: time 1622014603.066378, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70069
Event: time 1622014603.066378, type 1 (EV_KEY), code 184 (KEY_F14), value 0
Event: time 1622014603.066378, -------------- SYN_REPORT ------------
Event: time 1622014603.706383, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7006a
Event: time 1622014603.706383, type 1 (EV_KEY), code 185 (KEY_F15), value 1
Event: time 1622014603.706383, -------------- SYN_REPORT ------------
Event: time 1622014603.818374, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7006a
Event: time 1622014603.818374, type 1 (EV_KEY), code 185 (KEY_F15), value 0

No MSC_SCAN line for F1 to F12.

There is no issue with F13 to F19 (note for 70068: I get KEY_INSERT
instead of KEY_F13 because I've rebound the key to insert via hwdb,
since the keyboard doesn't have an Insert key, replaced by fn; this
is expected).

Same issue for the Enter and Backspace keys:

Event: time 1622015066.745475, type 1 (EV_KEY), code 28 (KEY_ENTER), value 1
Event: time 1622015066.745475, -------------- SYN_REPORT ------------

Event: time 1622015066.857485, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1622015066.857485, -------------- SYN_REPORT ------------
Event: time 1622015072.137444, type 1 (EV_KEY), code 14 (KEY_BACKSPACE), value 1
Event: time 1622015072.137444, -------------- SYN_REPORT ------------
Event: time 1622015072.241435, type 1 (EV_KEY), code 14 (KEY_BACKSPACE), value 0
Event: time 1622015072.241435, -------------- SYN_REPORT ------------

Note that device 4 is used only for KEY_EJECTCD (this key doesn't
generate any even for device 3). I don't know whether this is a bug.

--
Vincent LefËvre <vin...@vinc17.net> - Web: <https://www.vinc17.net/>

Vincent Lefevre

unread,
May 26, 2021, 4:50:03 AM5/26/21
to
Control: retitle -1 Scan code event not generated for some keys of the Apple keyboard: those in applespi_fn_codes

On 2021-05-26 09:52:16 +0200, Vincent Lefevre wrote:
> No MSC_SCAN line for F1 to F12.
[...]
> Same issue for the Enter and Backspace keys:
[...]

And the cursor keys. Actually, all the keys corresponding to

static const struct applespi_key_translation applespi_fn_codes[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_ENTER, KEY_INSERT },
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
{ KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
{ KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
{ KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
{ KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY },
{ KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY },
{ KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
{ KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
{ KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY },
{ KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY },
{ KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
{ KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
{ KEY_RIGHT, KEY_END },
{ KEY_LEFT, KEY_HOME },
{ KEY_DOWN, KEY_PAGEDOWN },
{ KEY_UP, KEY_PAGEUP },
{ }
};

in drivers/input/keyboard/applespi.c.

Just in case, in /etc/modprobe.d/hid_apple.conf, I have

options hid_apple fnmode=2
options hid_apple iso_layout=0

--
Vincent Lefèvre <vin...@vinc17.net> - Web: <https://www.vinc17.net/>

Vincent Lefevre

unread,
May 26, 2021, 6:10:03 AM5/26/21
to
Control: retitle -1 Apple keyboard: Scan code event (EV_MSC) not generated when the EV_KEY event is generated by hid-apple.c
Control: tags -1 patch
But since I'm using hid_apple, I should have taken
drivers/hid/hid-apple.c, which has the same kind of code:

static const struct apple_key_translation apple_fn_keys[] = {
{ KEY_BACKSPACE, KEY_DELETE },
{ KEY_ENTER, KEY_INSERT },
{ KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
{ KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
{ KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
{ KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
{ KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY },
{ KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY },
{ KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
{ KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
{ KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY },
{ KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY },
{ KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
{ KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
{ KEY_UP, KEY_PAGEUP },
{ KEY_DOWN, KEY_PAGEDOWN },
{ KEY_LEFT, KEY_HOME },
{ KEY_RIGHT, KEY_END },
{ }
};

In the conditions from hidinput_apple_event(), the only ones that
should match according to my settings are

if (usage->code == fn_keycode) {

and

if (fnmode) {

and these are the keys (when trans is true, for fnmode) for which I do
not get a scan code event. Said otherwise, if hidinput_apple_event()
returns 1, I do not get a scan code event. There are input_event()
calls, but I suppose that they will just generate an EV_KEY event,
and EV_MSC is the one that is missing.

Note: in hid-apple.c, apple_event() calls hidinput_apple_event(), and
one has

static struct hid_driver apple_driver = {
[...]
.event = apple_event,
[...]
};
module_hid_driver(apple_driver);

I forgot that there was

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757356#35

from Daniel Lin, with a patch, in 2017. I've looked at this patch
(but have not tried it), and it adds an additional EV_MSC event
when hidinput_apple_event() has to generate an EV_KEY event. So
I confirm that should solve this issue and I'm adding the patch
tag (I don't know whether the patch needs an update, though).

Salvatore Bonaccorso

unread,
Jun 2, 2021, 11:30:04 AM6/2/21
to
Hi Vincent,
Can you, time permitting, starting from there (and needed refreshes)
try to confirm if the patch solves the issue on top of 5.10.40? If so,
next step would be to propose the change/report the bug at least, to
upstream, get_maintainers.pl would suggest to report it to:

Jiri Kosina <ji...@kernel.org> (maintainer:HID CORE LAYER)
Benjamin Tissoires <benjamin....@redhat.com> (maintainer:HID CORE LAYER)
linux...@vger.kernel.org (open list:HID CORE LAYER)
linux-...@vger.kernel.org (open list)

Regards,
Salvatore

Vincent Lefevre

unread,
Jul 19, 2021, 11:00:04 AM7/19/21
to
On 2021-06-02 17:24:38 +0200, Salvatore Bonaccorso wrote:
> Can you, time permitting, starting from there (and needed refreshes)
> try to confirm if the patch solves the issue on top of 5.10.40?

First, the patch did not apply correctly on top of 5.10.46 (currently
in unstable). So I've updated it and attached this new version. (I'm not
sure that the change concerning REL_HWHEEL is needed, but in any case,
it may be safer and it shouldn't hurt, thanks to the "type == EV_KEY"
test.)

Then I couldn't test it because the kernel build fails:

[...]
CC fs/locks.o
CC fs/binfmt_script.o
CC fs/binfmt_elf.o
CC fs/compat_binfmt_elf.o
CC fs/posix_acl.o
CC fs/coredump.o
CC fs/drop_caches.o
CC fs/fhandle.o
CC fs/dcookies.o
CC [M] fs/binfmt_misc.o
CC [M] fs/mbcache.o
AR fs/built-in.a
make[2]: *** [debian/rules:7: build-arch] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:77: deb-pkg] Error 2
make: *** [Makefile:1573: deb-pkg] Error 2

I don't know whether this matters, but the /usr/src/linux-source-5.10.tar.xz
archive is not extracted properly by tar, with directories having
incorrect timestamps. I've reported a bug for this:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991275
hid-apple-scancodes-5.10.patch

Vincent Lefevre

unread,
Jul 21, 2021, 10:30:03 AM7/21/21
to
On 2021-06-02 17:24:38 +0200, Salvatore Bonaccorso wrote:
> Hi Vincent,
>
> On Wed, May 26, 2021 at 12:02:12PM +0200, Vincent Lefevre wrote:
[...]
> > I forgot that there was
> >
> > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757356#35
> >
> > from Daniel Lin, with a patch, in 2017. I've looked at this patch
> > (but have not tried it), and it adds an additional EV_MSC event
> > when hidinput_apple_event() has to generate an EV_KEY event. So
> > I confirm that should solve this issue and I'm adding the patch
> > tag (I don't know whether the patch needs an update, though).
>
> Can you, time permitting, starting from there (and needed refreshes)
> try to confirm if the patch solves the issue on top of 5.10.40?

I could build and test the patched kernel, and I confirm that the
new patch at

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757356#75

solves the issue for me.

> If so, next step would be to propose the change/report the bug at
> least, to upstream, get_maintainers.pl would suggest to report it
> to:
>
> Jiri Kosina <ji...@kernel.org> (maintainer:HID CORE LAYER)
> Benjamin Tissoires <benjamin....@redhat.com> (maintainer:HID CORE LAYER)
> linux...@vger.kernel.org (open list:HID CORE LAYER)
> linux-...@vger.kernel.org (open list)

Since Daniel Lin (Cc'ed for any comment) is the author of the
original patch, I suppose that the patch should have:

Co-developed-by: Daniel Lin <ephe...@gmail.com>
Signed-off-by: Daniel Lin <ephe...@gmail.com>
Co-developed-by: Vincent Lefevre <vin...@vinc17.net>
Signed-off-by: Vincent Lefevre <vin...@vinc17.net>

as described at
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

if this is OK for him.

Daniel Lin

unread,
Jul 21, 2021, 6:40:04 PM7/21/21
to
Yes, I haven't used a machine with hid_apple in many years, but the patch sign-off is OK with me.

Vincent Lefevre

unread,
Jul 26, 2021, 10:20:04 AM7/26/21
to
On 2021-07-21 18:28:44 -0400, Daniel Lin wrote:
> Yes, I haven't used a machine with hid_apple in many years, but the
> patch sign-off is OK with me.

Thanks. For the reference of my patch submission a few days ago:

https://www.spinics.net/lists/linux-input/msg74111.html

https://lore.kernel.org/patchwork/project/lkml/list/?series=509091
0 new messages