30 | | == OS Support == |
31 | | The FXOS8700 used on many Ventana boards is supported in the following ways: |
32 | | ||= OpenWrt =||= Yocto =||= Android || |
33 | | || i2c/input || i2c/input || i2c/input/sensor HAL || |
34 | | |
35 | | == Android use via the Android sensor HAL == |
36 | | The Android BSP will register an accelerometer and a magnetometer sensor with the OS and therefore can be used with apps conforming the the Android sensor API. |
| 30 | == Software Support |
| 31 | The API used to access these devices varies depending on the device and sometimes the kernel version. |
| 32 | |
| 33 | ||= '''Device''' =||= Kernel API =|| |
| 34 | || LIS2DE12 || iio || |
| 35 | || LSM9DS1 || iio || |
| 36 | || FXOS8700 || input (3.14/4.4 kernel) / iio (4.19+ kernels) || |
| 37 | |
| 38 | |
| 39 | |
| 40 | [=#iio] |
| 41 | === Linux industrial I/O (newer kernels) |
| 42 | The modern approach to IMU devices is to use the [https://www.kernel.org/doc/html/v4.12/driver-api/iio/index.html Linux IIO subsystem]. IIO aims to fill the gap between the somewhat similar {{{hwmon}}} and {{{input}}} subsystems. While the {{{hwmon}}} API is directed at low sample rate sensors (like fan speed control or temperature measurement) the {{{input}}} API is focused on human interaction input devices (keyboard, mouse, touchscreen). In some cases there is considerable |
| 43 | overlap between these and the {{{iio}}} API. |
| 44 | |
| 45 | Userspace applications can interact with an IIO driver via either: |
| 46 | 1. {{{/sys/bus/iio/devices/iio:deviceX/}}} - represents a hardware sensor and groups |
| 47 | together the data channels. Common attributes are {{{name}}}, {{{dev}}}, |
| 48 | {{{sampling_frequency_available}}}, and standard attributes. See [https://elixir.bootlin.com/linux/latest/source/Documentation/ABI/testing/sysfs-bus-iio sysfs-bus-iio] for details. |
| 49 | * Example (GW54xx with FXOS8700) |
| 50 | {{{#!bash |
| 51 | # cat /sys/bus/iio/devices/iio\:device0/in_accel_sampling_frequenc |
| 52 | y_available |
| 53 | 1.5625 6.25 12.5 50 100 200 400 800 |
| 54 | # echo 100 > /sys/bus/iio/devices/iio\:device0/in_accel_sampling_f |
| 55 | requency |
| 56 | # for i in `seq 1 10`; do cat /sys/bus/iio/devices/iio\:device0/in |
| 57 | _accel_x_raw ; done |
| 58 | 70 |
| 59 | 70 |
| 60 | 70 |
| 61 | 70 |
| 62 | 90 |
| 63 | 90 |
| 64 | 90 |
| 65 | 90 |
| 66 | 90 |
| 67 | 90 |
| 68 | }}} |
| 69 | |
| 70 | 2. {{{/dev/iio:deviceX}}} - character device node interface used for buffered data transfer and for event information retrieval |
| 71 | |
| 72 | 3. [https://github.com/analogdevicesinc/libiio libiio] - library for interfacing with Linux IIO devices (Ubuntu: libiio-utils iiod, OpenWrt: iio-utils iiod): |
| 73 | * Example (GW54xx with FXOS8700) |
| 74 | {{{#!bash |
| 75 | # cat "/sys/bus/iio/devices/iio:device0/in_accel_sampling_frequenc |
| 76 | y" |
| 77 | cat: read error: Invalid argument |
| 78 | root@OpenWrt:/# iio_info |
| 79 | Library version: 0.18 (git tag: v0.18) |
| 80 | Compiled with backends: local |
| 81 | IIO context created with local backend. |
| 82 | Backend version: 0.18 (git tag: v0.18) |
| 83 | Backend description string: Linux OpenWrt 4.19.106 #0 SMP Tue Feb 25 22:49:24 2020 armv7l |
| 84 | IIO context has 1 attributes: |
| 85 | local,kernel: 4.19.106 |
| 86 | IIO context has 1 devices: |
| 87 | iio:device0: fxos8700 |
| 88 | 6 channels found: |
| 89 | accel_y: (input) |
| 90 | 5 channel-specific attributes found: |
| 91 | attr 0: raw value: -256 |
| 92 | attr 1: sampling_frequency ERROR: Invalid argument (-22) |
| 93 | attr 2: sampling_frequency_available value: 1.5625 6.25 12.5 50 100 200 400 800 |
| 94 | attr 3: scale value: 0.000244 |
| 95 | attr 4: scale_available value: 0.000244 0.000488 0.000976 |
| 96 | magn_z: (input) |
| 97 | 5 channel-specific attributes found: |
| 98 | attr 0: raw value: 0 |
| 99 | attr 1: sampling_frequency ERROR: Invalid argument (-22) |
| 100 | attr 2: sampling_frequency_available value: 1.5625 6.25 12.5 50 100 200 400 800 |
| 101 | attr 3: scale value: 0.000244 |
| 102 | attr 4: scale_available value: 0.000001200 |
| 103 | accel_z: (input) |
| 104 | 5 channel-specific attributes found: |
| 105 | attr 0: raw value: 0 |
| 106 | attr 1: sampling_frequency ERROR: Invalid argument (-22) |
| 107 | attr 2: sampling_frequency_available value: 1.5625 6.25 12.5 50 100 200 400 800 |
| 108 | attr 3: scale value: 0.000244 |
| 109 | attr 4: scale_available value: 0.000244 0.000488 0.000976 |
| 110 | magn_x: (input) |
| 111 | 5 channel-specific attributes found: |
| 112 | attr 0: raw value: -1660 |
| 113 | attr 1: sampling_frequency ERROR: Invalid argument (-22) |
| 114 | attr 2: sampling_frequency_available value: 1.5625 6.25 12.5 50 100 200 400 800 |
| 115 | attr 3: scale value: 0.000244 |
| 116 | attr 4: scale_available value: 0.000001200 |
| 117 | accel_x: (input) |
| 118 | 5 channel-specific attributes found: |
| 119 | attr 0: raw value: 82 |
| 120 | attr 1: sampling_frequency ERROR: Invalid argument (-22) |
| 121 | attr 2: sampling_frequency_available value: 1.5625 6.25 12.5 50 100 200 400 800 |
| 122 | attr 3: scale value: 0.000244 |
| 123 | attr 4: scale_available value: 0.000244 0.000488 0.000976 |
| 124 | magn_y: (input) |
| 125 | 5 channel-specific attributes found: |
| 126 | attr 0: raw value: 12800 |
| 127 | attr 1: sampling_frequency ERROR: Invalid argument (-22) |
| 128 | attr 2: sampling_frequency_available value: 1.5625 6.25 12.5 50 100 200 400 800 |
| 129 | attr 3: scale value: 0.000244 |
| 130 | attr 4: scale_available value: 0.000001200 |
| 131 | 1 device-specific attributes found: |
| 132 | attr 0: current_timestamp_clock value: realtime |
| 133 | |
| 134 | }}} |