Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185277
b: refs/heads/master
c: a3f8168
h: refs/heads/master
i:
  185275: 60b7f74
v: v3
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 934f2fa commit d543aee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66e47e6006a558b33c6f15bd2e072d52c40e0159
refs/heads/master: a3f8168b7a3a7d9dfb9bb9caa1e009a5ce2a8493
37 changes: 16 additions & 21 deletions trunk/drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2341,49 +2341,44 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
struct usb_serial_port *port = tty->driver_data;
struct ftdi_private *priv = usb_get_serial_port_data(port);
unsigned char *buf;
int len;
int ret;

dbg("%s TIOCMGET", __func__);

buf = kmalloc(2, GFP_KERNEL);
if (!buf)
return -ENOMEM;

/*
* The 8U232AM returns a two byte value (the SIO a 1 byte value) in
* the same format as the data returned from the in point.
*/
switch (priv->chip_type) {
case SIO:
/* Request the status from the device */
ret = usb_control_msg(port->serial->dev,
usb_rcvctrlpipe(port->serial->dev, 0),
FTDI_SIO_GET_MODEM_STATUS_REQUEST,
FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
0, 0,
buf, 1, WDR_TIMEOUT);
if (ret < 0)
goto out;
len = 1;
break;
case FT8U232AM:
case FT232BM:
case FT2232C:
case FT232RL:
case FT2232H:
case FT4232H:
/* the 8U232AM returns a two byte value (the sio is a 1 byte
value) - in the same format as the data returned from the in
point */
ret = usb_control_msg(port->serial->dev,
usb_rcvctrlpipe(port->serial->dev, 0),
FTDI_SIO_GET_MODEM_STATUS_REQUEST,
FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
0, priv->interface,
buf, 2, WDR_TIMEOUT);
if (ret < 0)
goto out;
len = 2;
break;
default:
ret = -EFAULT;
goto out;
}

ret = usb_control_msg(port->serial->dev,
usb_rcvctrlpipe(port->serial->dev, 0),
FTDI_SIO_GET_MODEM_STATUS_REQUEST,
FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
0, priv->interface,
buf, len, WDR_TIMEOUT);
if (ret < 0)
goto out;

ret = (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) |
(buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) |
(buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) |
Expand Down

0 comments on commit d543aee

Please sign in to comment.