38 #include <linux/tty.h> |
38 #include <linux/tty.h> |
39 #include <linux/tty_driver.h> |
39 #include <linux/tty_driver.h> |
40 #include <linux/tty_flip.h> |
40 #include <linux/tty_flip.h> |
41 #include <linux/termios.h> |
41 #include <linux/termios.h> |
42 #include <linux/timer.h> |
42 #include <linux/timer.h> |
|
43 #include <linux/version.h> |
43 |
44 |
44 #include "../master/globals.h" |
45 #include "../master/globals.h" |
45 #include "../include/ectty.h" |
46 #include "../include/ectty.h" |
46 |
47 |
47 /*****************************************************************************/ |
48 /*****************************************************************************/ |
377 return data_size; |
378 return data_size; |
378 } |
379 } |
379 |
380 |
380 /*****************************************************************************/ |
381 /*****************************************************************************/ |
381 |
382 |
|
383 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) |
|
384 static int ec_tty_put_char(struct tty_struct *tty, unsigned char ch) |
|
385 #else |
382 static void ec_tty_put_char(struct tty_struct *tty, unsigned char ch) |
386 static void ec_tty_put_char(struct tty_struct *tty, unsigned char ch) |
|
387 #endif |
383 { |
388 { |
384 ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
389 ec_tty_t *t = (ec_tty_t *) tty->driver_data; |
385 |
390 |
386 #if EC_TTY_DEBUG >= 1 |
391 #if EC_TTY_DEBUG >= 1 |
387 printk(KERN_INFO PFX "%s(): c=%02x.\n", __func__, (unsigned int) ch); |
392 printk(KERN_INFO PFX "%s(): c=%02x.\n", __func__, (unsigned int) ch); |
388 #endif |
393 #endif |
389 |
394 |
390 if (ec_tty_tx_space(t)) { |
395 if (ec_tty_tx_space(t)) { |
391 t->tx_buffer[t->tx_write_idx] = ch; |
396 t->tx_buffer[t->tx_write_idx] = ch; |
392 t->tx_write_idx = (t->tx_write_idx + 1) % EC_TTY_TX_BUFFER_SIZE; |
397 t->tx_write_idx = (t->tx_write_idx + 1) % EC_TTY_TX_BUFFER_SIZE; |
|
398 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) |
|
399 return 1; |
|
400 #endif |
393 } else { |
401 } else { |
394 printk(KERN_WARNING PFX "%s(): Dropped a byte!\n", __func__); |
402 printk(KERN_WARNING PFX "%s(): Dropped a byte!\n", __func__); |
|
403 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) |
|
404 return 0; |
|
405 #endif |
395 } |
406 } |
396 } |
407 } |
397 |
408 |
398 /*****************************************************************************/ |
409 /*****************************************************************************/ |
399 |
410 |
504 #endif |
515 #endif |
505 } |
516 } |
506 |
517 |
507 /*****************************************************************************/ |
518 /*****************************************************************************/ |
508 |
519 |
|
520 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) |
|
521 static int ec_tty_break(struct tty_struct *tty, int break_state) |
|
522 #else |
509 static void ec_tty_break(struct tty_struct *tty, int break_state) |
523 static void ec_tty_break(struct tty_struct *tty, int break_state) |
|
524 #endif |
510 { |
525 { |
511 #if EC_TTY_DEBUG >= 2 |
526 #if EC_TTY_DEBUG >= 2 |
512 printk(KERN_INFO PFX "%s(break_state = %i).\n", __func__, break_state); |
527 printk(KERN_INFO PFX "%s(break_state = %i).\n", __func__, break_state); |
|
528 #endif |
|
529 |
|
530 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) |
|
531 return -EIO; // not implemented |
513 #endif |
532 #endif |
514 } |
533 } |
515 |
534 |
516 /*****************************************************************************/ |
535 /*****************************************************************************/ |
517 |
536 |