Comment 36 for bug 1366421

Revision history for this message
Ritesh Raj Sarraf (rrs) wrote : Re: [Bug 1366421] Re: d-bus method for setting the auto-show option

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Sat, 2016-12-10 at 17:17 +0000, marmuta wrote:
> Also I skimmed through some of the kernel 4.9 sources but haven't found
> anything potentially useful yet.
> intel-vbtn.c really seems to handle power buttons only.
> acpi/button.c which creates the "Lid Switch" evdev appears to only handle lid
> switches with two positions, open and closed, for laptops presumably.
> drivers/platform/x86/ideapad-laptop.c references the Yoga 2 and exposes a
> number of sensors, but AFAICT nothing concerning detection of tablet-mode.

Here's something very interesting I've found.

rrs@learner:~$ sudo 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: Power Button
/dev/input/event2: Lid Switch
/dev/input/event3: Power Button
/dev/input/event4: Video Bus
/dev/input/event5: SynPS/2 Synaptics TouchPad
/dev/input/event6: Ideapad extra buttons
/dev/input/event7: PC Speaker
/dev/input/event8: HDA Digital PCBeep
/dev/input/event9: HDA Intel PCH Mic
/dev/input/event10: HDA Intel PCH Front Headphone
/dev/input/event11: HDA Intel HDMI HDMI/DP,pcm=3
/dev/input/event12: HDA Intel HDMI HDMI/DP,pcm=7
/dev/input/event13: HDA Intel HDMI HDMI/DP,pcm=8
/dev/input/event14: ELAN Touchscreen
/dev/input/event15: Lenovo EasyCamera
Select the device event number [0-15]: 6
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "Ideapad extra buttons"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 148 (KEY_PROG1)
    Event code 149 (KEY_PROG2)
    Event code 186 (KEY_F16)
    Event code 192 (KEY_F22)
    Event code 193 (KEY_F23)
    Event code 202 (KEY_PROG3)
    Event code 203 (KEY_PROG4)
    Event code 212 (KEY_CAMERA)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 238 (KEY_WLAN)
    Event code 240 (KEY_UNKNOWN)
    Event code 248 (KEY_MICMUTE)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
±Event: time 1481395850.563699, type 4 (EV_MSC), code 4 (MSC_SCAN), value 42
Event: time 1481395850.563699, type 1 (EV_KEY), code 193 (KEY_F23), value 1
Event: time 1481395850.563699, -------------- SYN_REPORT ------------
Event: time 1481395850.563722, type 1 (EV_KEY), code 193 (KEY_F23), value 0
Event: time 1481395850.563722, -------------- SYN_REPORT ------------
Event: time 1481395868.265979, type 4 (EV_MSC), code 4 (MSC_SCAN), value 43
Event: time 1481395868.265979, type 1 (EV_KEY), code 192 (KEY_F22), value 1
Event: time 1481395868.265979, -------------- SYN_REPORT ------------
Event: time 1481395868.266000, type 1 (EV_KEY), code 192 (KEY_F22), value 0
Event: time 1481395868.266000, -------------- SYN_REPORT ------------

±Event: time 1481395988.012878, type 4 (EV_MSC), code 4 (MSC_SCAN), value 42
Event: time 1481395988.012878, type 1 (EV_KEY), code 193 (KEY_F23), value 1
Event: time 1481395988.012878, -------------- SYN_REPORT ------------
Event: time 1481395988.012888, type 1 (EV_KEY), code 193 (KEY_F23), value 0
Event: time 1481395988.012888, -------------- SYN_REPORT ------------
Event: time 1481395994.077307, type 4 (EV_MSC), code 4 (MSC_SCAN), value 43
Event: time 1481395994.077307, type 1 (EV_KEY), code 192 (KEY_F22), value 1
Event: time 1481395994.077307, -------------- SYN_REPORT ------------
Event: time 1481395994.077328, type 1 (EV_KEY), code 192 (KEY_F22), value 0
Event: time 1481395994.077328, -------------- SYN_REPORT ------------

Event: time 1481395988.012878, type 4 (EV_MSC), code 4 (MSC_SCAN), value 42
Event: time 1481395988.012878, type 1 (EV_KEY), code 193 (KEY_F23), value 1
Event: time 1481395988.012878, -------------- SYN_REPORT ------------
Event: time 1481395988.012888, type 1 (EV_KEY), code 193 (KEY_F23), value 0
Event: time 1481395988.012888, -------------- SYN_REPORT ------------

The above events are reported by evdev when switching to tablet mode.

Event: time 1481395994.077307, type 4 (EV_MSC), code 4 (MSC_SCAN), value 43
Event: time 1481395994.077307, type 1 (EV_KEY), code 192 (KEY_F22), value 1
Event: time 1481395994.077307, -------------- SYN_REPORT ------------
Event: time 1481395994.077328, type 1 (EV_KEY), code 192 (KEY_F22), value 0
Event: time 1481395994.077328, -------------- SYN_REPORT ------------

And these when switching back to Normal mode. I did the switching twice,
just to be sure that it gives persistent results.

I hope it helps.

- --
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEQCVDstmIVAB/Yn02pjpYo/LhdWkFAlhMT7wACgkQpjpYo/Lh
dWmWzA//RiYrDOA7TKmhpwtm2y72niHY3etoasDzei6XNiHzfdhEw36DoQH2Vi2B
k31D7ABQ4iBdOcJYkG83QWiQmc1XECTECPCHKqFAWuyOy/1FGywQGdtYuTiwZtm+
9gfhR0eKN7wIP2QQVXGN7e3cIkr69bS/gEaO9iG9pMqthTFHL0vxqJQ46FBhQoTJ
dvUp0NcMlsvuZrHRLZxuWXdCdNxC+e5CXoAU1Ttl/HlHJs5o3TkUtv+7j9Q47Yke
q7CngbXV6zPebv+BlDbKU2gc1WhqKCE1Y6/DSxdlv/iw7iZIzUlGV1puJWwybF7Y
94Z63ASclq3KKMCS6r8QvaWZpRs4nNF4iyM6nrUpXxRmAt1MZkDQCTNwzawjeHE1
GO6qmVjDnwxb9FZl2v/WMrt1p/yS8t27sTSW2dq4gvmZQc8GAskDjVorzjXSdQ9V
f0EEF1ef38V36fua9+9XSJqfHMbxk1vzXFdIW5g9+fbaukr7aLPP+uGgOFm7mdwM
ZgXXxagr7fen4G6pllfZPZQfEEz5wELM4LDthZiO0DnqwInWMrpG/kOVekFK9EXF
36VNAMgDTlps/vTt/QiSQFNrkbTtq2tg91IcvmTXw55NaGfCwfnp1G/dmnI0k2Zg
r9bsrpY6gseGlV+3ymBpWUdMblTpUec9BSoJkhlLCjkbqPY5r+k=
=QSyP
-----END PGP SIGNATURE-----