Add support for Lenovo Thinkpad Yoga 12 (2015) #1440

Closed
rexcze opened this Issue Oct 1, 2015 · 23 comments

Comments

Projects
None yet
8 participants

rexcze commented Oct 1, 2015

Hello,

on Lenovo Thinkpad Yoga 12 (2015) when I flip screen to tablet mode I can see that key is not mapped.

atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.

Ant after rotating screen back to laptop mode:

atkbd serio0: Unknown key pressed (translated set 2, code 0xd9 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e059 <keycode>' to make it known.

Would it be possible to map those keys? How to find correct filter expression to add mapping to 60-keyboard.hwdb?

Thank you.

Contributor

martinpitt commented Oct 1, 2015

Yes, we can do that. Presumably we should map them both to KEY_ROTATE_DISPLAY as there are no separate codes for "laptop to tablet" and "tablet to laptop". Can you please copy&paste the output of

cat /sys/class/dmi/id/modalias

? Thanks!

rexcze commented Oct 2, 2015

Thanks!

cat /sys/class/dmi/id/modalias

dmi:bvnLENOVO:bvrJEET70WW(1.19):bd08/25/2015:svnLENOVO:pn20DK002EMC:pvrThinkPadS1Yoga12:rvnLENOVO:rn20DK002EMC:rvrSDK0E50510WIN:cvnLENOVO:ct10:cvrNone:

@rexcze rexcze closed this Oct 2, 2015

@rexcze rexcze referenced this issue in rexcze/thinkpad-yoga-12-scripts Oct 2, 2015

Open

Add screen rotate key support to udev #2

Owner

poettering commented Oct 3, 2015

@rexcze Hmm, why did you close this bug? Or did @martinpitt already integrate the line?

rexcze commented Oct 3, 2015

Hi @poettering,
I closed it by mistake. Sorry.

@rexcze rexcze reopened this Oct 3, 2015

martinpitt added a commit to martinpitt/systemd that referenced this issue Oct 4, 2015

Contributor

martinpitt commented Oct 4, 2015

@rexcze, can you please double-check that PR #1457 fixes this for you?

@kaysievers kaysievers closed this in #1457 Oct 4, 2015

rexcze commented Oct 4, 2015

Hi I added lines from #1457, ran udevadm hwdb --update, restarted computer but I still can see:

atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
atkbd serio0: Unknown key released (translated set 2, code 0xd8 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
atkbd serio0: Unknown key pressed (translated set 2, code 0xd9 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e059 <keycode>' to make it known.
atkbd serio0: Unknown key released (translated set 2, code 0xd9 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e059 <keycode>' to make it known.

But I am not sure if udevadm hwdb --update and restart is enough.

Thanks

Owner

poettering commented Oct 7, 2015

Reopening as per the last comment. @martinpitt, any idea?

@poettering poettering reopened this Oct 7, 2015

Contributor

martinpitt commented Oct 7, 2015

udevadm hwdb --update ought to be enough, yes. Can you please run udevadm info --export-db > /tmp/udev.txt and put /tmp/udev.txt into a pastebin? Indeed #1457 did not add the 0xd8 key, but 0xd9 ought to work now.

rexcze commented Oct 7, 2015

Hello,
here is the output https://paste.fedoraproject.org/275903/

Contributor

martinpitt commented Oct 7, 2015

@rexcze: I'm honestly out of ideas what went wrong then. The DMI pattern does seem to match on your /devices/virtual/dmi/id, but there's clearly no KEYBOARD_KEY_d9 on /devices/platform/i8042/serio0/input/input3 (but its driver is atkbd). 60-keyboard.hwdb has similar patterns for other models which seem to work. Are you sure that you put it into the right place? Could you maybe download the complete https://github.com/systemd/systemd/blob/master/hwdb/60-keyboard.hwdb and replace your current version with that, and re-run udevadm hwdb --update?

Also, which systemd version are you running? The format of 60-keyboard.hwdb changed in March 2015, thus in systemd 220. If you run an older version, the evdev: match won't work (see commit 51c0c28).

rexcze commented Oct 7, 2015

I changed my 60-keyboard.hwdb by that from github, rerun udevadm hwdb --update and when I flip screen to tablet mode I can see in logs:

atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.

After switch back to laptop mode I can see:

atkbd serio0: Unknown key pressed (translated set 2, code 0xd9 on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e059 <keycode>' to make it known.

rexcze commented Oct 7, 2015

I am running systemd-219-24.fc22.x86_64...

@martinpitt martinpitt closed this in 10e6271 Oct 8, 2015

Contributor

martinpitt commented Oct 8, 2015

systemd 219? That explains it then, as I said the above patches are for >= 220. I pushed the above commit to add the missing 0xd8 key as well.

Contributor

martinpitt commented Oct 13, 2015

As pointed out in #1539 this indeed doesn't work yet, but for another reason. Reopening, will send PR momentarily.

@martinpitt martinpitt reopened this Oct 13, 2015

@martinpitt martinpitt self-assigned this Oct 13, 2015

martinpitt added a commit to martinpitt/systemd that referenced this issue Oct 13, 2015

keymap: Recognize KEY_* aliases
linux/input.h contains alias definitions like

  #define KEY_COFFEE……………………………………152
  #define KEY_SCREENLOCK…………………………KEY_COFFEE
  #define KEY_ROTATE_DISPLAY………………153
  #define KEY_DIRECTION……………………………KEY_ROTATE_DISPLAY

But we ignored these when building keyboard-keys-list.txt. Also allow the value
to start with "K" now (for KEY_*), and drop the hardcoded COFFEE →  SCREENLOCK
aliasing.

This Fixes assignments to key "direction".

Fixes #1440
Contributor

martinpitt commented Oct 13, 2015

PR #1558 should now fix this for good for systemd >= 220.

@poettering poettering added the hwdb label Oct 13, 2015

Contributor

martinpitt commented Oct 14, 2015

As discussed in #1539 these keys should not be assigned to "direction" as they are merely an indication of screen rotation, not a button to request screen rotation (like on other ThinkPad models). Assigning them to "reserved" also does not make the warnings disappear, so there's nothing we can/should do on the udev keymap side. I'll push a PR to remove the mapping again, which will auto-close this issue.

martinpitt added a commit to martinpitt/systemd that referenced this issue Oct 14, 2015

keymap: Drop ThinkPad Yoga
The Yoga's firmware sends key events whenever it's being folded or unfolded.
These are thus *not* a button for requesting a screen orientation change, just
an indication that this already happened. Thus they should not be assigned to
"direction", but be ignored. Assigning them to "reserved" does not silence the
"unknown key pressed" kernel warning, so there's no point in maintaining a
mapping here.

Fixes #1440

martinpitt added a commit to martinpitt/systemd that referenced this issue Oct 14, 2015

keymap: Recognize KEY_* aliases
linux/input.h contains alias definitions like

  #define KEY_COFFEE……………………………………152
  #define KEY_SCREENLOCK…………………………KEY_COFFEE
  #define KEY_ROTATE_DISPLAY………………153
  #define KEY_DIRECTION……………………………KEY_ROTATE_DISPLAY

But we ignored these when building keyboard-keys-list.txt. Also allow the value
to start with "K" now (for KEY_*), and drop the hardcoded COFFEE →  SCREENLOCK
aliasing.

This Fixes assignments to key "direction".

Fixes #1440

martinpitt added a commit to martinpitt/systemd that referenced this issue Oct 14, 2015

keymap: Drop ThinkPad Yoga
The Yoga's firmware sends key events whenever it's being folded or unfolded.
These are thus *not* a button for requesting a screen orientation change, just
an indication that this already happened. Thus they should not be assigned to
"direction", but be ignored. Assigning them to "reserved" does not silence the
"unknown key pressed" kernel warning, so there's no point in maintaining a
mapping here.

Fixes #1440

d4g commented Dec 8, 2015

This issue still exists for me.
On my Thinkpad Yoga S1, I see the following issue:
When i flip the display back to "laptop mode", XF86RotateWindows is triggered.
But when the display is flipped into "tablet mode", this does not occur.

But what I see is the following messages in dmesg:
[ 638.504273] atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
[ 638.504282] atkbd serio0: Use 'setkeycodes e058 ' to make it known.
[ 638.511214] thinkpad_acpi: unknown possible thermal alarm or keyboard event received
[ 638.511222] thinkpad_acpi: unhandled HKEY event 0x60c0

Can you please fix this?

Systemd:
systemd 227

Contributor

wlhlm commented Dec 8, 2015

Well, the commit that fixes this is part of systemd 228, so please update.

ragtag commented Dec 19, 2015

This really needs to trigger different events for e058 and e059. On the Yoga 12, the e058 is triggered when three different things happen:

  • going from laptop to tent mode
  • going from tent mode to tablet mode
  • going from tablet mode to tent mode.

e059 is triggered when going from tent mode to laptop mode.

I've been trying to get this laptop working the same way it does under Windows, and this issue as had me stumped. You can find my branch of the spin.py code for it here https://github.com/ragtag/spin (still a bit hacky).

The reason we need to differentiate the two, is that the laptop needs to enter tablet mode (disable keyboard, enable autoration etc.). when e058 is triggered, and enter laptop mode when e059 is triggered. With just one event, there is no way of telling where it goes from tent mode.

d4g commented Feb 2, 2016

The issue is still appearing for me, running systemd 228:
systemd-run --version systemd 228

dmesg -w
[56187.466149] atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
[56187.466152] atkbd serio0: Use 'setkeycodes e058 ' to make it known.
[56187.467361] thinkpad_acpi: unknown possible thermal alarm or keyboard event received
[56187.467365] thinkpad_acpi: unhandled HKEY event 0x60c0
[56187.467367] thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net
[56187.482037] atkbd serio0: Unknown key released (translated set 2, code 0xd8 on isa0060/serio0).
[56187.482040] atkbd serio0: Use 'setkeycodes e058 ' to make it known.
[56192.205462] atkbd serio0: Unknown key pressed (translated set 2, code 0xd9 on isa0060/serio0).
[56192.205465] atkbd serio0: Use 'setkeycodes e059 ' to make it known.
[56192.206567] thinkpad_acpi: unknown possible thermal alarm or keyboard event received
[56192.206575] thinkpad_acpi: unhandled HKEY event 0x60c0
[56192.206576] thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net
[56192.221220] atkbd serio0: Unknown key released (translated set 2, code 0xd9 on isa0060/serio0).
[56192.221223] atkbd serio0: Use 'setkeycodes e059 ' to make it known.

So the events are still not handled and not mapped.

d4g commented Dec 4, 2016

This issue is still not resolved. It's ennerving that I can't just reopen the issue.

same story here on Lenovo Thinkpad Yoga, kernel version 4.10.0, systemd 229.

$ cat /sys/class/dmi/id/modalias
dmi:bvnLENOVO:bvrN1FET40W(1.14):bd04/18/2016:svnLENOVO:pn20FQ004WMS:pvrThinkPadX1Yoga1st:rvnLENOVO:rn20FQ004WMS:rvrSDK0J40697WIN:cvnLENOVO:ct10:cvrNone:

Flip the screen and you get

[  102.872282] thinkpad_acpi: unknown possible thermal alarm or keyboard event received
[  102.872286] thinkpad_acpi: unhandled HKEY event 0x60f0
[  102.872287] thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net

dmesg output contains complaints about unhandled HKEY events 0x60f0 and 0x60c0. Eagerly waiting for fix, can assist with testing if needed.

I can confirm the issue on Thinkpad Yoga S1, kernel 4.9.0-2, systemd version 232.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment