rendered paste bodyIndex: n_tihtc.c
===================================================================
RCS file: /cvs/linux/kernel26/drivers/char/n_tihtc.c,v
retrieving revision 1.1
diff -u -r1.1 n_tihtc.c
--- n_tihtc.c 29 Mar 2007 14:13:37 -0000 1.1
+++ n_tihtc.c 26 Feb 2008 20:37:28 -0000
@@ -204,6 +204,7 @@
struct tihtc_buf *rx_out = NULL;
char *dst;
int i, j = 0;
+ static bool bEOF;
DBG("tihtc_filter called\n");
@@ -218,6 +219,7 @@
}
n_tihtc->open_frame = *src++;
DBG("starting frame (channel 0x%x) at %d\n", n_tihtc->open_frame, j++);
+ bEOF = false;
if (src >= end)
goto src_end;
} else
@@ -254,9 +256,28 @@
rx_out->count = 0; i = 0;
dst = rx_out->buf;
}
- *dst = *src;
- dst++; i++;
- src++;
+ // End Of Line detected ?
+ printk(KERN_DEBUG "Incomming (0x%x)\n",*src);
+ if ((*src==0xd) && (!bEOF)){
+ bEOF=true;
+ printk(KERN_DEBUG "EOF with 0xd detected\n");
+ }
+ if (bEOF){
+ if (*src==0xd) {
+ printk(KERN_DEBUG "Skip incoming characters\n");
+ src++;
+ } else {
+ printk(KERN_DEBUG "end of skip characters\n");
+ bEOF=false;
+ }
+ }
+ if (!bEOF) {
+ //if (*src==0xa)
+ // *src=0xd;
+ *dst = *src;
+ dst++; i++;
+ src++;
+ }
}
rx_out->count = i;
n_tihtc->open_frame = 0;
@@ -400,6 +421,8 @@
}
count = min(rx->count, (int)nr);
+
+
/* Copy the data to the caller's buffer */
if (copy_to_user(buf, rx->buf, rx->count))
ret = -EFAULT;