fix(esp_modem): CMUX to ignore MSC frames

Otherwise it gets confused with DISC frame and causes trouble when entering
CMUX mode (if device sends MSC requests)

Closes https://github.com/espressif/esp-protocols/issues/140
This commit is contained in:
David Cermak
2022-09-16 16:17:01 +02:00
parent 9d9d0db1ee
commit ce175df376

View File

@ -143,6 +143,10 @@ void CMux::data_available(uint8_t *data, size_t len)
#endif #endif
} }
} else if ((type&FT_UIH) == FT_UIH && dlci == 0) { // notify the internal DISC command } else if ((type&FT_UIH) == FT_UIH && dlci == 0) { // notify the internal DISC command
if (len > 0 && (data[0] & 0xE1) == 0xE1) {
// Not a DISC, ignore (MSC frame)
return;
}
Scoped<Lock> l(lock); Scoped<Lock> l(lock);
sabm_ack = dlci; sabm_ack = dlci;
} }
@ -385,6 +389,9 @@ bool CMux::init()
return false; return false;
} }
} }
if (i > 1) { // wait for each virtual terminal to settle MSC (no need for control term, DLCI=0)
usleep(100'000);
}
} }
return true; return true;
} }