From c9c4c4b819ccd85b343a1c9bdc1ef8085f801345 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 27 Mar 2010 12:22:21 +0800 Subject: [PATCH] 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. --- src/target/firmware/comm/sercomm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/target/firmware/comm/sercomm.c b/src/target/firmware/comm/sercomm.c index 2b3586e..505de70 100644 --- a/src/target/firmware/comm/sercomm.c +++ b/src/target/firmware/comm/sercomm.c @@ -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 */ -- 2.20.1