USB: ark3116: Replace cmget
Signed-off-by: Bart Hartgers <bart.hartgers@gmail.com> Cc: Mike McCormack <mikem@ring3k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
f4c1e8d597
Коммит
1f71910513
|
@ -528,32 +528,27 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file,
|
||||||
static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
|
static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
struct usb_serial *serial = port->serial;
|
struct ark3116_private *priv = usb_get_serial_port_data(port);
|
||||||
char *buf;
|
__u32 status;
|
||||||
char temp;
|
__u32 ctrl;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
/* seems like serial port status info (RTS, CTS, ...) is stored
|
mutex_lock(&priv->hw_lock);
|
||||||
* in reg(?) 0x0006
|
ctrl = priv->mcr;
|
||||||
* pcb connection point 11 = GND -> sets bit4 of response
|
mutex_unlock(&priv->hw_lock);
|
||||||
* pcb connection point 7 = GND -> sets bit6 of response
|
|
||||||
*/
|
|
||||||
|
|
||||||
buf = kmalloc(1, GFP_KERNEL);
|
spin_lock_irqsave(&priv->status_lock, flags);
|
||||||
if (!buf) {
|
status = priv->msr;
|
||||||
dbg("error kmalloc");
|
spin_unlock_irqrestore(&priv->status_lock, flags);
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* read register */
|
return (status & UART_MSR_DSR ? TIOCM_DSR : 0) |
|
||||||
ARK3116_RCV_QUIET(serial, 0xFE, 0xC0, 0x0000, 0x0006, buf);
|
(status & UART_MSR_CTS ? TIOCM_CTS : 0) |
|
||||||
temp = buf[0];
|
(status & UART_MSR_RI ? TIOCM_RI : 0) |
|
||||||
kfree(buf);
|
(status & UART_MSR_DCD ? TIOCM_CD : 0) |
|
||||||
|
(ctrl & UART_MCR_DTR ? TIOCM_DTR : 0) |
|
||||||
/* i do not really know if bit4=CTS and bit6=DSR... just a
|
(ctrl & UART_MCR_RTS ? TIOCM_RTS : 0) |
|
||||||
* quick guess!
|
(ctrl & UART_MCR_OUT1 ? TIOCM_OUT1 : 0) |
|
||||||
*/
|
(ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0);
|
||||||
return (temp & (1<<4) ? TIOCM_CTS : 0)
|
|
||||||
| (temp & (1<<6) ? TIOCM_DSR : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct usb_driver ark3116_driver = {
|
static struct usb_driver ark3116_driver = {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче