From 10647be5a0492b685b059a909b3970b584391e2a Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 11 Jun 2014 01:49:29 +0800 Subject: [PATCH] Fixed incorrect T.30 CTC messages. Fixed reseting of the CRC generator in the HDLC tx code --- libs/spandsp/src/hdlc.c | 5 ++++- libs/spandsp/src/t30.c | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/spandsp/src/hdlc.c b/libs/spandsp/src/hdlc.c index 74b2760e70..d96609b319 100644 --- a/libs/spandsp/src/hdlc.c +++ b/libs/spandsp/src/hdlc.c @@ -613,7 +613,10 @@ SPAN_DECLARE(int) hdlc_tx_restart(hdlc_tx_state_t *s) s->report_flag_underflow = false; s->len = 0; s->pos = 0; - s->crc = 0; + if (s->crc_bytes == 2) + s->crc = 0xFFFF; + else + s->crc = 0xFFFFFFFF; s->byte = 0; s->bits = 0; s->tx_end = false; diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index e7f958552c..ecf86efd53 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -3070,7 +3070,7 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len) int i; int j; int frame_no; - uint8_t frame[4]; + uint8_t frame[5]; if (len != 3 + 256/8) { @@ -3120,7 +3120,12 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len) s->ecm_progress = 0; queue_phase(s, T30_PHASE_D_TX); set_state(s, T30_STATE_IV_CTC); - send_simple_frame(s, T30_CTC); + frame[0] = ADDRESS_FIELD; + frame[1] = CONTROL_FIELD_FINAL_FRAME; + frame[2] = (uint8_t) (T30_CTC | s->dis_received); + frame[3] = 0; + frame[4] = fallback_sequence[s->current_fallback].dcs_code; + send_frame(s, frame, 5); } else {