]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: usb-serial core: add support for new tty tiocmget and tiocmset functions.
authorGreg Kroah-Hartman <greg@kroah.com>
Wed, 23 Apr 2003 10:35:42 +0000 (03:35 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 23 Apr 2003 10:35:42 +0000 (03:35 -0700)
drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb-serial.h

index c4bfe0b59ba5eeb1a054eeeb3fc1f933bb408fe1..f6d452bdb9571a90fb15b6063771a4fdea641f12 100644 (file)
@@ -785,6 +785,51 @@ done:
        return ((count < begin+length-off) ? count : begin+length-off);
 }
 
+static int serial_tiocmget (struct tty_struct *tty, struct file *file)
+{
+       struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
+       struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
+
+       if (!serial)
+               goto exit;
+
+       dbg("%s - port %d", __FUNCTION__, port->number);
+
+       if (!port->open_count) {
+               dbg("%s - port not open", __FUNCTION__);
+               goto exit;
+       }
+
+       if (serial->type->tiocmget)
+               return serial->type->tiocmget(port, file);
+
+exit:
+       return -EINVAL;
+}
+
+static int serial_tiocmset (struct tty_struct *tty, struct file *file,
+                           unsigned int set, unsigned int clear)
+{
+       struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
+       struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
+
+       if (!serial)
+               goto exit;
+
+       dbg("%s - port %d", __FUNCTION__, port->number);
+
+       if (!port->open_count) {
+               dbg("%s - port not open", __FUNCTION__);
+               goto exit;
+       }
+
+       if (serial->type->tiocmset)
+               return serial->type->tiocmset(port, file, set, clear);
+
+exit:
+       return -EINVAL;
+}
+
 void usb_serial_port_softint(void *private)
 {
        struct usb_serial_port *port = (struct usb_serial_port *)private;
@@ -1286,6 +1331,8 @@ struct tty_driver usb_serial_tty_driver = {
        .break_ctl =            serial_break,
        .chars_in_buffer =      serial_chars_in_buffer,
        .read_proc =            serial_read_proc,
+       .tiocmget =             serial_tiocmget,
+       .tiocmset =             serial_tiocmset,
 };
 
 
index ad2d292ddf532002d1cff0b2207587324ab72f83..b0d3ad04675c0f3c8e41aacbd45d4f23b011414b 100644 (file)
@@ -251,6 +251,8 @@ struct usb_serial_device_type {
        int  (*chars_in_buffer) (struct usb_serial_port *port);
        void (*throttle)        (struct usb_serial_port *port);
        void (*unthrottle)      (struct usb_serial_port *port);
+       int  (*tiocmget)        (struct usb_serial_port *port, struct file *file);
+       int  (*tiocmset)        (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
 
        void (*read_int_callback)(struct urb *urb, struct pt_regs *regs);
        void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs);