summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-03-27 12:22:21 +0800
committerHarald Welte <laforge@gnumonks.org>2010-03-27 12:24:29 +0800
commitc9c4c4b819ccd85b343a1c9bdc1ef8085f801345 (patch)
tree6317c2c33a608335027870c4519cd246e52f26ce
parentbbe405b7fe3251978be30e81e068a9ad7376c92d (diff)
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.
-rw-r--r--src/target/firmware/comm/sercomm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/target/firmware/comm/sercomm.c b/src/target/firmware/comm/sercomm.c
index 2b3586e8..505de70b 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 */