diff options
Diffstat (limited to 'drivers/usb/serial/keyspan_pda.c')
-rw-r--r-- | drivers/usb/serial/keyspan_pda.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index bf1ae247da6..ab769dbea1b 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -651,6 +651,35 @@ static int keyspan_pda_chars_in_buffer(struct tty_struct *tty) | |||
651 | } | 651 | } |
652 | 652 | ||
653 | 653 | ||
654 | static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) | ||
655 | { | ||
656 | struct usb_serial *serial = port->serial; | ||
657 | |||
658 | if (serial->dev) { | ||
659 | if (on) | ||
660 | keyspan_pda_set_modem_info(serial, (1<<7) | (1<< 2)); | ||
661 | else | ||
662 | keyspan_pda_set_modem_info(serial, 0); | ||
663 | } | ||
664 | } | ||
665 | |||
666 | static int keyspan_pda_carrier_raised(struct usb_serial_port *port) | ||
667 | { | ||
668 | struct usb_serial *serial = port->serial; | ||
669 | unsigned char modembits; | ||
670 | |||
671 | /* If we can read the modem status and the DCD is low then | ||
672 | carrier is not raised yet */ | ||
673 | if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { | ||
674 | if (!(modembits & (1>>6))) | ||
675 | return 0; | ||
676 | } | ||
677 | /* Carrier raised, or we failed (eg disconnected) so | ||
678 | progress accordingly */ | ||
679 | return 1; | ||
680 | } | ||
681 | |||
682 | |||
654 | static int keyspan_pda_open(struct tty_struct *tty, | 683 | static int keyspan_pda_open(struct tty_struct *tty, |
655 | struct usb_serial_port *port, struct file *filp) | 684 | struct usb_serial_port *port, struct file *filp) |
656 | { | 685 | { |
@@ -682,13 +711,6 @@ static int keyspan_pda_open(struct tty_struct *tty, | |||
682 | priv->tx_room = room; | 711 | priv->tx_room = room; |
683 | priv->tx_throttled = room ? 0 : 1; | 712 | priv->tx_throttled = room ? 0 : 1; |
684 | 713 | ||
685 | /* the normal serial device seems to always turn on DTR and RTS here, | ||
686 | so do the same */ | ||
687 | if (tty && (tty->termios->c_cflag & CBAUD)) | ||
688 | keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2)); | ||
689 | else | ||
690 | keyspan_pda_set_modem_info(serial, 0); | ||
691 | |||
692 | /*Start reading from the device*/ | 714 | /*Start reading from the device*/ |
693 | port->interrupt_in_urb->dev = serial->dev; | 715 | port->interrupt_in_urb->dev = serial->dev; |
694 | rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 716 | rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
@@ -700,19 +722,11 @@ static int keyspan_pda_open(struct tty_struct *tty, | |||
700 | error: | 722 | error: |
701 | return rc; | 723 | return rc; |
702 | } | 724 | } |
703 | 725 | static void keyspan_pda_close(struct usb_serial_port *port) | |
704 | |||
705 | static void keyspan_pda_close(struct tty_struct *tty, | ||
706 | struct usb_serial_port *port, struct file *filp) | ||
707 | { | 726 | { |
708 | struct usb_serial *serial = port->serial; | 727 | struct usb_serial *serial = port->serial; |
709 | 728 | ||
710 | if (serial->dev) { | 729 | if (serial->dev) { |
711 | /* the normal serial device seems to always shut | ||
712 | off DTR and RTS now */ | ||
713 | if (tty->termios->c_cflag & HUPCL) | ||
714 | keyspan_pda_set_modem_info(serial, 0); | ||
715 | |||
716 | /* shutdown our bulk reads and writes */ | 730 | /* shutdown our bulk reads and writes */ |
717 | usb_kill_urb(port->write_urb); | 731 | usb_kill_urb(port->write_urb); |
718 | usb_kill_urb(port->interrupt_in_urb); | 732 | usb_kill_urb(port->interrupt_in_urb); |
@@ -839,6 +853,8 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
839 | .usb_driver = &keyspan_pda_driver, | 853 | .usb_driver = &keyspan_pda_driver, |
840 | .id_table = id_table_std, | 854 | .id_table = id_table_std, |
841 | .num_ports = 1, | 855 | .num_ports = 1, |
856 | .dtr_rts = keyspan_pda_dtr_rts, | ||
857 | .carrier_raised = keyspan_pda_carrier_raised, | ||
842 | .open = keyspan_pda_open, | 858 | .open = keyspan_pda_open, |
843 | .close = keyspan_pda_close, | 859 | .close = keyspan_pda_close, |
844 | .write = keyspan_pda_write, | 860 | .write = keyspan_pda_write, |