diff options
author | Ashish Dhiman <dhiman@codeaurora.org> | 2019-01-28 12:48:11 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-09-19 03:28:41 -0700 |
commit | 4d2c7279b56707b08eb67236f7a0e9c85fcbac47 (patch) | |
tree | 26530412036a4d54862418734b9a903f2a78717c /utils/loc_target.cpp | |
parent | 704ec016f51e56109069157eabe9eedfcaf9fc10 (diff) | |
download | gps-4d2c7279b56707b08eb67236f7a0e9c85fcbac47.tar.gz |
Add API to read the device SOC ID.
CRs-Fixed: 2385448
Change-Id: Ia154c908e610e2e475171d9a45822bae84210d5b
Diffstat (limited to 'utils/loc_target.cpp')
-rw-r--r-- | utils/loc_target.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index f6fd728..a286fe1 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -208,3 +208,24 @@ detected: LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } + +int loc_read_device_soc_id() +{ + char buf[10] = {0}; + int soc_id = 0; + int fd = open("/sys/devices/soc0/soc_id", O_RDONLY); + if (fd >= 0) + { + if (read(fd, buf, sizeof(buf) - 1) == -1) + { + LOC_LOGI ("%s: unable to read soc_id", __FUNCTION__); + } + else + { + soc_id = atoi(buf); + LOC_LOGI ("%s: Soc ID :%d", __FUNCTION__, soc_id); + } + close(fd); + } + return soc_id; +} |