# HG changeset patch # User Florian Pose # Date 1262943269 -3600 # Node ID 8d8657654921cf46d175a93f812a7d8057ee4578 # Parent 2019bec460ad6f2ecef954d9ef3d27fb44f1002e Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26 or 2.6.27, respectively. diff -r 2019bec460ad -r 8d8657654921 tty/module.c --- a/tty/module.c Thu Jan 07 17:26:39 2010 +0100 +++ b/tty/module.c Fri Jan 08 10:34:29 2010 +0100 @@ -40,6 +40,7 @@ #include #include #include +#include #include "../master/globals.h" #include "../include/ectty.h" @@ -379,7 +380,11 @@ /*****************************************************************************/ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static int ec_tty_put_char(struct tty_struct *tty, unsigned char ch) +#else static void ec_tty_put_char(struct tty_struct *tty, unsigned char ch) +#endif { ec_tty_t *t = (ec_tty_t *) tty->driver_data; @@ -390,8 +395,14 @@ if (ec_tty_tx_space(t)) { t->tx_buffer[t->tx_write_idx] = ch; t->tx_write_idx = (t->tx_write_idx + 1) % EC_TTY_TX_BUFFER_SIZE; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + return 1; +#endif } else { printk(KERN_WARNING PFX "%s(): Dropped a byte!\n", __func__); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + return 0; +#endif } } @@ -506,11 +517,19 @@ /*****************************************************************************/ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) +static int ec_tty_break(struct tty_struct *tty, int break_state) +#else static void ec_tty_break(struct tty_struct *tty, int break_state) +#endif { #if EC_TTY_DEBUG >= 2 printk(KERN_INFO PFX "%s(break_state = %i).\n", __func__, break_state); #endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) + return -EIO; // not implemented +#endif } /*****************************************************************************/