-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On Sat, 2016-12-10 at 17:00 +0000, marmuta wrote: > There was an update to https://bugs.launchpad.net/bugs/989419 today, which had > me thinking if tablet-mode could be detected by a disabled/missing keyboard > device. I came across this for the Yoga 2 before:  > "The keyboard and touch pad are automatically locked when the screen is opened > beyond 190 degrees (approximately).".  I've tried hard to find a simple way. But unfortunately, no. I've not been able to come up with anything. And this is just for my hardware. I'm not sure if other variants, and other hardware, will have different issues. > Is this possibly done in "hardware" or still by some (Windows) driver reading > a sensor in software? > Initially, when I was investigating the iio sensor support for the kernel, I believe reading somewhere that the 4 modes (Normal, Tent, Tablet, ....) were done in Lenovo Software, and NOT by Windows. Which could be true, because this laptop was factory installed with Windows 8. > @Ritesh, could you check if the list of evdev or xinput devices changes > between tablet- and laptop mode? > $ sudo evtest > $ xinput Here are the outputs. No device listings change. rrs@learner:~$ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ ELAN Touchscreen id=9 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Lenovo EasyCamera id=10 [slave keyboard (3)] ↳ Ideapad extra buttons id=11 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)] 2016-12-11 / 00:06:33 ♒♒♒ ☺ rrs@learner:~$ Now switching to Tablet Mode^C 2016-12-11 / 00:06:47 ♒♒♒ ☹ => 130 rrs@learner:~$ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ ELAN Touchscreen id=9 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Lenovo EasyCamera id=10 [slave keyboard (3)] ↳ Ideapad extra buttons id=11 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)] 2016-12-11 / 00:07:14 ♒♒♒ ☺ 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]: ^C 2016-12-11 / 00:07:57 ♒♒♒ ☹ => 130 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]: ^C 2016-12-11 / 00:08:40 ♒♒♒ ☹ => 130 rrs@learner:~$ Besides this, here's some (unsolved) thought. Upon mode switch from tablet to normal, a scan code is generated (log below). We could fix it, for this hardware variant, with a proper keycode. If that works, then onboard (or someone else) will have to build a list of such devices with such quirks. But the problem is that upon switch to tablet mode, there's no such event. As you see below, both these events (press and release) are triggered only during mode switch from tablet to normal. [ 1523.920674] atkbd serio0: Unknown key pressed (translated set 2, code 0xbe on isa0060/serio0). [ 1523.920680] atkbd serio0: Use 'setkeycodes e03e ' to make it known. [ 1523.930007] atkbd serio0: Unknown key released (translated set 2, code 0xbe on isa0060/serio0). [ 1523.930013] atkbd serio0: Use 'setkeycodes e03e ' to make it known. - -- Ritesh Raj Sarraf RESEARCHUT - http://www.researchut.com "Necessity is the mother of invention." -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEQCVDstmIVAB/Yn02pjpYo/LhdWkFAlhMTrgACgkQpjpYo/Lh dWl6ZBAApZ5M8tVLVXqpY0oFSf04eQA1NcBPawKjjSjoaPS54wPjajo4qtxdVqEF yIAHaE6I+N1YVj4+uT89xR7l29G1OKwvgf2gaAGluwxBxcdLV3uASmgbUXavTRL8 Yz2/r87ErxwtXbGlV+7wOEDZCegAe7eUOTjRXCfW24+TSTWp0RxfPDExW5P0tMjm HVBD2Tdw37qx6tQ0T+MKVzJNHq76TopEgs7/G651gOaXWfHsqvTmD5zFKG7BOJ6s iz9yJQpiUvby4Rc7MA1x3LWqn+64NExlhyoiJhN33Gt8nFkLj0ZMzKTWWxaGGVFj krg2EuUPlOJ7PS2fWTu4vqxY1KJZ7pyOqZltAStOJVzYPOW0OuMQJDMEpaxGRxcS Hs6yYHHUTiUIpGEzwCY94qkjAkR8zK38t0bWt8JpuptY586BU44dV2dUozzjSMUA jYI2n/bPOduk/YcLRoUIKm6lSd0aYChr7llV0df18b8GzJUlxQJRXAutyA9JBBYL GGjAp0cHdEm8l60FPY72BjHeDpnyzbpJUXGjOoufpXiY1R316HmYWFzoRdWV2+QB 4mnYWx1KhQugEJiSn9i3C8v+UjaRd26jNnSRwPMB+WnTGWBTFON1Tns3QPNOm7uu Gbu1Yb2Ldyyqb81i4mTuyv3/rylBNCiDaSa2mqtCbI7BIB07j9g= =MAwe -----END PGP SIGNATURE-----