简体   繁体   中英

How can I add new accelerometer sensor to qcom android HAL?

Would like to enable MPU6050 accel & gyro sensor for my Qualcomm board which is MSM8909 chipset and android version is 8.x Oreo. I have tried the following.

  1. Enabled the kernel driver for the sensor "drivers/input/misc/mpu6050.c" and able to detect the sensor in android kernel too.

Log:

[   62.096904] input: MPU6050-accel as /devices/soc/78b7000.i2c/i2c-3/3-0068/input/input2
[   62.101460] input: gyroscope as /devices/soc/78b7000.i2c/i2c-3/3-0068/input/input3


msm8909w:/ # echo 1 > /sys/class/sensors/MPU6050-accel/enable
msm8909w:/ # echo 1 > /sys/class/sensors/MPU6050-gyro/enable
msm8909w:/ # getevent                                                          
add device 1: /dev/input/event3
  name:     "gyroscope"
add device 2: /dev/input/event2
  name:     "MPU6050-accel"


msm8909w:/ # lshal debug android.hardware.sensors@2.0:ISensors/default
android.hardware.sensors@2.0:ISensors/default does not exist, or no permission to connect.
msm8909w:/ # 
msm8909w:/ # lshal debug android.hardware.sensors@1.0
android.hardware.sensors@1.0/default does not exist, or no permission to connect.

  1. Tried to run android app to list out the sensors and found nothing, but able to list out sensors if I run it on my phone.

Following HAL layer settings & android code changes done and no luck!

device/qcom/msm8909w/sensors/hals.conf
sensors.msm8909w.so
sensors.msm8909.so
sensors.default.so
sensors.ssc.so
sensors.native.so
  1. Created build error in hardware/qcom/sensors/Accelerometer.cpp file to see whether this code is building or not, I didn't get any build errors.

  2. Also referred to following document. https://developer.qualcomm.com/qfile/28820/lm80-p0436-9_sensors_porting_guide.pdf

Do I need to change anything in HAL layer for my new sensor or anything missing here?

If you are not aware. Then i want to tell you that:

  1. Qualcomm uses ADSP as subsystem for their sensor.
  2. ADSP images are loaded by qcom kernel driver.
  3. ADSP code is proprietary.
  4. ADSP and android HAL communicate through fastrpc. Thanks May be this is useful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM