Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227041
b: refs/heads/master
c: c466cd2
h: refs/heads/master
i:
  227039: d90c959
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Dec 16, 2010
1 parent 2703631 commit 58d8ef9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0247a7bcd4273fa10c4aba9b3f567c659bab2d2b
refs/heads/master: c466cd2bb9cee2e576fc9663b828f51e322d7b4b
27 changes: 27 additions & 0 deletions trunk/drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct ftdi_private {
unsigned long last_dtr_rts; /* saved modem control outputs */
wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
char prev_status, diff_status; /* Used for TIOCMIWAIT */
char transmit_empty; /* If transmitter is empty or not */
struct usb_serial_port *port;
__u16 interface; /* FT2232C, FT2232H or FT4232H port interface
(0 for FT232/245) */
Expand Down Expand Up @@ -1322,6 +1323,23 @@ static int set_serial_info(struct tty_struct *tty,
return 0;
}

static int get_lsr_info(struct usb_serial_port *port,
struct serial_struct __user *retinfo)
{
struct ftdi_private *priv = usb_get_serial_port_data(port);
unsigned int result = 0;

if (!retinfo)
return -EFAULT;

if (priv->transmit_empty)
result = TIOCSER_TEMT;

if (copy_to_user(retinfo, &result, sizeof(unsigned int)))
return -EFAULT;
return 0;
}


/* Determine type of FTDI chip based on USB config and descriptor. */
static void ftdi_determine_type(struct usb_serial_port *port)
Expand Down Expand Up @@ -1871,6 +1889,12 @@ static int ftdi_process_packet(struct tty_struct *tty,
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
}

/* save if the transmitter is empty or not */
if (packet[1] & FTDI_RS_TEMT)
priv->transmit_empty = 1;
else
priv->transmit_empty = 0;

len -= 2;
if (!len)
return 0; /* status only */
Expand Down Expand Up @@ -2234,6 +2258,9 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file *file,
}
}
return 0;
case TIOCSERGETLSR:
return get_lsr_info(port, (struct serial_struct __user *)arg);
break;
default:
break;
}
Expand Down

0 comments on commit 58d8ef9

Please sign in to comment.