icm42607陀螺仪上层接收不到数据问题
OS:RK3588+Android13
一、问题描述:底层驱动打印数据正常,getevent也可以看到有数据上报,但应用就是接收不到数据。
二、问题分析:经过分析ICM42607 驱动与 Rockchip Sensor HAL 的 input 事件类型不一致。
当前数据链路是:
ICM42607 原始数据正常 → 驱动上报 EV_ABS → HAL 只接收 EV_REL → 数据无法进入 SensorService/App

因此 ICM42607 上报的 EV_ABS/ABS_RX 不会被当前 HAL 正确解析。若公共 sensor-dev 只为 gyro 注册了 EV_RELcapability,那么 input_report_abs() 甚至会在 input core 内被直接过滤,HAL 的 poll() 都收不到事件;即使能够收到,HAL 也只会将它记录为 unknown event。
三、解决方案:底层驱动上报input_report_rel相对事件,保持跟HAL层一致
--- a/drivers/input/sensors/gyro/icm4260x_gyro.c
+++ b/drivers/input/sensors/gyro/icm4260x_gyro.c
@@ -91,9 +91,9 @@ static int gyro_report_value(struct i2c_client *client,
if (sensor->status_cur == SENSOR_ON) {
/* Report acceleration sensor information */
- input_report_abs(sensor->input_dev, ABS_RX, axis->x);
- input_report_abs(sensor->input_dev, ABS_RY, axis->y);
- input_report_abs(sensor->input_dev, ABS_RZ, axis->z);
+ input_report_rel(sensor->input_dev, REL_RX, axis->x);
+ input_report_rel(sensor->input_dev, REL_RY, axis->y);
+ input_report_rel(sensor->input_dev, REL_RZ, axis->z);
input_sync(sensor->input_dev);
}
四、i2c报错问题:地址要根据AD0引脚选配



浙公网安备 33010602011771号