hdlcsync: Suppress 0x55 and 0xAA and duplicate Flag
This commit is contained in:
parent
c8441065cd
commit
ef8d16bcb3
|
@ -102,13 +102,21 @@ static int process_raw_hdlc(struct hdlc_proc *hdlc, uint8_t *data, unsigned int
|
|||
{
|
||||
unsigned int i;
|
||||
int out;
|
||||
static int last_out;
|
||||
|
||||
for (i = 0; i < len; i ++) {
|
||||
out = process_hdlc_bit(hdlc, data[i]);
|
||||
if (out == -123)
|
||||
printf("F ");
|
||||
else if (out >= 0)
|
||||
if (out == -123) {
|
||||
/* suppress repeating Flag characters */
|
||||
if (last_out != out)
|
||||
printf("\nF ");
|
||||
last_out = out;
|
||||
} else if (out >= 0) {
|
||||
/* suppress 0xAA and 0x55 bit pattern */
|
||||
if (out != 0xaa && out != 0x55)
|
||||
printf("%02x ", out);
|
||||
last_out = out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue