The script assumes accelerometers only, so it fails when it detects just one accelerometer, while my Lenovo Yoga 2 Pro seems to use gyroscope instead of second accelerometer.
dos@yoga:~/git/linux_detect_tablet_mode$ cat /sys/bus/iio/devices/iio\:device*/name
accel_3d
incli_3d
als
gyro_3d
magn_3d
dev_rotation
Actually, I have played a bit more with it and seems like all of this comes from the screen :( While there is some sensor on the keyboard side for sure, it doesn't seem to be reachable from Linux yet.
The script assumes accelerometers only, so it fails when it detects just one accelerometer, while my Lenovo Yoga 2 Pro seems to use gyroscope instead of second accelerometer.