Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ca805dd authored by bohu's avatar bohu Committed by Automerger Merge Worker
Browse files

gnss: allows custom gnss device name am: f001b128

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/13972721

Change-Id: Ieebe988b0e995543fffd8215636d73a54889e6b0
parents e26e00f9 f001b128
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ cc_binary {
        "service.cpp",
    ],
    shared_libs: [
        "libcutils",
        "libhidlbase",
        "libutils",
        "liblog",
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ cc_binary {
    ],
    shared_libs: [
        "libbase",
        "libcutils",
        "libbinder_ndk",
        "libhidlbase",
        "libutils",
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ cc_library_static {
    ],
    export_include_dirs: ["include"],
    shared_libs: [
        "libcutils",
        "libhidlbase",
        "libutils",
        "android.hardware.gnss@1.0",
+12 −2
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#include <string>
#include <thread>

#include <cutils/properties.h>

#include "GnssAntennaInfo.h"
#include "GnssConfiguration.h"
#include "GnssDebug.h"
@@ -157,9 +159,17 @@ template <class T_IGnss>
std::unique_ptr<V2_0::GnssLocation> GnssTemplate<T_IGnss>::getLocationFromHW() {
    char inputBuffer[INPUT_BUFFER_SIZE];
    if (!mHardwareModeChecked) {
        mGnssFd = open(GNSS_PATH, O_RDWR | O_NONBLOCK);
        // default using gnss0
        const char * gnss_dev_path = GNSS_PATH;
        char devname_value[PROPERTY_VALUE_MAX] = "";
        if (property_get("debug.location.gnss.devname", devname_value, NULL) > 0) {
            gnss_dev_path = devname_value;
            ALOGD("using %s instead of the default %s", gnss_dev_path, GNSS_PATH);
        }

        mGnssFd = open(gnss_dev_path, O_RDWR | O_NONBLOCK);
        if (mGnssFd == -1) {
            ALOGW("Failed to open /dev/gnss0 errno: %d", errno);
            ALOGW("Failed to open %s errno: %d", gnss_dev_path, errno);
        }
        mHardwareModeChecked = true;
    }