Skip to content

Draft: Add Hinge Angle sensor support

Yauhen Kharuzhy requested to merge jekhor/iio-sensor-proxy:hinge-sensor into master

Add support for Hinge Angle sensor in the convertible laptops.

To calculate bending angle in absence of real hinge angle sensor, use data from the accelerometers mounted at device base and screen modules.


  • use the GLib D-Bus API to retrieve the lid status from the logind/Upower;
  • split the commits to smaller parts;
  • add support for the real hinge angle sensor;
  • decide how to detect if the system has native tablet mode switch (SW_TABLET_MODE is reported by kernel driver)
  • report SW_TABLET_MODE events even if no client claimed hinge angle sensor
  • apply some kind of filtering to avoid of false tablet mode change events generation

Closes: #216 #318

Please feel free to comment and make proposals, this is draft version. It was tested with Lenovo Yoga Book YB1-X91L convertible laptop.

I don't have experience in GLib programming, so please give attention to using of memory management idioms in the my code (referencing/unreferencing, freeing of memory etc.).


  • TABLET_MODE_TENT removed
  • Change hinge angle type from int16 to double
  • Add reporting SW_TABLET_MODE via uinput


  • Tablet mode calculation: remove redundant if()
  • Hinge angle calculation: always set hinge angle to 0 if the lid is closed
Edited by Yauhen Kharuzhy

Merge request reports