Hello All,
I want to add the imu sensor (lsm9ds1: accelerometer, gyroscope, magnetometer ) to HAL layer in Android 8.0, For doing this i refer the some previous post and done the below changes in my source.
1) i add the sm9ds1_acc_gyr.c and sm9ds1_mag.c and sm9ds1.h files in following path and edited in make file and kconfig file also ../../.. /vendor/nxp-opensource/kernel_imx/drivers/input/misc$
2) init.rc
service magd /system/bin/magd
class late_start
user system
group input
oneshot
seclabel u:r:sensors:s0
3) in ../device/fsl/imx6/sepolicy
/system/bin/magd u:object_r:sensors_exec:s0
4) in .te file
# magd service
type magd, domain;
type magd_exec, exec_type, file_type;
init_daemon_domain(magd)
5) in myboardfile.mk
PRODUCT_PACKAGES += \
sensors.lsm9ds1
PRODUCT_PACKAGES += \
magd
6) source build/envsetup.sh
lunch
make -j8
after doing this all i am able to see the events in on target board
i) $ cat /sys/class/input/*/name
lsm9ds1_acc
lsm9ds1_gyr
lsm9ds1_mag
gpio-keys,
ii) getevent /dev/input/event0 and event1 and event2
0003 0000 ffffdcd8
0003 0001 ffffa498
0003 0002 fff0bcf8
0000 0000 00000000
0003 0000 ffffd15c
0003 0001 ffffa894
0003 0002 fff0c004
0000 0000 00000000
0003 0000 ffffda80
0003 0001 ffffa600
0003 0002 fff0c9dc
iii) ps -A
root 136 2 0 0 rescuer_thread 0 S [ci_otg]
root 137 2 0 0 rescuer_thread 0 S [lsm9ds1_acc_gyr]
root 138 2 0 0 rescuer_thread 0 S [lsm9ds1_workque]
root 139 2 0 0 rescuer_thread 0 S [dm_bufio_cache]
if flash any .apk file for sensor on traget board i am not able to see the a any data on application.
can any one help how to add and what are are all the steps need to do to resolve this issue,
thanks in advance ,
Best Regrads.
SGN
Hi Igor,
Thanks for your reply,
I fixed that issue,
best regards
SGN
Hi Nandish
one can refer to android sensor hal intergartion tutorials
Sensor Stack and Kernel Module
Sensors | Android Open Source Project
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------