Commit 2f9ea55c authored by Kees Schoenmakers's avatar Kees Schoenmakers Committed by Live-CD User

tty: usb_serial_mos7720: Fix get_lsr_info

I made a correction for get_lsr_info, now it returns some meaningful
information. I tested it with two simultaneous simplex modem channels.

it is attached
Signed-off-by: default avatarKees Schoenmakers <k.schoenmakers@sigmae.nl>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0f608f89
...@@ -378,10 +378,14 @@ static int mos7720_open(struct tty_struct *tty, ...@@ -378,10 +378,14 @@ static int mos7720_open(struct tty_struct *tty,
/* Initialize MCS7720 -- Write Init values to corresponding Registers /* Initialize MCS7720 -- Write Init values to corresponding Registers
* *
* Register Index * Register Index
* 0 : THR/RHR
* 1 : IER * 1 : IER
* 2 : FCR * 2 : FCR
* 3 : LCR * 3 : LCR
* 4 : MCR * 4 : MCR
* 5 : LSR
* 6 : MSR
* 7 : SPR
* *
* 0x08 : SP1/2 Control Reg * 0x08 : SP1/2 Control Reg
*/ */
...@@ -1250,15 +1254,22 @@ static void mos7720_set_termios(struct tty_struct *tty, ...@@ -1250,15 +1254,22 @@ static void mos7720_set_termios(struct tty_struct *tty,
static int get_lsr_info(struct tty_struct *tty, static int get_lsr_info(struct tty_struct *tty,
struct moschip_port *mos7720_port, unsigned int __user *value) struct moschip_port *mos7720_port, unsigned int __user *value)
{ {
int count; struct usb_serial_port *port = tty->driver_data;
unsigned int result = 0; unsigned int result = 0;
unsigned char data = 0;
int port_number = port->number - port->serial->minor;
int count;
count = mos7720_chars_in_buffer(tty); count = mos7720_chars_in_buffer(tty);
if (count == 0) { if (count == 0) {
send_mos_cmd(port->serial, MOS_READ, port_number,
UART_LSR, &data);
if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
== (UART_LSR_TEMT | UART_LSR_THRE)) {
dbg("%s -- Empty", __func__); dbg("%s -- Empty", __func__);
result = TIOCSER_TEMT; result = TIOCSER_TEMT;
} }
}
if (copy_to_user(value, &result, sizeof(int))) if (copy_to_user(value, &result, sizeof(int)))
return -EFAULT; return -EFAULT;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment