You are not logged in.
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
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
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
-10290 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
-101So, 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