Raj
Raj

Reputation: 11

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 [email protected]:ISensors/default
[email protected]:ISensors/default does not exist, or no permission to connect.
msm8909w:/ # 
msm8909w:/ # lshal debug [email protected]
[email protected]/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 ?

Upvotes: 1

Views: 697

Answers (1)

Jaimin
Jaimin

Reputation: 11

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.

Upvotes: 1

Related Questions