sercomm: ESCAPE every NUL (0x00) byte in the data stream

For some reason, at least on the C123, a sequence of multiple NUL bytes
seems to get corrupted somewhere in the Rx side on the phone itself (the
NUL plus the following character get dropped).

We now simply work around this issue by having our sercomm/HDLC layer
escape all NUL octets in the stream.
This commit is contained in:
Harald Welte 2010-03-27 12:22:21 +08:00
parent bbe405b7fe
commit c9c4c4b819
1 changed files with 2 additions and 1 deletions

View File

@ -169,7 +169,8 @@ int sercomm_drv_pull(uint8_t *ch)
sercomm.tx.next_char = NULL;
/* escaping for the two control octets */
} else if (*sercomm.tx.next_char == HDLC_FLAG ||
*sercomm.tx.next_char == HDLC_ESCAPE) {
*sercomm.tx.next_char == HDLC_ESCAPE ||
*sercomm.tx.next_char == 0x00) {
/* send an escape octet */
*ch = HDLC_ESCAPE;
/* invert bit 5 of the next octet to be sent */