summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Fennema <fennema@google.com>2017-08-31 19:11:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-08-31 19:11:04 +0000
commitf55cb825ac2cab6ba5218b9a05bb0cac2c664a1a (patch)
tree0da554f59cd89996d7c062776ee1a6805c0e3bd2
parentacbd87754cb932eef21f660feaa88aa612e0699e (diff)
parentf856f16cfc437b829e112fd9b9dcd93b8029c379 (diff)
downloadcontexthub-f55cb825ac2cab6ba5218b9a05bb0cac2c664a1a.tar.gz
Merge "nanohub: only return external apps from NANOHUB_HAL_QUERY_APPS" into oc-mr1-dev
-rw-r--r--firmware/os/core/nanohubCommand.c2
-rw-r--r--firmware/os/core/seos.c22
-rw-r--r--firmware/os/inc/seos.h1
3 files changed, 24 insertions, 1 deletions
diff --git a/firmware/os/core/nanohubCommand.c b/firmware/os/core/nanohubCommand.c
index 439f3dc6..79d8804f 100644
--- a/firmware/os/core/nanohubCommand.c
+++ b/firmware/os/core/nanohubCommand.c
@@ -1078,7 +1078,7 @@ static void halQueryApps(void *rx, uint8_t rx_len)
uint64_t appId;
uint32_t appVer, appSize;
- if (osAppInfoByIndex(le32toh(req->idx), &appId, &appVer, &appSize)) {
+ if (osExtAppInfoByIndex(le32toh(req->idx), &appId, &appVer, &appSize)) {
resp = heapAlloc(sizeof(*resp));
if (resp) {
resp->hdr.appId = APP_ID_MAKE(NANOHUB_VENDOR_GOOGLE, 0);
diff --git a/firmware/os/core/seos.c b/firmware/os/core/seos.c
index f220dc37..52ccf7a9 100644
--- a/firmware/os/core/seos.c
+++ b/firmware/os/core/seos.c
@@ -1360,6 +1360,28 @@ bool osAppInfoByIndex(uint32_t appIdx, uint64_t *appId, uint32_t *appVer, uint32
return false;
}
+bool osExtAppInfoByIndex(uint32_t appIdx, uint64_t *appId, uint32_t *appVer, uint32_t *appSize)
+{
+ struct Task *task;
+ int i = 0;
+
+ for_each_task(&mTasks, task) {
+ const struct AppHdr *app = task->app;
+ if (!(app->hdr.fwFlags & FL_APP_HDR_INTERNAL)) {
+ if (i != appIdx) {
+ ++i;
+ } else {
+ *appId = app->hdr.appId;
+ *appVer = app->hdr.appVer;
+ *appSize = app->sect.rel_end;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
void osLogv(char clevel, uint32_t flags, const char *str, va_list vl)
{
void *userData = platLogAllocUserData();
diff --git a/firmware/os/inc/seos.h b/firmware/os/inc/seos.h
index 7979d762..5f3e60f8 100644
--- a/firmware/os/inc/seos.h
+++ b/firmware/os/inc/seos.h
@@ -174,6 +174,7 @@ bool osDefer(OsDeferCbkF callback, void *cookie, bool urgent);
bool osTidById(uint64_t *appId, uint32_t *tid);
bool osAppInfoById(uint64_t appId, uint32_t *appIdx, uint32_t *appVer, uint32_t *appSize);
bool osAppInfoByIndex(uint32_t appIdx, uint64_t *appId, uint32_t *appVer, uint32_t *appSize);
+bool osExtAppInfoByIndex(uint32_t appIdx, uint64_t *appId, uint32_t *appVer, uint32_t *appSize);
uint32_t osGetCurrentTid();
uint32_t osSetCurrentTid(uint32_t);