aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-02-08 07:18:43 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:24 -0500
commitdb1acaa632870ec87b65e062bc72ca375837a1f6 (patch)
tree9d63ae5544bcba791e3acb1ba65ac0e3acab5a4c /drivers
parent92dfc9dc7ba63134f721b6e745dbdcfc13ea341b (diff)
moxa: first pass at termios reporting
Signed-off-by: Alan Cox <alan@redhat.com> Cc: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/moxa.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 2fc255a21486..64b7b2b18352 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -207,7 +207,7 @@ static int moxa_tiocmget(struct tty_struct *tty, struct file *file);
207static int moxa_tiocmset(struct tty_struct *tty, struct file *file, 207static int moxa_tiocmset(struct tty_struct *tty, struct file *file,
208 unsigned int set, unsigned int clear); 208 unsigned int set, unsigned int clear);
209static void moxa_poll(unsigned long); 209static void moxa_poll(unsigned long);
210static void moxa_set_tty_param(struct tty_struct *); 210static void moxa_set_tty_param(struct tty_struct *, struct ktermios *);
211static int moxa_block_till_ready(struct tty_struct *, struct file *, 211static int moxa_block_till_ready(struct tty_struct *, struct file *,
212 struct moxa_port *); 212 struct moxa_port *);
213static void moxa_setup_empty_event(struct tty_struct *); 213static void moxa_setup_empty_event(struct tty_struct *);
@@ -500,7 +500,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
500 ch->tty = tty; 500 ch->tty = tty;
501 if (!(ch->asyncflags & ASYNC_INITIALIZED)) { 501 if (!(ch->asyncflags & ASYNC_INITIALIZED)) {
502 ch->statusflags = 0; 502 ch->statusflags = 0;
503 moxa_set_tty_param(tty); 503 moxa_set_tty_param(tty, tty->termios);
504 MoxaPortLineCtrl(ch->port, 1, 1); 504 MoxaPortLineCtrl(ch->port, 1, 1);
505 MoxaPortEnable(ch->port); 505 MoxaPortEnable(ch->port);
506 ch->asyncflags |= ASYNC_INITIALIZED; 506 ch->asyncflags |= ASYNC_INITIALIZED;
@@ -803,7 +803,7 @@ static void moxa_set_termios(struct tty_struct *tty,
803 803
804 if (ch == NULL) 804 if (ch == NULL)
805 return; 805 return;
806 moxa_set_tty_param(tty); 806 moxa_set_tty_param(tty, old_termios);
807 if (!(old_termios->c_cflag & CLOCAL) && 807 if (!(old_termios->c_cflag & CLOCAL) &&
808 (tty->termios->c_cflag & CLOCAL)) 808 (tty->termios->c_cflag & CLOCAL))
809 wake_up_interruptible(&ch->open_wait); 809 wake_up_interruptible(&ch->open_wait);
@@ -903,11 +903,11 @@ static void moxa_poll(unsigned long ignored)
903 903
904/******************************************************************************/ 904/******************************************************************************/
905 905
906static void moxa_set_tty_param(struct tty_struct *tty) 906static void moxa_set_tty_param(struct tty_struct *tty, struct ktermios *old_termios)
907{ 907{
908 register struct ktermios *ts; 908 register struct ktermios *ts;
909 struct moxa_port *ch; 909 struct moxa_port *ch;
910 int rts, cts, txflow, rxflow, xany; 910 int rts, cts, txflow, rxflow, xany, baud;
911 911
912 ch = (struct moxa_port *) tty->driver_data; 912 ch = (struct moxa_port *) tty->driver_data;
913 ts = tty->termios; 913 ts = tty->termios;
@@ -924,8 +924,15 @@ static void moxa_set_tty_param(struct tty_struct *tty)
924 rxflow = 1; 924 rxflow = 1;
925 if (ts->c_iflag & IXANY) 925 if (ts->c_iflag & IXANY)
926 xany = 1; 926 xany = 1;
927
928 /* Clear the features we don't support */
929 ts->c_cflag &= ~CMSPAR;
927 MoxaPortFlowCtrl(ch->port, rts, cts, txflow, rxflow, xany); 930 MoxaPortFlowCtrl(ch->port, rts, cts, txflow, rxflow, xany);
928 MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty)); 931 baud = MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty));
932 if (baud == -1)
933 baud = tty_termios_baud_rate(old_termios);
934 /* Not put the baud rate into the termios data */
935 tty_encode_baud_rate(tty, baud, baud);
929} 936}
930 937
931static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, 938static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp,
@@ -2065,7 +2072,7 @@ int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud)
2065 if (baud >= 921600L) 2072 if (baud >= 921600L)
2066 return (-1); 2073 return (-1);
2067 } 2074 }
2068 MoxaPortSetBaud(port, baud); 2075 baud = MoxaPortSetBaud(port, baud);
2069 2076
2070 if (termio->c_iflag & (IXON | IXOFF | IXANY)) { 2077 if (termio->c_iflag & (IXON | IXOFF | IXANY)) {
2071 writeb(termio->c_cc[VSTART], ofsAddr + FuncArg); 2078 writeb(termio->c_cc[VSTART], ofsAddr + FuncArg);
@@ -2074,7 +2081,7 @@ int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud)
2074 moxa_wait_finish(ofsAddr); 2081 moxa_wait_finish(ofsAddr);
2075 2082
2076 } 2083 }
2077 return (0); 2084 return (baud);
2078} 2085}
2079 2086
2080int MoxaPortGetLineOut(int port, int *dtrState, int *rtsState) 2087int MoxaPortGetLineOut(int port, int *dtrState, int *rtsState)