如何禁用sensor\软摘除器件 以确定问题是否由sensor引起
当设备出现bug时,考虑到有可能是sensor引起,也有可能是其他器件引起的时候(一般是功耗相关的问题),我们需要禁用sensor来查看是否确为sensor引起,若确定是sensor引起的,还需要确定为哪一个sensor器件引起的,这时可以用摘除各个器件来定位问题。
如何禁用sensor
禁用sensor hal层
结果:sensor list 为空,adsp/slpi sensor 仍然会初始化,modem侧的子系统仍然可以获取sensor数据
禁用方法(bat脚本):注册表禁用sensor
adb root
adb wait-for-device
adb remount
adb shell "echo disable_sensors > /persist/sensors/registry/registry/sensors_settings"
adb shell sync
adb reboot
android 9 的禁用指令为:
adb shell "echo disable_sensors > /mnt/vendor/persist/sensors/sensors_settings"
禁用sensor core
该方法也可用于软移除单个sensor器件,去除对应的json文件即可
结果:sensor 驱动 init 失败,adsp/slpi仍运行
禁用方法(bat脚本):删除json文件及其生成的文件
adb root
adb wait-for-device
adb remount
adb shell rm -rf /persist/sensors/registry/registry
adb shell rm -rf /persist/sensors/registry/config
adb shell rm -rf

当设备出现bug且怀疑与sensor有关时,可以通过禁用sensor的不同组件来排查问题。禁用方法包括修改注册表、删除json文件、禁用sensordaemon及删除固件。此外,还可以通过编辑源代码避免特定sensor线程启动,或者单独移除特定sensor的注册和编译。
最低0.47元/天 解锁文章
792

被折叠的 条评论
为什么被折叠?



