Fix mbtk_gnssd setting.
Change-Id: I3fc4664ff357f869466ee5aaf1648658493c64c8
diff --git a/mbtk/test/others/mbtk_gnss_cli.c b/mbtk/test/others/mbtk_gnss_cli.c
index d830e0c..91c4e7c 100755
--- a/mbtk/test/others/mbtk_gnss_cli.c
+++ b/mbtk/test/others/mbtk_gnss_cli.c
@@ -33,13 +33,15 @@
typedef enum {
GNSS_CMD_INIT = 0,
- GNSS_CMD_DEINIT
+ GNSS_CMD_DEINIT,
+ GNSS_CMD_SETTING
} gnss_cmd_enum;
static void help()
{
- printf("gnss_cli gnss_init xxx\n");
+ printf("gnss_cli gnss_init <0-15>\n");
printf("gnss_cli gnss_deinit\n");
+ printf("gnss_cli gnss_setting cmd\n");
}
static int cmd_process(gnss_cmd_enum cmd, void *arg)
@@ -75,6 +77,8 @@
}
} else if(cmd == GNSS_CMD_DEINIT) {
sprintf(buff, "gnss_deinit");
+ } else if(cmd == GNSS_CMD_SETTING) {
+ sprintf(buff, "gnss_setting:%s", arg);
} else {
printf("Unknown cmd.\n");
return -1;
@@ -102,6 +106,13 @@
printf("gnss_deinit response error.\n");
return -1;
}
+ } else if(cmd == GNSS_CMD_SETTING) {
+ if(memcmp(buff, "gnss_setting", 12) == 0) {
+ return atoi(buff + 13);
+ } else {
+ printf("gnss_setting response error.\n");
+ return -1;
+ }
} else {
printf("Unknown response.\n");
return -1;
@@ -123,17 +134,21 @@
ret = cmd_process(GNSS_CMD_DEINIT, NULL);
} else if(argc == 3) {
- if(strcmp(argv[1], "gnss_init")) {
+ if(strcmp(argv[1], "gnss_init") == 0) {
+ ret = cmd_process(GNSS_CMD_INIT, argv[2]);
+ } else if(strcmp(argv[1], "gnss_setting") == 0) {
+ ret = cmd_process(GNSS_CMD_SETTING, argv[2]);
+ } else {
help();
return -1;
}
-
- ret = cmd_process(GNSS_CMD_INIT, argv[2]);
} else {
help();
return -1;
}
+ // printf("Error:%s\n", strerror(EBADF));
+
printf("Result : %d\n", ret);
return 0;
}