我正在把机器人移植到一个定制的iMX8板上。
这项工作的一部分是实现这个板的硬件,特别是加速度传感器。
提供感应器HAL。这个HAL正在产生传感器.imx8.so,当Android构建时:
smarc_mx8mq:/ # ls -lA vendor/lib/hw/sensors.imx8.so
-rw-r--r-- 1 root root 122684 2021-09-06 14:50 vendor/lib/hw/sensors.imx8.so
smarc_mx8mq:/ # ls -lA vendor/lib64/hw/sensors.imx8.so
-rw-r--r-- 1 root root 144208 2021-09-06 14:50 vendor/lib64/hw/sensors.imx8.soAndroid根本没有使用这种传感器HAL:
smarc_mx8mq:/ # lsof | grep libsensor
main 3609 root mem REG 179,5 94928 2271 /system/lib64/libsensor.so
main 3610 root mem REG 179,5 71304 1580 /system/lib/libsensor.so
audioserver 3645 audioserve mem REG 179,5 56984 2272 /system/lib64/libsensorprivacy.so
cameraserver 3655 cameraserv mem REG 179,5 40852 1581 /system/lib/libsensorprivacy.so
system_server 3890 system mem REG 179,5 56600 2274 /system/lib64/libsensorservicehidl.so
...a dozen more lines...
smarc_mx8mq:/ # lsof | grep sensors.imx8
1|smarc_mx8mq:/ #Android正在构建senors.imx8.so,但没有使用它或运行它的任何部分。(我增加了大量的日志记录来检查。)
我如何使Android使用senors.imx8.so?
更新:
我在adb logcat中找到了以下几行
09-03 15:45:27.906 3413 3413 I hwservicemanager: getTransport: Cannot find entry android.hardware.sensors@2.0::ISensors/default in either framework or device manifest.
09-03 15:45:27.910 3413 3413 I hwservicemanager: getTransport: Cannot find entry android.hardware.sensors@1.0::ISensors/default in either framework or device manifest.这使我看起来好像需要向清单中添加senors.imx8.so,但device/embedian/imx8m/smarc_mx8mq/manifest.xml如下所示:
<manifest version="1.0" type="device" target-level="4">
<hal format="hidl">
<name>android.hardware.radio</name>
<transport>hwbinder</transport>
<version>1.4</version>
<interface>
<name>IRadio</name>
<instance>slot1</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.graphics.allocator</name>
<transport>hwbinder</transport>
<impl level="generic"></impl>
<version>2.0</version>
<interface>
<name>IAllocator</name>
<instance>default</instance>
</interface>
</hal>
...many more...节没有指定库(路径)名称,因此我看不到添加传感器节会有什么帮助。
更新:
第一节:
<hal format="hidl">
<name>android.hardware.sensors</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ISensors</name>
<instance>default</instance>
</interface>
</hal>现在的错误是:
09-03 15:52:50.873 3890 3987 I ServiceManagement: getService: Trying again for android.hardware.sensors@1.0::ISensors/default...
09-03 15:52:51.873 3890 3987 W ServiceManagement: Waited one second for android.hardware.sensors@1.0::ISensors/default
09-03 15:52:51.874 3890 3987 I ServiceManagement: getService: Trying again for android.hardware.sensors@1.0::ISensors/default...
09-03 15:52:52.874 3890 3987 W ServiceManagement: Waited one second for android.hardware.sensors@1.0::ISensors/default
09-03 15:52:52.876 3890 3987 I ServiceManagement: getService: Trying again for android.hardware.sensors@1.0::ISensors/default...
09-03 15:52:53.876 3890 3987 W ServiceManagement: Waited one second for android.hardware.sensors@1.0::ISensors/default在阅读了https://source.android.com/devices/sensors/hal-interface和https://source.android.com/devices/sensors/sensors-hal2之后,我选择了1.0版
( ST传感器HAL有1.0的get_sensors_list(),而不是2.0的getSensorsList()。)
发布于 2021-09-17 14:35:08
解决办法是增加:
PRODUCT_PACKAGES += android.hardware.sensors@1.0-impl
PRODUCT_PACKAGES += android.hardware.sensors@1.0-service以smarc_mx8mq.mk并将节更正为:
<hal format="hidl">
<name>android.hardware.sensors</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ISensors</name>
<instance>default</instance>
</interface>
<fqname>@1.0::ISensors/default</fqname>
</hal>https://stackoverflow.com/questions/69083482
复制相似问题