Hi,
I am building a Car kit by using android automotive overlay from AOSP master branch.
I want to try if google map can work with a GPS receiver.
So I bought a GPS receiver (BU-353S4) , but I have no idea how to configure it.
I install an app named GPS status to get the status of GPS, and it says GPS is not present in this device.
Can anyone help me?
Thank you.
You need to implement or retrieve a gnss hardware module (libhardware/include/hardware/gps.h) which will be used by the GNSS HAL (hardware/interfaces/gnss/1.0/default) to interface your hardware with upper android layers. There are several example/implementation you can find on the web (gps-glonass-android-driver, android-serial-gps-driver), I assume your GPS exposes a serial interface.
An other solution is to implement a Mock Location Provider Application, retrieving data from your GPS and injecting the position to the provider.
So I have to implement it myself or porting the example?
Thank you for replying.
Up to you, you can try porting the android-serial-gps-driver which seems pretty simple.
Another question is that google map can use wifi to find my location, right?
I have installed google map, and enable the high accuracy mode option in settings, but google map canāt find where I am. How should I do to get it to work?
In high accuracy mode maps expects all loaction providers, gps, cellular, gpsā¦ I think gnss service crash because gps hw module is not present. Did you try with battery saving mode (wifi/cellular only)?
I have tried, the same result.
I have ported the android-serial-gps-driver to the system, how to check if it works correctly?
Maybe I should make clean and make again?
Thank you.
Check the android makefile:
- this request to define BOARD_HAS_GPS_HARDWARE := true (in hikey960/BoardConfig.mk)
- You need to select the module to make it build, module name is defined has
LOCAL_MODULE := gps.$(TARGET_PRODUCT)
So you need to add something like PRODUCT_PACKAGES += gps.hikey960 (in hikey960/device-hikey960.mk)
Iāve added simple serial GPS support to my device tree;
It seems to work, but is as bare bones as bare bones gets.
I got this error message:
And I trace the source code of gnss, it was failed to get the hal module
IGnss* HIDL_FETCH_IGnss(const char* /* hal */) {
hw_module_t* module;
IGnss* iface = nullptr;
int err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module
if (err == 0) {
hw_device_t* device;
err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device);
if (err == 0) {
iface = new Gnss(reinterpret_cast<gps_device_t*>(device));
} else {
ALOGE("gnssDevice open %s failed: %d", GPS_HARDWARE_MODULE_ID, err);
}
} else {
ALOGE("gnss hw_get_module %s failed: %d", GPS_HARDWARE_MODULE_ID, err);
}
return iface;
}
But the gps hal is existing,
Anything I did not notice?
Did you check you have this library at runtime under /system/lib64/hw ? with correct access rights ?
You can eventually had some debug into hw_get_module_by_class (hardware/libhardware/hardware.c).
I have only these files under /system/lib64/hw
Did you re-flash system partition ?
Yes, I re-flashed the system partition. Should I execute installer/hikey960/flash-all.sh to re-flash all partition?
I think you should try mounting the system.img locally to check content is correct:
$ simg2img system.img system.raw
$ mkdir mount
$ sudo mount -t ext4 -o loop system.raw ./mount
If not that means you did not build the system image correctly or did not added the gps module to the selected modules.
I have checked it. There are only those 4 .so files under system/lib64/hw .
I did āmake cleanā and āmakeā, so I think I built the system correctly.
I may miss some steps to add the gps module.
I copy source code of the gps module to my device tree.
Edit hikey960/BoardConfig.mk to add āBOARD_HAS_GPS_HARDWARE := trueā and edit hikey960/device-hikey960.mk to add:
I also edit ueventd.common.rc to add ā/dev/ttyUSB0 0660 gps systemā.
What else should I do?
I found the answer.
I have to change this line"LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw" into āLOCAL_MODULE_RELATIVE_PATH := hwā in android.mk of the gps module.
Itās loaded successfully.