web-dev-qa-db-ja.com

画面を回転させるユーザー加速度計

lsmod | grep acc
hp_accel               28672  0
lis3lv02d              20480  1 hp_accel

このことから出力を取得するにはどうすればよいですか?

xrandr --output eDP1 --rotate normalまたはinvertedまたはleftまたはrightがあります。センサー出力を使用してこれらのコマンドをトリガーし、画面を回転させたいです。

編集:

カーネルをアップグレードした後、lsmod | grep accを実行するとこのメッセージが表示されます

hid_sensor_accel_3d    16384  1
hid_sensor_trigger     16384  15 hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_magn_3d,hid_sensor_gyro_3d,hid_sensor_rotation
industrialio_triggered_buffer    16384  5 hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_magn_3d,hid_sensor_gyro_3d,hid_sensor_rotation
hid_sensor_iio_common    16384  6 hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_trigger,hid_sensor_magn_3d,hid_sensor_gyro_3d,hid_sensor_rotation
industrialio           69632  10 hid_sensor_incl_3d,hid_sensor_accel_3d,acpi_als,hid_sensor_trigger,hid_sensor_magn_3d,hid_sensor_gyro_3d,hid_sensor_rotation,industrialio_triggered_buffer,kfifo_buf
hp_accel               28672  0
lis3lv02d              20480  1 hp_accel
hid_sensor_hub         20480  8 hid_sensor_incl_3d,hid_sensor_accel_3d,hid_sensor_iio_common,hid_sensor_trigger,hid_sensor_magn_3d,hid_sensor_gyro_3d,hid_sensor_rotation,hid_sensor_custom

edit2:

iio-sensor-proxyが実行されていません。 Sudo iio-sensor-proxyを試すと

** (process:2721): WARNING **: Failed to read float from /sys/devices/pci0000:00/0000:00:13.0/{33AECD58-B679-4E54-9BD9-A04D34F0C226}/001F:8086:22D8.0001/HID-SENSOR-200073.8.auto/iio:device6/in_scale

** (process:2721): WARNING **: Problem reading scan element information: /sys/devices/pci0000:00/0000:00:13.0/{33AECD58-B679-4E54-9BD9-A04D34F0C226}/001F:8086:22D8.0001/HID-SENSOR-200073.8.auto/iio:device6

ターミナルはI ^Cまで空白のままです。

Sudo systemctl start iio-sensor-proxyを試してもタイムアウトになるまで何も出力されません

Job for iio-sensor-proxy.service failed because a timeout was exceeded. See "systemctl status iio-sensor-proxy.service" and "journalctl -xe" for details.

systemctl status iio-sensor-proxy.service

● iio-sensor-proxy.service - IIO Sensor Proxy service
   Loaded: loaded (/lib/systemd/system/iio-sensor-proxy.service; static; vendor preset: enabled)
   Active: failed (Result: timeout) since Wed 2017-05-24 16:12:03 EET; 5min ago
  Process: 3335 ExecStart=/usr/sbin/iio-sensor-proxy (code=killed, signal=TERM)
 Main PID: 3335 (code=killed, signal=TERM)

May 24 16:10:33 gas systemd[1]: Starting IIO Sensor Proxy service...
May 24 16:12:03 gas systemd[1]: iio-sensor-proxy.service: Start operation timed out. Terminating.
May 24 16:12:03 gas systemd[1]: Failed to start IIO Sensor Proxy service.
May 24 16:12:03 gas systemd[1]: iio-sensor-proxy.service: Unit entered failed state.
May 24 16:12:03 gas systemd[1]: iio-sensor-proxy.service: Failed with result 'timeout'.

journalctl -xe(おそらくあまり役​​に立たない)

May 24 16:11:26 gas kernel: intel-vbtn INT33D6:01: unknown event index 0xcd
May 24 16:12:03 gas systemd[1]: iio-sensor-proxy.service: Start operation timed out. Terminating.
May 24 16:12:03 gas systemd[1]: Failed to start IIO Sensor Proxy service.
-- Subject: Unit iio-sensor-proxy.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit iio-sensor-proxy.service has failed.
-- 
-- The result is failed.
May 24 16:12:03 gas systemd[1]: iio-sensor-proxy.service: Unit entered failed state.
May 24 16:12:03 gas systemd[1]: iio-sensor-proxy.service: Failed with result 'timeout'.
May 24 16:12:03 gas Sudo[3855]: pam_unix(Sudo:session): session closed for user root
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:12:17 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:13:40 gas anacron[775]: Job `cron.daily' terminated
May 24 16:13:40 gas anacron[775]: Normal exit (1 job run)
May 24 16:13:50 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:14 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:14:43 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:15:01 gas CRON[4519]: pam_unix(cron:session): session opened for user root by (uid=0)
May 24 16:15:01 gas CRON[4520]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 24 16:15:01 gas CRON[4519]: pam_unix(cron:session): session closed for user root
May 24 16:15:02 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:15:15 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:15:26 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:15:49 gas /usr/lib/snapd/snapd[790]: snapmgr.go:450: No snaps to auto-refresh found
May 24 16:15:49 gas snapd[790]: 2017/05/24 16:15:49.321528 snapmgr.go:450: No snaps to auto-refresh found
May 24 16:15:51 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:13 gas gnome-session[2010]: (nm-applet:2383): nm-applet-WARNING **: ModemManager is not avai
May 24 16:16:58 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:17:01 gas CRON[4669]: pam_unix(cron:session): session opened for user root by (uid=0)
May 24 16:17:01 gas CRON[4670]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
May 24 16:17:01 gas CRON[4669]: pam_unix(cron:session): session closed for user root
May 24 16:17:46 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable 
May 24 16:18:00 gas org.gnome.zeitgeist.SimpleIndexer[1779]: ** (zeitgeist-fts:2514): WARNING **: Unable

...そしてはい、私のコンピューターの名前はgas X'Dです

このセンサーの問題を修正できることを願っています。私はそれを機能させるために必死です。私たちはそこに着いているようです:)

4
Mina Michael

これは解決策ではなく、正しい方向への指針です。また、これを行う方法を探しました。私はiio-sensor-proxyに出会いました https://github.com/hadess/iio-sensor-proxy と私はこれを整理する小さなデーモンを書いている最中です。

これは、monitor-sensorを実行し、画面を右に90度回転したときに得られるものです。

> monitor-sensor 
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: undefined)
=== Has ambient light sensor (value: 0.000000, unit: Lux)
    Accelerometer orientation changed: normal
    Light changed: 6.098000 (Lux)
    Light changed: 168.823008 (Lux)
    Light changed: 167.266008 (Lux)
    Light changed: 161.816008 (Lux)
    Light changed: 183.098009 (Lux)
    Accelerometer orientation changed: left-up
    Light changed: 204.379010 (Lux)
    Light changed: 214.241010 (Lux)
    Light changed: 214.371010 (Lux)
    Accelerometer orientation changed: normal
    Light changed: 179.724009 (Lux)
    Light changed: 170.121008 (Lux)
    Light changed: 170.900008 (Lux)
3
bengan