Use accelerometer to rotate screen in tablet mode

Hi, i use thinkpad x1 yoga and it has accelerometer. I set some scripts in devd (like brightness control with acpi_ibm events), maybe exist some event for laptop rotation? I can't find accelerometer in sysctl for use. How i can use laptop accelerometer sensor? It is need a kernel patch?

Code:
hw.acpi.battery.info_expire: 5
hw.acpi.battery.units: 1
hw.acpi.battery.state: 1
hw.acpi.battery.rate: 9900
hw.acpi.battery.time: 132
hw.acpi.battery.life: 50
hw.acpi.acline: 0
hw.acpi.thermal.tz0._TSP: -1
hw.acpi.thermal.tz0._TC2: -1
hw.acpi.thermal.tz0._TC1: -1
hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
hw.acpi.thermal.tz0._CRT: 128.1C
hw.acpi.thermal.tz0._HOT: -1
hw.acpi.thermal.tz0._CR3: -1
hw.acpi.thermal.tz0._PSV: -1
hw.acpi.thermal.tz0.thermal_flags: 0
hw.acpi.thermal.tz0.passive_cooling: 0
hw.acpi.thermal.tz0.active: -1
hw.acpi.thermal.tz0.temperature: 55.1C
hw.acpi.thermal.user_override: 0
hw.acpi.thermal.polling_rate: 10
hw.acpi.thermal.min_runtime: 0
hw.acpi.cpu.cx_lowest: C8
hw.acpi.cpu.cppc_notify: 1
hw.acpi.reset_video: 0
hw.acpi.handle_reboot: 1
hw.acpi.disable_on_reboot: 0
hw.acpi.verbose: 0
hw.acpi.s4bios: 0
hw.acpi.sleep_delay: 1
hw.acpi.suspend_state: S3
hw.acpi.standby_state: NONE
hw.acpi.lid_switch_state: NONE
hw.acpi.sleep_button_state: S3
hw.acpi.power_button_state: S5
hw.acpi.supported_sleep_state: S3 S4 S5
 
I don't have anything recent or FreeBSD-specific, but with GNOME on Linux they had screen rotate tied to something "iio" iirc that just-worked with a Dell Latitude 2-in-1 years ago (I didn't figure it out with other DEs)

As a guess, something would have to poll the accelerometer to check for rotation changes, and then act on it (devd?). My Dell Latitude 5591 has an accelerometer for disk free-fall protection that showed up in Xorg logs that implies it could be usable for something else (I can't find a reference to it on 14.1 at the moment but it looks like it'd show under a /dev/input and implies it might be kind-of easy). In my case it's a STMicroelectronics sensor, and I suspect it's either not shown depending on ACPI OSI, or it doesn't have support under FreeBSD to show up as anything.

It's possible something easier exists, but I'd find what GNOME was doing with iio, see if that or something comparable can be installed freely on FreeBSD, and see if it'd be as-easy as setting the device path to an accelerometer in iio's config.

Or perhaps running an input test (evtest?) and then rotating the screen to see if it registers something?
 
I don't have anything recent or FreeBSD-specific, but with GNOME on Linux they had screen rotate tied to something "iio" iirc that just-worked with a Dell Latitude 2-in-1 years ago (I didn't figure it out with other DEs)

As a guess, something would have to poll the accelerometer to check for rotation changes, and then act on it (devd?). My Dell Latitude 5591 has an accelerometer for disk free-fall protection that showed up in Xorg logs that implies it could be usable for something else (I can't find a reference to it on 14.1 at the moment but it looks like it'd show under a /dev/input and implies it might be kind-of easy). In my case it's a STMicroelectronics sensor, and I suspect it's either not shown depending on ACPI OSI, or it doesn't have support under FreeBSD to show up as anything.

It's possible something easier exists, but I'd find what GNOME was doing with iio, see if that or something comparable can be installed freely on FreeBSD, and see if it'd be as-easy as setting the device path to an accelerometer in iio's config.

Or perhaps running an input test (evtest?) and then rotating the screen to see if it registers something?
Gnome in linux use iio-sensor-proxy (Kernel IIO -> dbus), and Linux kernel has self sensor system as Linux Industrial IO and some libs like libiio. In freebsd this all different, i see acpi interface, /dev/io, and other. I think in freebsd gnome version sensors just not implemented, but i check gnome de on freebsd, maybe i am wrong
 
I don't have anything recent or FreeBSD-specific, but with GNOME on Linux they had screen rotate tied to something "iio" iirc that just-worked with a Dell Latitude 2-in-1 years ago (I didn't figure it out with other DEs)

As a guess, something would have to poll the accelerometer to check for rotation changes, and then act on it (devd?). My Dell Latitude 5591 has an accelerometer for disk free-fall protection that showed up in Xorg logs that implies it could be usable for something else (I can't find a reference to it on 14.1 at the moment but it looks like it'd show under a /dev/input and implies it might be kind-of easy). In my case it's a STMicroelectronics sensor, and I suspect it's either not shown depending on ACPI OSI, or it doesn't have support under FreeBSD to show up as anything.

It's possible something easier exists, but I'd find what GNOME was doing with iio, see if that or something comparable can be installed freely on FreeBSD, and see if it'd be as-easy as setting the device path to an accelerometer in iio's config.

Or perhaps running an input test (evtest?) and then rotating the screen to see if it registers something?
Yep, gnome freebsd edition hasn't autorotate and not disable keyboard in tablet mode. acpi_ibm don't sent events on rotate in devd. I will try another modules
 
We have port of libiio in freebsd ports. But i not understand how it works. It wrote for Linux IIO Subsystem, how it was ported? I will try use this library for accelerometer
 
no results. Just try to find accelerometer device in system to get raw data and i want to write driver, but i don't no were is it, what a bus or interface using for it, just check dmesg for some device. Maybe someone now how find sensors data in system?
 
I make hw-probe and found what exist a intel integrate sensor solution and this have not driver. I think this controller using for accelerometer sensor. Keep research it
1730307203118.png
 
Back
Top