HP Spectre x360 map keyboard events on switching laptop- to tablet-mode by default

Bug #1535008 reported by Stefan Beckers privat
This bug report is a duplicate of:  Bug #1663620: HP_WMI bad report on tablet mode . Edit Remove
52
This bug affects 10 people
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The HP Spectre x360 13-4105ng is a Convertible Laptop being able flip the Display/Lid over so it can be used as a tablet. When changing the mode to "tablet" (fliping the lid to the bottom side) the Keyboard is deacticated and this is revesed on switching the mode back. Perfect.

To have the user experience probably expected we are missing several functions like screen flip, switching the touchpad off, etc. Not the issue here as this can be scripted easily.

The problem is that I fail to hook into the events.

Expectation: Having these events mapped to suitable key peresses by default.

Description:

When the screen is tipped over to the bottom (entering tablet mode) syslog shows key press events:
Jan 8 18:51:16 hp-spectre kernel: [150865.472396] atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
Jan 8 18:51:16 hp-spectre kernel: [150865.472411] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
Jan 8 18:51:16 hp-spectre kernel: [150865.480324] atkbd serio0: Unknown key released (translated set 2, code 0xd8 on isa0060/serio0).
Jan 8 18:51:16 hp-spectre kernel: [150865.480340] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.

When flipping back into Laptop mode:
Jan 8 18:51:21 hp-spectre kernel: [150870.671201] atkbd serio0: Unknown key pressed (translated set 2, code 0xd7 on isa0060/serio0).
Jan 8 18:51:21 hp-spectre kernel: [150870.671220] atkbd serio0: Use 'setkeycodes e057 <keycode>' to make it known.
Jan 8 18:51:21 hp-spectre kernel: [150870.679319] atkbd serio0: Unknown key released (translated set 2, code 0xd7 on isa0060/serio0).
Jan 8 18:51:21 hp-spectre kernel: [150870.679334] atkbd serio0: Use 'setkeycodes e057 <keycode>' to make it known.
Jan 8 18:51:21 hp-spectre kernel: [150870.691549] atkbd serio0: Unknown key pressed (translated set 2, code 0xd7 on isa0060/serio0).
Jan 8 18:51:21 hp-spectre kernel: [150870.691564] atkbd serio0: Use 'setkeycodes e057 <keycode>' to make it known.
Jan 8 18:51:21 hp-spectre kernel: [150870.699264] atkbd serio0: Unknown key released (translated set 2, code 0xd7 on isa0060/serio0).
Jan 8 18:51:21 hp-spectre kernel: [150870.699284] atkbd serio0: Use 'setkeycodes e057 <keycode>' to make it known.
Jan 8 18:51:21 hp-spectre kernel: [150870.711563] atkbd serio0: Unknown key pressed (translated set 2, code 0xd7 on isa0060/serio0).
Jan 8 18:51:21 hp-spectre kernel: [150870.711577] atkbd serio0: Use 'setkeycodes e057 <keycode>' to make it known.
Jan 8 18:51:21 hp-spectre kernel: [150870.719406] atkbd serio0: Unknown key released (translated set 2, code 0xd7 on isa0060/serio0).
Jan 8 18:51:21 hp-spectre kernel: [150870.719422] atkbd serio0: Use 'setkeycodes e057 <keycode>' to make it known.

These events need to be accessible in Unity, so you are able to call scripts to do the tasks required for the event.

I di try to use setkeycode and failed to have these keypress events available in X.

After reading some doumentation, e.g. https://wiki.archlinux.org/index.php/Map_scancodes_to_keycodes I did end up with an attempt to create a file "/etc/udev/hwdb.d/70-hp-spectre-x360-convertible.hwdb" containing:

-------------------------%<--------------------------------------------
#evdev:name:<AT Translated Set 2 keyboard>:dmi:bvn*:bvr*:bd*:svn*:pn*
evdev:input:b0011v0001p0001eab38*
  KEYBOARD_KEY_d7=prog1 # enter laptop mode
  KEYBOARD_KEY_d8=prog2 # enter tablet mode
-------------------------%<--------------------------------------------

Running
# udevadm hwdb --update
# udevadm trigger

But I did not manage to get these Keys to be mapped, so I could use it for assigning keypress events in Unity.

FYI (not sure if this is of any help):
-------------------------%<--------------------------------------------
root@hp-spectre:~/Develop/hp-spectre-modeswitcher/doc# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Lid Switch
/dev/input/event1: Power Button
/dev/input/event2: Power Button
/dev/input/event3: AT Translated Set 2 keyboard
/dev/input/event4: Video Bus
/dev/input/event5: SynPS/2 Synaptics TouchPad
/dev/input/event6: HP Wireless hotkeys
/dev/input/event7: ELAN Touchscreen Pen
/dev/input/event8: ELAN Touchscreen
/dev/input/event9: HP Truevision Full HD
/dev/input/event10: HP WMI hotkeys
/dev/input/event11: HDA Intel PCH Mic
/dev/input/event12: HDA Intel PCH Headphone
/dev/input/event13: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event14: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event15: HDA Intel PCH HDMI/DP,pcm=8
Select the device event number [0-15]: 3
Input driver version is 1.0.1
Input device ID: bus 0x11 vendor 0x1 product 0x1 version 0xab83
Input device name: "AT Translated Set 2 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 112 (KEY_MACRO)
    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 118 (KEY_KPPLUSMINUS)
    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 140 (KEY_CALC)
    Event code 142 (KEY_SLEEP)
    Event code 143 (KEY_WAKEUP)
    Event code 155 (KEY_MAIL)
    Event code 156 (KEY_BOOKMARKS)
    Event code 157 (KEY_COMPUTER)
    Event code 158 (KEY_BACK)
    Event code 159 (KEY_FORWARD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 172 (KEY_HOMEPAGE)
    Event code 173 (KEY_REFRESH)
    Event code 183 (KEY_F13)
    Event code 184 (KEY_F14)
    Event code 185 (KEY_F15)
    Event code 217 (KEY_SEARCH)
    Event code 226 (KEY_MEDIA)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  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 250
    Repeat code 1 (REP_PERIOD)
      Value 33
Properties:
Testing ... (interrupt to exit)
Event: time 1452268938.262983, type 4 (EV_MSC), code 4 (MSC_SCAN), value d8
Event: time 1452268938.262983, -------------- SYN_REPORT ------------
Event: time 1452268938.270667, type 4 (EV_MSC), code 4 (MSC_SCAN), value d8
Event: time 1452268938.270667, -------------- SYN_REPORT ------------
Event: time 1452268961.698266, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1452268961.698266, -------------- SYN_REPORT ------------
Event: time 1452268961.706373, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1452268961.706373, -------------- SYN_REPORT ------------
Event: time 1452268961.718358, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1452268961.718358, -------------- SYN_REPORT ------------
Event: time 1452268961.726365, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1452268961.726365, -------------- SYN_REPORT ------------
Event: time 1452268961.738529, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1452268961.738529, -------------- SYN_REPORT ------------
Event: time 1452268961.746327, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1452268961.746327, -------------- SYN_REPORT ------------
Event: time 1452339271.806310, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1c
Event: time 1452339271.806310, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1452339271.806310, -------------- SYN_REPORT ------------
Event: time 1452339274.625370, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1d
Event: time 1452339274.625370, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1452339274.625370, -------------- SYN_REPORT ------------
Event: time 1452339275.324740, type 4 (EV_MSC), code 4 (MSC_SCAN), value 2e
Event: time 1452339275.324740, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1452339275.324740, -------------- SYN_REPORT ------------
-------------------------%<--------------------------------------------

Tags: bot-comment
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1535008/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Stefan Beckers privat (stefan-beckers) wrote :

I am not sure if this is the right or only package package if dealing with this sort of hardware support issue but as far as I do understand right now udev is hanling the assighment under systemd, esp if the keys need to be present in X.

affects: ubuntu → udev (Ubuntu)
Revision history for this message
emuboy (emuboy85) wrote :

I have the same issue, plus, the x360 have 9DOF IMU on the i2c bus (I guess) but I didn't find any way to get the data out of them (they should be on the motherboard but I can't find it...)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in udev (Ubuntu):
status: New → Confirmed
Revision history for this message
Itay Lavie (itayblabla) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.