cannot use tablet mode lid sensor on yoga 460

Bug #1644670 reported by Lorn Potter
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1644047 for machine logs.

I see a message like this in syslog when I put this laptop into tablet mode (lid all the way backwards) from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795214

[80192.862047] thinkpad_acpi: unknown possible thermal alarm or keyboard event received
[80192.862053] thinkpad_acpi: unhandled HKEY event 0x60c0
[80192.862055] thinkpad_acpi: please report the conditions when this event happened to <email address hidden>
[80194.976875] thinkpad_acpi: unknown possible thermal alarm or keyboard event received
[80194.976885] thinkpad_acpi: unhandled HKEY event 0x60c0
[80194.976889] thinkpad_acpi: please report the conditions when this event happened to <email address hidden>

Happens on current kernel in 16.10, and also 4.9 as per the previous stated launchpad bug.

possible solution ?:
http://comments.gmane.org/gmane.linux.kernel/2058487

We need this to be handled by whatever input dev node so unity8 can react to when the lid it is put into tablet mode.

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1644670

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Lorn Potter (lorn-potter) wrote :

log files are linked to another similar bug in the description.

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Alex Hung (alexhung) wrote :

The patch in http://comments.gmane.org/gmane.linux.kernel/2058487 is not in upstream yet, and it ignores HKEY event 0x60c0, but userspace will not know it occurs.

It is not clear what is preferred for your needs, but it is possible to translate this HKEY event to a pre-defined scancode as below (kernel: include/uapi/linux/input-event-codes.h). That's how thinkpad-acpi does for many other events.

#define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */

I do not have a thinkpad with me, and I will modify thinkpad-acpi.c for you to test.

Revision history for this message
Alex Hung (alexhung) wrote :

The attached is a proof-of-concept solution - it adds an event generation (KEY_ROTATE_DISPLAY) in addition to http://comments.gmane.org/gmane.linux.kernel/2058487.

Let's try whether this event is generated for userspace and whether it meets the need. If it does, I will work with upstream on a proper solution.

Revision history for this message
Lorn Potter (lorn-potter) wrote :

don't suppose you have a kernel package you would share? :)

Changed in linux (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Incomplete
status: Incomplete → Triaged
Revision history for this message
Lorn Potter (lorn-potter) wrote :

nevermind. I managed to build kernel package.

Revision history for this message
Alex Hung (alexhung) wrote :
Revision history for this message
Alex Hung (alexhung) wrote :

Alternatively, you can do it without install new kernel + load the updated kernel driver. This is useful if you wanna run on stock kernel or we want to test different version of thinkpad_acpi.c

1. download "thinkpad_acpi.tar"
2. run "tar -xvf thinkpad_acpi.tar"
3. run "cd thinkpad_acpi"
4. compile, unload and load thinkpad_acpi by "make && sudo make install"

Revision history for this message
Lorn Potter (lorn-potter) wrote :

without that thinkpad_acpi patch:
~ $> $sudo acpi_listen
[sudo] password for lorn-potter:
ibm/hotkey LEN0068:00 00000080 000060c0
PNP0C14:04 000000b0 00000000
ibm/hotkey LEN0068:00 00000080 000060c0
PNP0C14:04 000000b0 00000000
ibm/hotkey LEN0068:00 00000080 000060c0

with the patch:

~ $> $sudo acpi_listen
[sudo] password for lorn-potter:
PNP0C14:04 000000b0 00000000
PNP0C14:04 000000b0 00000000

The patch does quiet the message to syslog.

Cannot seem to find any input event though.

Revision history for this message
Lorn Potter (lorn-potter) wrote :

Digging around the thinkpad_acpi.c code, I see there is some code already for tablet and laptop modes, but for X41t, X60 and others.

Namely tpacpi_input_send_tabletsw(void)
that seems to send SW_TABLET_MODE
(which makes more sense to me than KEY_ROTATE_DISPLAY)

Not sure of this has to do with this , but I see two entries in the 'ThinkPad Extra Buttons" event node (as reported by evtest)
Event code 582 (?)
Event code 592 (?)

Revision history for this message
Alex Hung (alexhung) wrote :

The patch indeed skips acpi event.

Can you also try "sudo showkey". In theory, event KEY_ROTATE_DISPLAY (153) should be generated with the key press.

Revision history for this message
Lorn Potter (lorn-potter) wrote :

KEY_ROTATE_DISPLAY does not get generated up to user level in that patch.

Revision history for this message
Alex Hung (alexhung) wrote :

Please try the attached thinkpad_acpi.c with comment #8 for KEY_ROTATE_DISPLAY again.

Revision history for this message
Alex Hung (alexhung) wrote :

Could you please attach the output of acpidump (sudo apt install acpidump && sudo acpidump > acpi.log).

SW_TABLET_MODE seems to rely on couple ACPI control methods, ex. MHKG and DHKN. I'd like to check them from acpidump.

Revision history for this message
Alex Hung (alexhung) wrote :

It seems two upstream patches as below are addressing tablet mode. From their description, I believe it receives 0x60c0 and generates tablet mode event.

https://patchwork.kernel.org/patch/9423615/
https://patchwork.kernel.org/patch/9423621/

I applied them to thinkpad_acpi.c to ubuntu-yakkety (but it is the same as current upstream) and attached it here. Please also try it as well.

Revision history for this message
Lorn Potter (lorn-potter) wrote :
Revision history for this message
Lorn Potter (lorn-potter) wrote :

Still do not see any events, other than in acpi_listen

Revision history for this message
Alex Hung (alexhung) wrote :

I received a Yoga 260 and verified the patches in #15 (now in 4.10rc7). As I flipped the screen, acpi_listen indicated it received an event as below:

~$ acpi_listen
 PNP0C14:00 000000a1 00000000
video/tabletmode TBLT 0000008A 00000001

This is from HKEY event 0x60c0. However, this system can only generate 0x60c0 once after powering up or resuming from S3, and I cannot verified whether it provides correct tablet states on both flip and fold.

You seem to get the events on both flip and fold and it should not be a problem for Yoga 460.

The kernel is available @ http://people.canonical.com/~alexhung/LP1644670/ for your references.

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.