STMems_Android_Sensor_HAL_IIO icon indicating copy to clipboard operation
STMems_Android_Sensor_HAL_IIO copied to clipboard

I2C realted application are not able to read the data using the st_lsm6dsx driver

Open PritamSSahoo01 opened this issue 2 years ago • 0 comments

Hello,

i am using st_lsm6dsx driver for accelometer and gyroscope sensor integration in the kernel level and and i have loaded the driver successfully and getting the values in the kernel level . Below i am mentioning some value logs so that to confirm that the values are coming .

-->phyboard_polis:/ # cat sys/class/i2c-dev/i2c-2/device/2-006b/iio:device1/name

lsm6dsm_accel

->phyboard_polis:/ # cat sys/class/i2c-dev/i2c-2/device/2-006b/iio:device1/in_accel_x_raw

10090

So i need to get these values through the apk . So i need to configure the sensor hal . Then i have followed the as mentioned in the Sensor Hal IIO provided by STMicroelectronics/ but i faced many issues in the hal integration.

Initially i don't find any sensor hal of STMicroelectronics/ so i need to create one custom directory for STMicroelectronics/ and copied all the sensor hal codes to that folder by git clone https://github.com/STMicroelectronics/STMems_Android_Sensor_HAL_IIO.git in my android source code in path :hardware/STMicroelectronics/SensorHAL_IIO/STMems_Android_Sensor_HAL_IIO.

Then i followed the steps as mentioned in the Documentation of the hal folder .

First i tried for the Selftest tool manual as mentioned in the Documentation but got too many errors while compiling the AOSP.

Then i tried for the Factory calibration option: So i need to modify the files mentioned in the Documentation as follows:

  • device/{vendor}/{product}/BoardConfig.mk (modification) - device/{vendor}/{product}/init.{board}.rc (modification) - device/{vendor}/{product}/sepolicy/file.te (modification) - device/{vendor}/{product}/sepolicy/file_contexts (modification) - device/{vendor}/{product}/sepolicy/STSensors.te (add) After that i tried to build my AOSP then i got some errors related to the sepolicy.The error logs are:

cho "List of invalid domains:" 1>&2; cat out/target/product/phyboard_polis/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains 1>&2; exit 1; fi ) && (mv out/target/product/phyboard_polis/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp out/target/product/phyboard_polis/obj/ETC/sepolicy.recovery_intermediates/sepolicy )" device/nxp/imx8m/sepolicy/STSensors.te:8:ERROR 'unknown type persist_file' at token ';' on line 62204:

Access to /persist/STSensors

allow STSensors persist_file:dir { open getattr read search ioctl lock watch watch_reads }; checkpolicy: error(s) encountered while parsing configuration 16:43:16 ninja failed with: exit status 1

i have also modified the uevent.{board}.rc as mentioned in the Documentation and an example also there.

Can anyone please help me for the proper integration of the LSM6DSM sensor in the imx8mm board.Note that i am using Andriod R version i.e. Android 11 and my kernel version is 5.4.

Hope for any solution regarding the issue.

PritamSSahoo01 avatar Oct 06 '23 12:10 PritamSSahoo01