summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/comm
diff options
context:
space:
mode:
authorHarald Welte2010-03-27 05:22:21 +0100
committerHarald Welte2010-03-27 05:24:29 +0100
commitc9c4c4b819ccd85b343a1c9bdc1ef8085f801345 (patch)
tree6317c2c33a608335027870c4519cd246e52f26ce /src/target/firmware/comm
parentsercomm: Fix ESCAPE'd character at end of buffer (diff)
downloadosmocom-c9c4c4b819ccd85b343a1c9bdc1ef8085f801345.tar.gz
osmocom-c9c4c4b819ccd85b343a1c9bdc1ef8085f801345.tar.xz
osmocom-c9c4c4b819ccd85b343a1c9bdc1ef8085f801345.zip
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.
Diffstat (limited to 'src/target/firmware/comm')
-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 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 */