Skip to content

Commit a9352e9

Browse files
Deomid Ryabkovcesantabot
authored andcommitted
Do not send EOL after +++, hang up first
In case of an existing PPP session, issuing ATH first seems to lead to more reliable results. Fixes #1 PUBLISHED_FROM=da1cfd6074934ad433edc826c99971248df017e2
1 parent 363167e commit a9352e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mgos_pppos.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static SLIST_HEAD(s_pds, mgos_pppos_data) s_pds = SLIST_HEAD_INITIALIZER(s_pds);
5757
static void mgos_pppos_at_cmd(int uart_no, const char *cmd) {
5858
LOG(LL_DEBUG, (">> %s", cmd));
5959
mgos_uart_write(uart_no, cmd, strlen(cmd));
60-
mgos_uart_write(uart_no, "\r\n", 2);
60+
if (strcmp(cmd, "+++") != 0) mgos_uart_write(uart_no, "\r\n", 2);
6161
}
6262

6363
static void mgos_pppos_set_state(struct mgos_pppos_data *pd,
@@ -133,9 +133,9 @@ static void prepare_cmds(struct mgos_pppos_data *pd) {
133133
free_cmds(pd);
134134
pd->cmds = (char **) calloc(10, sizeof(char *));
135135
int n = 0;
136+
mg_asprintf(&pd->cmds[n++], 0, "ATH");
136137
mg_asprintf(&pd->cmds[n++], 0, "ATZ");
137138
mg_asprintf(&pd->cmds[n++], 0, "ATE0");
138-
mg_asprintf(&pd->cmds[n++], 0, "ATH");
139139
mg_asprintf(&pd->cmds[n++], 0, "ATI");
140140
if (pd->cfg.apn != NULL) {
141141
mg_asprintf(&pd->cmds[n++], 0, "AT+CGDCONT=1,\"IP\",\"%s\"", pd->cfg.apn);

0 commit comments

Comments
 (0)