aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7720.c
diff options
context:
space:
mode:
authorKees Schoenmakers <k.schoenmakers@sigmae.nl>2009-09-19 16:13:18 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:18 -0400
commit2f9ea55c98bd03265e1c3eb114718eb2974df4cb (patch)
treedb669b2ad9617b332749b7e5d0598fe47f60e8d1 /drivers/usb/serial/mos7720.c
parent0f608f8926968b4beee2cb00ef05522ad84f36eb (diff)
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: Kees Schoenmakers <k.schoenmakers@sigmae.nl> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/mos7720.c')
-rw-r--r--drivers/usb/serial/mos7720.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 759cdd5ae74d..4342a8a0eac9 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -378,10 +378,14 @@ static int mos7720_open(struct tty_struct *tty,
378 /* Initialize MCS7720 -- Write Init values to corresponding Registers 378 /* Initialize MCS7720 -- Write Init values to corresponding Registers
379 * 379 *
380 * Register Index 380 * Register Index
381 * 0 : THR/RHR
381 * 1 : IER 382 * 1 : IER
382 * 2 : FCR 383 * 2 : FCR
383 * 3 : LCR 384 * 3 : LCR
384 * 4 : MCR 385 * 4 : MCR
386 * 5 : LSR
387 * 6 : MSR
388 * 7 : SPR
385 * 389 *
386 * 0x08 : SP1/2 Control Reg 390 * 0x08 : SP1/2 Control Reg
387 */ 391 */
@@ -1250,15 +1254,22 @@ static void mos7720_set_termios(struct tty_struct *tty,
1250static int get_lsr_info(struct tty_struct *tty, 1254static int get_lsr_info(struct tty_struct *tty,
1251 struct moschip_port *mos7720_port, unsigned int __user *value) 1255 struct moschip_port *mos7720_port, unsigned int __user *value)
1252{ 1256{
1253 int count; 1257 struct usb_serial_port *port = tty->driver_data;
1254 unsigned int result = 0; 1258 unsigned int result = 0;
1259 unsigned char data = 0;
1260 int port_number = port->number - port->serial->minor;
1261 int count;
1255 1262
1256 count = mos7720_chars_in_buffer(tty); 1263 count = mos7720_chars_in_buffer(tty);
1257 if (count == 0) { 1264 if (count == 0) {
1258 dbg("%s -- Empty", __func__); 1265 send_mos_cmd(port->serial, MOS_READ, port_number,
1259 result = TIOCSER_TEMT; 1266 UART_LSR, &data);
1267 if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
1268 == (UART_LSR_TEMT | UART_LSR_THRE)) {
1269 dbg("%s -- Empty", __func__);
1270 result = TIOCSER_TEMT;
1271 }
1260 } 1272 }
1261
1262 if (copy_to_user(value, &result, sizeof(int))) 1273 if (copy_to_user(value, &result, sizeof(int)))
1263 return -EFAULT; 1274 return -EFAULT;
1264 return 0; 1275 return 0;