Merge "[BugFix][Bug-90676][GSW][data]设置apn参数时填写usr和pwd参数会导致api卡住" into mbtk_source_v2
diff --git a/mbtk/include/mbtk/mbtk_sleep.h b/mbtk/include/mbtk/mbtk_sleep.h
index f36a6bf..4e8b71f 100755
--- a/mbtk/include/mbtk/mbtk_sleep.h
+++ b/mbtk/include/mbtk/mbtk_sleep.h
@@ -33,18 +33,23 @@
 #include <linux/input.h>
 
 #include "mbtk_type.h"
-// #include "mbtk_info_api.h"
-
 
 /*************************************************************
     Constants and Macros
 *************************************************************/
 typedef void (*mbtk_sleep_callback_func)(const void* data, int data_len);
 
+#define LOCK_MAX_SIZE       129
+#define EPOLL_SIZE_HINT     128
 
-// static bool autosleep_enable = FALSE;
+/*
+This module is system sleep, the system cannot sleep when the lock exists
+To verify whether it is in sleep state, it is necessary to test the power consumption
+Power management principle, as long as a wakelock lock exists, the system will not enter the Suspend state
+So the name can be arbitrarily chosen to indicate that such a lock is needed so that the system does not sleep
+*/
+#define MTBK_POWERIND           "/system/etc/powerind"      //1806
 
-#define LOCK_MAX_SIZE 129
 
 /*************************************************************
     Definitions:enum,struct,union,class
@@ -65,6 +70,7 @@
 /*************************************************************
     Public Function Declaration
 *************************************************************/
+int mbtk_powerrind_get();
 int mbtk_autosuspend_enable(char enable);
 int mbtk_wakelock_create(const char* name , size_t len);
 int mbtk_wakelock_lock(int fd);
diff --git a/mbtk/include/mbtk/mbtk_wifi_ap.h b/mbtk/include/mbtk/mbtk_wifi_ap.h
index da0e43c..8b89613 100644
--- a/mbtk/include/mbtk/mbtk_wifi_ap.h
+++ b/mbtk/include/mbtk/mbtk_wifi_ap.h
@@ -9,6 +9,10 @@
 #define SETTING_KEY_MAX_LEN		64				

 #define SETTING_VALUE_MAX_LEN		190 

 #define SETTING_SPLIT_CHAR		'='	

+#define ACL_DENY_FILE "/etc/wifi/hostapd.deny"

+#define ACL_ACCEPT_FILE "/etc/wifi/hostapd.accept"

+

+

 

 

 

@@ -16,5 +20,9 @@
 int mbtk_wifi_set_setting(const char *path, const char *key, const char *value);

 int mbtk_wifi_ap_start(void);

 int mbtk_wifi_ap_stop(void);

+int mbtk_wifi_set_file(const char *path, const char *value);

+int mbtk_wifi_get_file(const char *path, char *value, int value_max_len);

+

+

 

 

diff --git a/mbtk/libmbtk_lib/sleep/mbtk_sleep.c b/mbtk/libmbtk_lib/sleep/mbtk_sleep.c
old mode 100644
new mode 100755
index ab25410..c861a5a
--- a/mbtk/libmbtk_lib/sleep/mbtk_sleep.c
+++ b/mbtk/libmbtk_lib/sleep/mbtk_sleep.c
@@ -2,8 +2,6 @@
 #include <sys/epoll.h>
 #include <sys/timerfd.h>
 
-
-
 #include "mbtk_sleep.h"
 #include "mbtk_log.h"
 #include "mbtk_utils.h"
@@ -12,13 +10,27 @@
 
 static mbtk_lock_name_s mbtk_lock_name[LOCK_MAX_SIZE]={0};
 
-#define EPOLL_SIZE_HINT    128
 int g_mEpollFd = -1;
 mbtk_sleep_callback_func g_sleep_timer_cb;
 int g_sleep_timer_fd = 0;
 pthread_t g_timer_thread_id;
 
+int mbtk_powerrind_get()
+{
+    char buffer[4];
+    int ret = 0;
 
+    int fd = open(MTBK_POWERIND, O_RDWR | O_SYNC, 0662);
+    if (fd != -1)
+    {
+        mbtk_read(fd, buffer, strlen(buffer)+1);
+        close(fd);
+    }
+
+    ret = atoi(buffer);
+
+    return ret;
+}
 
 
 int mbtk_autosuspend_enable(char enable)
diff --git a/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c b/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c
index 6cd1463..74e1c16 100644
--- a/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c
+++ b/mbtk/libmbtk_lib/wifi/mbtk_wifi_ap.c
@@ -252,4 +252,43 @@
 

 }

 

+int mbtk_wifi_set_file(const char *path, const char *value)

+{

+    FILE *file;

+    

+    file = fopen(path, "w");

+    if (!file) 

+    {

+        return -1;

+    }

+

+    fputs(value, file);

+

+

+    fclose(file);

+    return 0;

+}

+

+int mbtk_wifi_get_file(const char *path, char *value, int value_max_len)

+{

+    FILE *file;

+    

+    file = fopen(path, "r");

+    if (!file) 

+    {

+        return -1;

+    }

+

+    if(NULL == fgets(value, value_max_len, file))

+    {

+        fclose(file);

+        return -1;

+    }

+

+

+    fclose(file);

+    return 0;

+}

+

+