Explorar el Código

[fix] support cmux function.

Signed-off-by: liuxinaliang <liuxianliang@rt-thread.com>
liuxinaliang hace 5 años
padre
commit
8f9d6fc385
Se han modificado 2 ficheros con 22 adiciones y 1 borrados
  1. 11 1
      class/ppp_device_air720.c
  2. 11 0
      class/ppp_device_sim800.c

+ 11 - 1
class/ppp_device_air720.c

@@ -26,9 +26,9 @@
 #ifndef AIR720_POWER_PIN
 #define AIR720_POWER_PIN -1
 #endif
-
 #define AIR720_WARTING_TIME_BASE 2000
 
+#ifndef PKG_USING_CMUX
 static const struct modem_chat_data rst_mcd[] =
 {
     {"+++",          MODEM_CHAT_RESP_NOT_NEED,        30, 1, RT_TRUE},
@@ -42,9 +42,18 @@ static const struct modem_chat_data mcd[] =
     {PPP_APN_CMD,    MODEM_CHAT_RESP_OK,              1,  5, RT_FALSE},
     {PPP_DAIL_CMD,   MODEM_CHAT_RESP_CONNECT,         1, 30, RT_FALSE},
 };
+#else
+static const struct modem_chat_data mcd[] =
+{
+    {"AT",           MODEM_CHAT_RESP_NOT_NEED,        10, 1, RT_FALSE},
+    {PPP_APN_CMD,    MODEM_CHAT_RESP_NOT_NEED,        1,  5, RT_FALSE},
+    {PPP_DAIL_CMD,   MODEM_CHAT_RESP_NOT_NEED,        1, 30, RT_FALSE},
+};
+#endif
 
 static rt_err_t ppp_air720_prepare(struct ppp_device *device)
 {
+#ifndef PKG_USING_CMUX
     if (device->power_pin >= 0)
     {
         rt_pin_write(device->power_pin, AIR720_POWER_OFF);
@@ -59,6 +68,7 @@ static rt_err_t ppp_air720_prepare(struct ppp_device *device)
         if (err)
             return err;
     }
+#endif
     return modem_chat(device->uart, mcd, sizeof(mcd) / sizeof(mcd[0]));
 }
 

+ 11 - 0
class/ppp_device_sim800.c

@@ -29,6 +29,7 @@
 
 #define SIM800_WARTING_TIME_BASE 500
 
+#ifndef PKG_USING_CMUX
 static const struct modem_chat_data rst_mcd[] =
 {
     {"+++",          MODEM_CHAT_RESP_NOT_NEED,        30, 1, RT_TRUE},
@@ -42,9 +43,18 @@ static const struct modem_chat_data mcd[] =
     {PPP_APN_CMD,    MODEM_CHAT_RESP_OK,              1,  5, RT_FALSE},
     {PPP_DAIL_CMD,   MODEM_CHAT_RESP_CONNECT,         1, 30, RT_FALSE},
 };
+#else
+static const struct modem_chat_data mcd[] =
+{
+    {"AT",           MODEM_CHAT_RESP_NOT_NEED,        10, 1, RT_FALSE},
+    {PPP_APN_CMD,    MODEM_CHAT_RESP_NOT_NEED,        1,  5, RT_FALSE},
+    {PPP_DAIL_CMD,   MODEM_CHAT_RESP_NOT_NEED,        1, 30, RT_FALSE},
+};
+#endif
 
 static rt_err_t ppp_sim800_prepare(struct ppp_device *device)
 {
+#ifndef PKG_USING_CMUX
     if (device->power_pin >= 0)
     {
         rt_pin_write(device->power_pin, SIM800_POWER_OFF);
@@ -58,6 +68,7 @@ static rt_err_t ppp_sim800_prepare(struct ppp_device *device)
         if (err)
             return err;
     }
+#endif
     return modem_chat(device->uart, mcd, sizeof(mcd) / sizeof(mcd[0]));
 }