You are not logged in.

#1 2019-04-06 18:54:02

onlyanegg
Member
Registered: 2019-01-18
Posts: 6

Lenovo Yoga - Detect mode (ie. laptop, tablet, tent)

Hi, all.

I have a Lenovo Yoga 720, and I'd like to automatically turn off the keyboard and touch pad when in tablet (or tent) mode. I was reading the wiki page on tablets and came across this script which seems to do exactly what I want except that it requires the laptop to have two accelerometers and mine apparently only has one. It makes sense - you need to calculate the difference in angle between the keyboard and the screen, so you need to know each of their angles with respect to the ground.

I almost conceded that it's just not possible with my laptop, but I can't help but think that if I had kept my Windows installation, then this would be working. There must be some other way to determine the mode other than by comparing accelerometers.

Has anyone solved this? Is there such a thing as an angle sensor? Can someone think of another method that I'm missing?

If all else fails, I guess I'll create a button on my desktop that activates and deactivates the devices manually.

Offline

#2 2019-04-06 19:10:21

nyhfbm
Member
Registered: 2019-04-06
Posts: 3

Re: Lenovo Yoga - Detect mode (ie. laptop, tablet, tent)

If it's a 3D accelerometer, as it is in my mini laptop, I don't see why it shouldn't be possible.

I found a python script somewhere that I had to correct a bit, I'll see if I can find it

Edit:
It's something like this:

https://github.com/tegan-lamoureux/Rota … /rotate.py

You'll probably need to read the name file of the iio device that has an ...accel_x, ...accel_y (, ...accel_z), and correct that in the line of the script that reads the name of the device.
Then read out the different states of XY(Z),in dufferent positions and adjust the script to your needs.

Last edited by nyhfbm (2019-04-06 19:22:04)

Offline

#3 2019-04-06 21:58:14

onlyanegg
Member
Registered: 2019-01-18
Posts: 6

Re: Lenovo Yoga - Detect mode (ie. laptop, tablet, tent)

Maybe I'm misunderstanding, but I think the problem with using only one accelerometer is that you can't tell the difference between when only the screen moves (and the angle changes) and when the whole computer moves (and the angle doesn't change). For example, if I read out the accelerometer values when the angle is 180 deg vs when the angle is 90 deg, and the computer is tilted back 90 deg onto it's monitor, the values are the same.

180 deg:

[me@yoga ~]$ cat /sys/bus/iio/devices/iio\:device1/in_accel_{x,y,z}_raw
-1
-16
-102

90 deg - tilted back 90 deg onto the monitor:

[me@yoga ~]$ cat /sys/bus/iio/devices/iio\:device1/in_accel_{x,y,z}_raw
-1
-16
-101

So, just having this one reading, I can't tell the difference between 90 deg and 180 deg.

Last edited by onlyanegg (2019-04-06 22:17:13)

Offline

Board footer

Powered by FluxBB