Want to integrate the LSM6DSM sensors into my AOSP oreo 8.1 build for our Intel X86 based Tablet. We are able to read the Raw data from these sensors using I2CGET cmdline tool as described below.
#modprobe i2c-dev
#i2cdetect -y 4 //i2c bus4
(device detected at address 0x6A, SA0 pin pulled Low)
Gyro:
i2cset -f -y 4 0x6A 0x11 0x40 b // Enable Gyro, 104 Hz (normal mode)
i2cget -f -y 4 0x6A 0x22 b //Pitch axis (X) angular rate value (LSbyte)
i2cget -f -y 4 0x6A 0x23 b //Pitch axis (X) angular rate value (MSbyte)
i2cget -f -y 4 0x6A 0x24 b //Roll axis (Y) angular rate value (LSbyte)
i2cget -f -y 4 0x6A 0x25 b //Roll axis (Y) angular rate value (MSbyte)
i2cget -f -y 4 0x6A 0x26 b //Yaw axis (Z) angular rate value (LSbyte)
i2cget -f -y 4 0x6A 0x27 b //Yaw axis (Z) angular rate value (MSbyte)
Accelerometer:
i2cset -f -y 4 0x6A 0x10 0x40 b // Enable accelero , 104 Hz (normal mode)
i2cget -f -y 4 0x6A 0x28 b //X-axis linear acceleration value (LSbyte)
i2cget -f -y 4 0x6A 0x29 b //X-axis linear acceleration value (MSbyte)
i2cget -f -y 4 0x6A 0x2A b //Y-axis linear acceleration value (LSbyte)
i2cget -f -y 4 0x6A 0x2B b //Y-axis linear acceleration value (MSbyte)
i2cget -f -y 4 0x6A 0x2C b //Z-axis linear acceleration value (LSbyte)
i2cget -f -y 4 0x6A 0x2D b //Z-axis linear acceleration value (MSbyte)
shaking the sensors makes sure the data in above reads also changes, This ensures that the I2C low level driver and hardware interfacing is Fine.
But still i'm not able to see the device enumerated like below:
/dev/iio:device*
/sys/devices/iio:device*
how to make the above hardware to enumerate/intantiate as an IIO device, as i assume that android-x86 project do not support device tree architecture (dts and dtb, which tells the kernel to load the appropriate driver).
Next we Downloaded the HAL source from below website:
https://github.com/STMicroelectronics/STMems_Android_Sensor_HAL_IIO
Followed the Readme.md from the above package to build the sensors.android-x86.so library, which is a part of our OS now at location: /system/vendor/lib/hw/sensor.android-x86.so
But im not still not able integrate the sensors data to android framework as the Sensor Test apps from playstore do not report any availibility of any sensor(eg : CPU-Z, etc)