summaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l/isdnhdlc.c
diff options
context:
space:
mode:
authorKarsten Keil <keil@b1-systems.de>2009-07-08 20:58:33 +0200
committerKarsten Keil <keil@b1-systems.de>2009-07-25 20:16:17 +0200
commitf3fad223ed69f406f33c9619c256858d5a5fc5c7 (patch)
tree47987e6358d83c3f01ae500abffd1e869a577a2c /drivers/isdn/i4l/isdnhdlc.c
parentc38fc3bc2ecddd4f5278131603e6964cbed071b2 (diff)
downloadop-kernel-dev-f3fad223ed69f406f33c9619c256858d5a5fc5c7.zip
op-kernel-dev-f3fad223ed69f406f33c9619c256858d5a5fc5c7.tar.gz
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/isdn/i4l/isdnhdlc.c')
-rw-r--r--drivers/isdn/i4l/isdnhdlc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/isdn/i4l/isdnhdlc.c b/drivers/isdn/i4l/isdnhdlc.c
index df345ce..c989aa3 100644
--- a/drivers/isdn/i4l/isdnhdlc.c
+++ b/drivers/isdn/i4l/isdnhdlc.c
@@ -47,7 +47,7 @@ enum {
HDLC_SEND_DATA, HDLC_SEND_CRC1, HDLC_SEND_FAST_FLAG,
HDLC_SEND_FIRST_FLAG, HDLC_SEND_CRC2, HDLC_SEND_CLOSING_FLAG,
HDLC_SEND_IDLE1, HDLC_SEND_FAST_IDLE, HDLC_SENDFLAG_B0,
- HDLC_SENDFLAG_B1A6, HDLC_SENDFLAG_B7, STOPPED
+ HDLC_SENDFLAG_B1A6, HDLC_SENDFLAG_B7, STOPPED, HDLC_SENDFLAG_ONE
};
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,
*count = slen;
+ /* special handling for one byte frames */
+ if ((slen == 1) && (hdlc->state == HDLC_SEND_FAST_FLAG))
+ hdlc->state = HDLC_SENDFLAG_ONE;
while (dsize > 0) {
if (hdlc->bit_shift == 0) {
if (slen && !hdlc->do_closing) {
@@ -407,6 +410,8 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen,
dsize--;
break;
}
+ /* fall through */
+ case HDLC_SENDFLAG_ONE:
if (hdlc->bit_shift == 8) {
hdlc->cbin = hdlc->ffvalue >>
(8 - hdlc->data_bits);
OpenPOWER on IntegriCloud