同步操作将从 mirrors_STMicroelectronics/st-mems-android-linux-sensors-hal 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
This is the documentation page for the Android AIDL components of the sensors-hal iio.
Android system properties can be used to configure at run-time some parameters. If a parameter is set by using system properties, default value for that property will be discarded.
where SENSORTYPE can be one of these values:
Example of properties usage (i.e. device/<vendor>/<board>/system.prop):
persist.vendor.stm.sensors.max-odr = 250 #max odr that can be used is 250Hz
persist.vendor.stm.sensors.rot-matrix-1.accel = "1,0,0,0,1,0,0,0,1" #accel rotation matrix
persist.vendor.stm.sensors.placement-1.accel = "10,20,30" #accel position in cm
persist.vendor.stm.sensors.max-range.accel = 70 #accel full-scale to support reading of at least 70m/s^2
persist.vendor.stm.sensors.max-range.magn = 2000 #magn full-scale to support reading of at least 2000uT
persist.vendor.stm.sensors.max-range.gyro = 8 #gyro full-scale to support reading of at least 8rad/s
Default parameters can be set at compile time by changing the Android.bp cflags (under core, see core documentation).
1> clone this repository into desired folder (i.e. hardware/st/sensors-hal):
git clone https://github.com/STMicroelectronics/st-mems-android-linux-sensors-hal.git hardware/st/sensors-hal
2> enable soong module (i.e. hardware/st/sensors-hal/aidl/Android.bp):
...
enabled: true,
...
3> modify the device makefile (i.e. device/<vendor>/<board>/device.mk) by adding these lines:
# Build stm-sensors-hal in full treble mode
PRODUCT_PACKAGES += \
[email protected]
# Copy sensors config file(s)
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:system/etc/permissions/android.hardware.sensor.ambient_temperature.xml \
frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \
frameworks/native/data/etc/android.hardware.sensor.hifi_sensors.xml:system/etc/permissions/android.hardware.sensor.hifi_sensors.xml \
frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:system/etc/permissions/android.hardware.sensor.relative_humidity.xml \
frameworks/native/data/etc/android.hardware.sensor.stepcounter.xml:system/etc/permissions/android.hardware.sensor.stepcounter.xml \
frameworks/native/data/etc/android.hardware.sensor.stepdetector.xml:system/etc/permissions/android.hardware.sensor.stepdetector.xml
4> modify the sepolicy file_contexts file (i.e. device/<vendor>/<board>/sepolicy/file_contexts) by adding these lines:
/vendor/bin/hw/android\.hardware\.sensors@aidl-service\.stmicroelectronics u:object_r:hal_sensors_default_exec:s0
5> modify the uevent rules file (i.e. device/<vendor>/<board>/ueventd.rc) by adding these lines:
#common iio char devices
/dev/iio:device* 0666 system system
#sensors common
/sys/bus/iio/devices/iio:device* buffer/enable 0666 system system
/sys/bus/iio/devices/iio:device* buffer/length 0666 system system
/sys/bus/iio/devices/iio:device* sampling_frequency 0666 system system
/sys/bus/iio/devices/iio:device* hwfifo_flush 0666 system system
/sys/bus/iio/devices/iio:device* hwfifo_enabled 0666 system system
/sys/bus/iio/devices/iio:device* hwfifo_watermark 0666 system system
/sys/bus/iio/devices/iio:device* injection_mode 0666 system system
/sys/bus/iio/devices/iio:device* current_timestamp_clock 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_timestamp_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_count_en 0666 system system
#accelerometer sensor
/sys/bus/iio/devices/iio:device* in_accel_x_scale 0666 system system
/sys/bus/iio/devices/iio:device* in_accel_y_scale 0666 system system
/sys/bus/iio/devices/iio:device* in_accel_z_scale 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_accel_x_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_accel_y_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_accel_z_en 0666 system system
#gyroscope sensor
/sys/bus/iio/devices/iio:device* in_anglvel_x_scale 0666 system system
/sys/bus/iio/devices/iio:device* in_anglvel_y_scale 0666 system system
/sys/bus/iio/devices/iio:device* in_anglvel_z_scale 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_anglvel_x_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_anglvel_y_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_anglvel_z_en 0666 system system
#magnetometer sensor
/sys/bus/iio/devices/iio:device* in_magn_x_scale 0666 system system
/sys/bus/iio/devices/iio:device* in_magn_y_scale 0666 system system
/sys/bus/iio/devices/iio:device* in_magn_z_scale 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_magn_x_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_magn_y_en 0666 system system
/sys/bus/iio/devices/iio:device* scan_elements/in_magn_z_en 0666 system system
#step counter sensor
/sys/bus/iio/devices/iio:device* scan_elements/in_step_counter_en 0666 system system
/sys/bus/iio/devices/iio:device* max_delivery_rate 0666 system system
#temperature sensor
/sys/bus/iio/devices/iio:device* scan_elements/in_temp_en 0666 system system
#gesture sensor
/sys/bus/iio/devices/iio:device* scan_elements/in_gesture_en 0666 system system
6> build aosp as described into official documentation.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。