Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/mbtk_utils/at.c b/mbtk/mbtk_utils/at.c
index 950d3e2..1e8f91b 100755
--- a/mbtk/mbtk_utils/at.c
+++ b/mbtk/mbtk_utils/at.c
@@ -11,9 +11,11 @@
#include <netinet/in.h>
#include <signal.h>
#include <unistd.h>
+#include <pthread.h>
#include <sys/select.h>
#include "mbtk_type.h"
+#include "mbtk_utils.h"
//#define AT_TYPE_SOCKET
#define MBTK_LOG
@@ -39,8 +41,8 @@
AT_MODE_DEV_2
} at_mode_enum;
-static int epoll_fd = -1;
-static struct epoll_event epoll_events[20];
+// static int epoll_fd = -1;
+// static struct epoll_event epoll_events[20];
static int at_fd = -1;
static at_mode_enum at_mode = AT_MODE_SOCK_1;
@@ -54,15 +56,16 @@
"NO DIALTONE",
NULL};
-//#ifdef AT_TYPE_SOCKET
+#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(exp) ({ \
typeof (exp) _rc; \
do { \
_rc = (exp); \
} while (_rc == -1 && errno == EINTR); \
_rc; })
-//#endif
+#endif
+#if 0
static void at_epoll_change(int is_add,int fd)
{
struct epoll_event ev;
@@ -95,6 +98,7 @@
return 0;
}
+#endif
//#ifdef AT_TYPE_SOCKET
int openSocket(const char* sockname)
@@ -349,7 +353,7 @@
pthread_attr_t attr;
pthread_attr_init (&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- int ret = pthread_create(&tid, &attr, read_thread_run, &attr);
+ int ret = pthread_create(&tid, &attr, read_thread_run, NULL);
if (ret < 0)
{
LOGE("pthread_create\n");
@@ -595,10 +599,10 @@
memset(write_buff, 0x0, 1024);
printf("%s\n", read_buff);
len = snprintf(write_buff, 1024, "%s\n", read_buff);
- write(at_fd, write_buff, len);
+ mbtk_write(at_fd, write_buff, len);
} else {
printf("Read error:%d\n",errno);
- return NULL;
+ return -1;
}
}
#endif
diff --git a/mbtk/mbtk_utils/device_info.c b/mbtk/mbtk_utils/device_info.c
index 6d22c34..864cb36 100755
--- a/mbtk/mbtk_utils/device_info.c
+++ b/mbtk/mbtk_utils/device_info.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include "mbtk_type.h"
#include "mbtk_device.h"
diff --git a/mbtk/mbtk_utils/mbtk_reboot.c b/mbtk/mbtk_utils/mbtk_reboot.c
index 3263d73..d839ae6 100755
--- a/mbtk/mbtk_utils/mbtk_reboot.c
+++ b/mbtk/mbtk_utils/mbtk_reboot.c
@@ -1,6 +1,8 @@
+#include <string.h>
#include "mbtk_type.h"
#include "mbtk_device.h"
-
+#include "mbtk_utils.h"
+#if 0
static char* band_2_str(mbtk_modem_band_area_enum band_area)
{
switch(band_area)
@@ -13,6 +15,7 @@
return "ALL";
}
}
+#endif
static void help()
{
@@ -22,7 +25,7 @@
int main(int argc, char *argv[])
{
if(argc == 1) {
- system("reboot -f");
+ mbtk_system("reboot -f");
} else if(argc == 2) {
if(strcmp(argv[1], "download")) {
help();
@@ -48,8 +51,8 @@
return -1;
}
- system("sync");
- system("reboot -f");
+ mbtk_system("sync");
+ mbtk_system("reboot -f");
return 0;
}