diff options
author | Karsten Keil <keil@b1-systems.de> | 2009-07-08 14:58:33 -0400 |
---|---|---|
committer | Karsten Keil <keil@b1-systems.de> | 2009-07-25 14:16:17 -0400 |
commit | f3fad223ed69f406f33c9619c256858d5a5fc5c7 (patch) | |
tree | 47987e6358d83c3f01ae500abffd1e869a577a2c /drivers | |
parent | c38fc3bc2ecddd4f5278131603e6964cbed071b2 (diff) |
ISDN: Fix isdnhdlc for one byte hdlc packets
Normally HDLC packets contain more as one byte (e.g a X25/X75 header).
But if you use plain HDLC framing, the current code do not encode
1 byte payloads, this patch fix that.
Signed-off-by: Karsten Keil <keil@b1-systems.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/i4l/isdnhdlc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/isdn/i4l/isdnhdlc.c b/drivers/isdn/i4l/isdnhdlc.c index df345ce73f48..c989aa35dc2f 100644 --- a/drivers/isdn/i4l/isdnhdlc.c +++ b/drivers/isdn/i4l/isdnhdlc.c | |||
@@ -47,7 +47,7 @@ enum { | |||
47 | HDLC_SEND_DATA, HDLC_SEND_CRC1, HDLC_SEND_FAST_FLAG, | 47 | HDLC_SEND_DATA, HDLC_SEND_CRC1, HDLC_SEND_FAST_FLAG, |
48 | HDLC_SEND_FIRST_FLAG, HDLC_SEND_CRC2, HDLC_SEND_CLOSING_FLAG, | 48 | HDLC_SEND_FIRST_FLAG, HDLC_SEND_CRC2, HDLC_SEND_CLOSING_FLAG, |
49 | HDLC_SEND_IDLE1, HDLC_SEND_FAST_IDLE, HDLC_SENDFLAG_B0, | 49 | HDLC_SEND_IDLE1, HDLC_SEND_FAST_IDLE, HDLC_SENDFLAG_B0, |
50 | HDLC_SENDFLAG_B1A6, HDLC_SENDFLAG_B7, STOPPED | 50 | HDLC_SENDFLAG_B1A6, HDLC_SENDFLAG_B7, STOPPED, HDLC_SENDFLAG_ONE |
51 | }; | 51 | }; |
52 | 52 | ||
53 | void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features) | 53 | void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features) |
@@ -362,6 +362,9 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen, | |||
362 | 362 | ||
363 | *count = slen; | 363 | *count = slen; |
364 | 364 | ||
365 | /* special handling for one byte frames */ | ||
366 | if ((slen == 1) && (hdlc->state == HDLC_SEND_FAST_FLAG)) | ||
367 | hdlc->state = HDLC_SENDFLAG_ONE; | ||
365 | while (dsize > 0) { | 368 | while (dsize > 0) { |
366 | if (hdlc->bit_shift == 0) { | 369 | if (hdlc->bit_shift == 0) { |
367 | if (slen && !hdlc->do_closing) { | 370 | if (slen && !hdlc->do_closing) { |
@@ -407,6 +410,8 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen, | |||
407 | dsize--; | 410 | dsize--; |
408 | break; | 411 | break; |
409 | } | 412 | } |
413 | /* fall through */ | ||
414 | case HDLC_SENDFLAG_ONE: | ||
410 | if (hdlc->bit_shift == 8) { | 415 | if (hdlc->bit_shift == 8) { |
411 | hdlc->cbin = hdlc->ffvalue >> | 416 | hdlc->cbin = hdlc->ffvalue >> |
412 | (8 - hdlc->data_bits); | 417 | (8 - hdlc->data_bits); |