]> rtime.felk.cvut.cz Git - linux-lin.git/blobdiff - sllin/sllin.c
sllin: Commented out unused code.
[linux-lin.git] / sllin / sllin.c
index a0bb1e513b92c4a400f7c88732b61841531adfba..97371523045bbad99024dbb83ac5eed01ceecf05 100644 (file)
@@ -147,9 +147,15 @@ static int sltty_change_speed(struct tty_struct *tty, unsigned speed)
        int cflag;
 
        mutex_lock(&tty->termios_mutex);
+
        old_termios = *(tty->termios);
        cflag = tty->termios->c_cflag;
+       cflag &= ~(CBAUD | CIBAUD);
+       cflag |= BOTHER;
+       tty->termios->c_cflag = cflag;
+
        tty_encode_baud_rate(tty, speed, speed);
+
        if (tty->ops->set_termios)
                tty->ops->set_termios(tty, &old_termios);
        //priv->io.speed = speed;
@@ -233,49 +239,49 @@ static void sll_bump(struct sllin *sl)
 /* Convert particular CAN frame into LIN frame and send it to TTY queue. */
 static void sll_encaps(struct sllin *sl, struct can_frame *cf)
 {
-       int actual, idx, i;
-       char lframe[16] = {0x00, 0x55}; /* Fake break, Sync byte */
-       struct tty_struct *tty = sl->tty;
-
-       pr_debug("sllin: %s() invoked\n", __FUNCTION__);
-
-       /* We do care only about SFF frames */
-       if (cf->can_id & CAN_EFF_FLAG)
-               return;
-
-       /* Send only header */
-       if (cf->can_id & CAN_RTR_FLAG) {
-               pr_debug("sllin: %s() RTR CAN frame\n", __FUNCTION__);
-               lframe[2] = (u8)cf->can_id; /* Get one byte LIN ID */
-
-               sltty_change_speed(tty, sl->lin_baud / 2);
-               tty->ops->write(tty, &lframe[0], 1);
-               sltty_change_speed(tty, sl->lin_baud);
-               tty->ops->write(tty, &lframe[1], 1);
-               tty->ops->write(tty, &lframe[2], 1);
-       } else {
-               pr_debug("sllin: %s() non-RTR CAN frame\n", __FUNCTION__);
-               /*      idx = strlen(sl->xbuff);
-
-                       for (i = 0; i < cf->can_dlc; i++)
-                       sprintf(&sl->xbuff[idx + 2*i], "%02X", cf->data[i]);
-
-                * Order of next two lines is *very* important.
-                * When we are sending a little amount of data,
-                * the transfer may be completed inside the ops->write()
-                * routine, because it's running with interrupts enabled.
-                * In this case we *never* got WRITE_WAKEUP event,
-                * if we did not request it before write operation.
-                *       14 Oct 1994  Dmitry Gorodchanin.
-
-                set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
-                actual = sl->tty->ops->write(sl->tty, sl->xbuff, strlen(sl->xbuff));
-                sl->xleft = strlen(sl->xbuff) - actual;
-                sl->xhead = sl->xbuff + actual;
-                sl->dev->stats.tx_bytes += cf->can_dlc;
-                */
-       }
-
+//     int actual, idx, i;
+//     char lframe[16] = {0x00, 0x55}; /* Fake break, Sync byte */
+//     struct tty_struct *tty = sl->tty;
+//
+//     pr_debug("sllin: %s() invoked\n", __FUNCTION__);
+//
+//     /* We do care only about SFF frames */
+//     if (cf->can_id & CAN_EFF_FLAG)
+//             return;
+//
+//     /* Send only header */
+//     if (cf->can_id & CAN_RTR_FLAG) {
+//             pr_debug("sllin: %s() RTR CAN frame\n", __FUNCTION__);
+//             lframe[2] = (u8)cf->can_id; /* Get one byte LIN ID */
+//
+//             sltty_change_speed(tty, sl->lin_baud * 2 / 3);
+//             tty->ops->write(tty, &lframe[0], 1);
+//             sltty_change_speed(tty, sl->lin_baud);
+//             tty->ops->write(tty, &lframe[1], 1);
+//             tty->ops->write(tty, &lframe[2], 1);
+//     } else {
+//             pr_debug("sllin: %s() non-RTR CAN frame\n", __FUNCTION__);
+//             /*      idx = strlen(sl->xbuff);
+//
+//                     for (i = 0; i < cf->can_dlc; i++)
+//                     sprintf(&sl->xbuff[idx + 2*i], "%02X", cf->data[i]);
+//
+//              * Order of next two lines is *very* important.
+//              * When we are sending a little amount of data,
+//              * the transfer may be completed inside the ops->write()
+//              * routine, because it's running with interrupts enabled.
+//              * In this case we *never* got WRITE_WAKEUP event,
+//              * if we did not request it before write operation.
+//              *       14 Oct 1994  Dmitry Gorodchanin.
+//
+//              set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
+//              actual = sl->tty->ops->write(sl->tty, sl->xbuff, strlen(sl->xbuff));
+//              sl->xleft = strlen(sl->xbuff) - actual;
+//              sl->xhead = sl->xbuff + actual;
+//              sl->dev->stats.tx_bytes += cf->can_dlc;
+//              */
+//     }
+//
 }
 
 /*
@@ -440,6 +446,8 @@ static void sllin_receive_buf(struct tty_struct *tty,
                if (fp && *fp++) {
                        if (!test_and_set_bit(SLF_ERROR, &sl->flags))
                                sl->dev->stats.rx_errors++;
+                       printk(KERN_INFO "sllin_receive_buf char 0x%02x ignored due marker 0x%02x, flags 0x%lx\n",
+                               *cp, *(fp-1), sl->flags);
                        cp++;
                        continue;
                }