mirror of
https://github.com/Droid-VM/crosvm.git
synced 2026-11-17 06:58:03 +00:00
--input motion[path=PATH,host-sensors=BOOL,name=N] is a built-in motion-sensor device, as evdev describes one: INPUT_PROP_ACCELEROMETER, acceleration on ABS_X/Y/Z (256 per g, +-16 g), angular velocity on ABS_RX/RY/RZ (16 per degree/s), MSC_TIMESTAMP; the same as example_custom_motion_sensor_config.json. The acceleration is the gravity vector in the screen's frame, as Linux desktops read it (iio-sensor-proxy: Y negative is "normal", X positive "left-up"): upright at rest, Y is -1 g. The device reads one end of a socket pair; spawn_motion_feeder writes the other from two sources: - host-sensors=true: the host's accelerometer and gyroscope at 50 Hz. On Android through the NDK's ASensorManager, loaded from libandroid.so at run time as the display backend loads SurfaceControl, and negated (Android reports the reaction to gravity). crosvm runs as root under DroidVM, and the sensor service holds continuous sensors back only from app uids in the background, so the guest has them whether or not anything is showing it. Elsewhere there is no host source yet. - path: frames (virtio_input_events ending in SYN_REPORT) from an outside writer, e.g. the app that shows the guest, override the host's sensors for as long as they keep coming: a second after the last one, or at once when the writer closes, the host's sensors take over again. A presenter that shows the guest's picture turned, or wants it to see other values, sends its own. Checked on an Ubuntu 26.04 guest (PCI) on the OnePlus Pad 2: "Crosvm Virtio Motion Sensors 0" with PROP=40, udev ID_INPUT_ACCELEROMETER=1, absinfo -4096..4096 res 256 and -32768..32767 res 16, about 50 accelerometer and 50 gyroscope frames a second, values matching Android's own (sensorservice shows crosvm's uid-0 connection at 20 ms); monitor-sensor reports right-up for the tablet held with its natural right edge up (Android ROTATION_90). Before the negation it said left-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Camiwa7VsPwkhfyscKQ6S |
History
|
|
|---|---|---|
| .. | ||
| book | ||