Merge "[Feature][S300AI][task-view-1832][at] add AT+GPIO_IN=<n>"
diff --git a/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c b/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
index d1ad5bb..1219e0d 100755
--- a/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
+++ b/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
@@ -922,6 +922,41 @@
return AT_END;
}
+int ext_at_gpio_in_func(char *at_paras, void ** res_msg)
+{
+ if(at_paras && strlen(at_paras) > 0 && strlen(at_paras) < 5)
+ {
+ int gpio_num = 0;
+ char cmd[128] = {0};
+ char gpio_dir[12] = {0};
+ char *at_str = malloc(64);
+
+ gpio_num = atoi(at_paras);
+ snprintf(cmd, sizeof(cmd), "echo \"%d\" > /sys/class/gpio/export", gpio_num);
+ system(cmd);
+ snprintf(cmd, sizeof(cmd), "echo in > /sys/class/gpio/gpio%d/direction", gpio_num);
+ system(cmd);
+
+ snprintf(cmd, sizeof(cmd), "grep \"GPIO%d_\" /sys/kernel/debug/zx29_gpio | awk '{print $2}'", gpio_num);
+ executeCommand(cmd, gpio_dir, sizeof(gpio_dir));
+
+ if(strlen(gpio_dir) > 0)
+ {
+ sprintf(at_str, "\r\n+GPIO%d: %s\r\nOK\r\n", gpio_num, gpio_dir);
+ }
+ else
+ {
+ sprintf(at_str, "\r\n+GPIO%d: NO SUCH GPIO\r\nERROR\r\n", gpio_num);
+ }
+
+ *res_msg = at_str;
+ return AT_END;
+ }
+
+ *res_msg = at_err_build(ATERR_PARAM_INVALID);
+ return AT_END;
+}
+
static int extract_ss_data(const char *filename, int *avg_num1, int *avg_num2)
{
FILE *file = popen(filename, "r");
@@ -1067,6 +1102,7 @@
register_serv_func("LAN_IP?", 0, ext_at_lan_ip_func);
register_serv_func("ATV_GPIO?", 0, ext_at_atv_gpio_func);
register_serv_func("GPIO=", 0, ext_at_gpio_func);
+ register_serv_func("GPIO_IN=", 0, ext_at_gpio_in_func);
register_serv_func("WLAN_SS", 0, ext_at_wlan_ss_func);
register_serv_func("FMTEST=", 0, ext_at_delay_shut_down_func);
register_serv_func("BATTERY_VOICE=", 0, ext_at_battery_voice_voltage_func);