RK3588 移植中科微GPS驱动

简介

平台:Android12.0
芯片:RK3588
GPS:中科微电子 ATGM332D-5N

驱动下载

这家驱动在github上,除了以前的Android7.1/9.0之外,现在还更新了android13的,跟android12是通用的
记得改下自己的串口和波特率
https://github.com/zxcwhale/aosp13_gnss_hal

移植

Android.mk

# Gnss HAL
PRODUCT_PACKAGES += \
	android.hardware.gnss@1.0 \
	android.hardware.gnss@1.0-impl \
	android.hardware.gnss@1.0-service \
	gps.default

BoardConfig.mk

BOARD_HAS_GPS := true

HIDL

device/rockchip/common$ git diff manifests/compatibility_matrix.xml
diff --git a/manifests/compatibility_matrix.xml b/manifests/compatibility_matrix.xml
index 3082485..0c8a5f7 100644
--- a/manifests/compatibility_matrix.xml
+++ b/manifests/compatibility_matrix.xml
@@ -55,5 +55,13 @@
             <instance>default</instance>
         </interface>
     </hal>
+    <hal format="hidl" optional="true">
+       <name>android.hardware.gnss</name>
+       <version>1.0</version>
+       <interface>
+               <name>IGnss</name>
+               <instance>default</instance>
+       </interface>
+    </hal>

hardware/interfaces/gnss$ git diff ../compatibility_matrices/compatibility_matrix.5.xml
diff --git a/hardware/interfaces/compatibility_matrices/compatibility_matrix.5.xml b/hardware/interfaces/compatibility_matrices/compatibility_matrix.5.xml
index 0fb21a7443..1b58896952 100644
--- a/hardware/interfaces/compatibility_matrices/compatibility_matrix.5.xml
+++ b/hardware/interfaces/compatibility_matrices/compatibility_matrix.5.xml
@@ -202,6 +202,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.gnss</name>
+       <version>1.0</version>
         <version>2.0-1</version>
         <interface>
             <name>IGnss</name>


补丁

hardware/interfaces/gnss/1.0/default/android.hardware.gnss@1.0-service.xml
<manifest version="1.0" type="device">
    <hal format="hidl">
        <name>android.hardware.gnss</name>
        <transport>hwbinder</transport>
        <version>1.0</version>
        <interface>
            <name>IGnss</name>
            <instance>default</instance>
        </interface>
    </hal>
</manifest>
git diff hardware/interfaces/gnss/1.0/default/Android.bp
diff --git a/hardware/interfaces/gnss/1.0/default/Android.bp b/hardware/interfaces/gnss/1.0/default/Android.bp
index b0cf2c6888..8b0f3d4bec 100644
--- a/hardware/interfaces/gnss/1.0/default/Android.bp
+++ b/hardware/interfaces/gnss/1.0/default/Android.bp
@@ -12,6 +12,7 @@ cc_library_shared {
     defaults: ["hidl_defaults"],
     vendor: true,
     relative_install_path: "hw",
+    vintf_fragments: ["android.hardware.gnss@1.0-service.xml"],
     srcs: [
         "ThreadCreationWrapper.cpp",
         "AGnss.cpp",

常见问题

VINTF报错

08-26 02:45:06.012   337   337 I hwservicemanager: getTransport: Cannot find entry android.hardware.gnss@1.0::IGnss/default in either framework or device VINTF manifest.
08-26 02:45:06.012  7981  7981 E HidlServiceManagement: Service android.hardware.gnss@1.0::IGnss/default must be in VINTF manifest in order to register/get.
08-26 02:45:06.012  7981  7981 E LegacySupport: Could not register service android.hardware.gnss@1.0::IGnss/default (-2147483648)

提示找不到1.0的gnss服务,hidl没有加好
hardware/interfaces/compatibility_matrices/下面有多个xml,可以都加上测试一下

hidl跟库都加上了还是没有gps

需要cat /dev/ttyS6(这里填你的GPS串口)看下,不管有没有加HIDL,GPS模块都有输出数据的,没有的话一般是电源没有给上

测试

百度下一个GPS TEST,看有没有GPS信号,一般坐标直接定位你在的地方
在这里插入图片描述

gnss库的打印很多,不用的话在源码里加上
#define LOG_NDEBUG 0

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值