alesya-h / linux_detect_tablet_mode

Detect if your laptop is in normal or tablet mode. Useful for Yoga laptops to disable keyboard/trackpoint/touchpad in a tablet mode
MIT License
137 stars 29 forks source link

x1 yoga 3rd gen #5

Closed lsmith77 closed 5 years ago

lsmith77 commented 6 years ago

running your script I get:

$ ./linux_detect_tablet_mode/watch_tablet 
This set of scripts requires 2 accelerometers to detect angle between
a keyboard and a display. Your system has 1, sorry.

Based on the below output I would expect there to be 2 devices

[lsmith@manjaro ~]$ ls /sys/bus/iio/devices/iio\:device
iio:device0/ iio:device1/ iio:device2/ 

however my Ruby foo is insufficient to really understand the parsing you do there and how to fix it ..

alesya-h commented 6 years ago

In each of those iio:device folders should be a file with a name "name", which should contain device type. On my system a command `cat /sys/bus/iio/devices/iio:device/name` returns

      2 accel_3d
      1 als
      1 dev_rotation
      1 geomagnetic_orientation
      1 gyro_3d
      1 incli_3d
      1 magn_3d

In your case it's likely that you don't have 2 accel_3d iio devices

lsmith77 commented 6 years ago

I am getting

$ cat /sys/bus/iio/devices/iio:device*/name
gyro_3d
accel_3d
als

So the question is then, did Lenovo reduce the capabilities in the 3rd gen or do I maybe need to enable them somehow?

I do have iio-sensor-proxy installed. I am running Manjaro.

alesya-h commented 6 years ago

Most likely this particular functionality is just implemented differently on gen3 - as far as I remember some other Lenovo Yoga laptops had an acpi event for tablet-laptop transition. As for having less sensors than gen2 - maybe some of them are newer and so are not recognized by the kernel.

lsmith77 commented 6 years ago

ok thx.