aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/kl5kusb105.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/kl5kusb105.c')
-rw-r--r--drivers/usb/serial/kl5kusb105.c75
1 files changed, 4 insertions, 71 deletions
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 17e205699c2b..b2097c45a235 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -86,11 +86,7 @@ static int klsi_105_write_room (struct usb_serial_port *port);
86 86
87static void klsi_105_read_bulk_callback (struct urb *urb); 87static void klsi_105_read_bulk_callback (struct urb *urb);
88static void klsi_105_set_termios (struct usb_serial_port *port, 88static void klsi_105_set_termios (struct usb_serial_port *port,
89 struct termios * old); 89 struct ktermios *old);
90static int klsi_105_ioctl (struct usb_serial_port *port,
91 struct file * file,
92 unsigned int cmd,
93 unsigned long arg);
94static void klsi_105_throttle (struct usb_serial_port *port); 90static void klsi_105_throttle (struct usb_serial_port *port);
95static void klsi_105_unthrottle (struct usb_serial_port *port); 91static void klsi_105_unthrottle (struct usb_serial_port *port);
96/* 92/*
@@ -128,6 +124,7 @@ static struct usb_serial_driver kl5kusb105d_device = {
128 .name = "kl5kusb105d", 124 .name = "kl5kusb105d",
129 }, 125 },
130 .description = "KL5KUSB105D / PalmConnect", 126 .description = "KL5KUSB105D / PalmConnect",
127 .usb_driver = &kl5kusb105d_driver,
131 .id_table = id_table, 128 .id_table = id_table,
132 .num_interrupt_in = 1, 129 .num_interrupt_in = 1,
133 .num_bulk_in = 1, 130 .num_bulk_in = 1,
@@ -140,7 +137,6 @@ static struct usb_serial_driver kl5kusb105d_device = {
140 .chars_in_buffer = klsi_105_chars_in_buffer, 137 .chars_in_buffer = klsi_105_chars_in_buffer,
141 .write_room = klsi_105_write_room, 138 .write_room = klsi_105_write_room,
142 .read_bulk_callback =klsi_105_read_bulk_callback, 139 .read_bulk_callback =klsi_105_read_bulk_callback,
143 .ioctl = klsi_105_ioctl,
144 .set_termios = klsi_105_set_termios, 140 .set_termios = klsi_105_set_termios,
145 /*.break_ctl = klsi_105_break_ctl,*/ 141 /*.break_ctl = klsi_105_break_ctl,*/
146 .tiocmget = klsi_105_tiocmget, 142 .tiocmget = klsi_105_tiocmget,
@@ -164,7 +160,7 @@ struct klsi_105_port_settings {
164#define URB_TRANSFER_BUFFER_SIZE 64 160#define URB_TRANSFER_BUFFER_SIZE 64
165struct klsi_105_private { 161struct klsi_105_private {
166 struct klsi_105_port_settings cfg; 162 struct klsi_105_port_settings cfg;
167 struct termios termios; 163 struct ktermios termios;
168 unsigned long line_state; /* modem line settings */ 164 unsigned long line_state; /* modem line settings */
169 /* write pool */ 165 /* write pool */
170 struct urb * write_urb_pool[NUM_URBS]; 166 struct urb * write_urb_pool[NUM_URBS];
@@ -688,7 +684,7 @@ static void klsi_105_read_bulk_callback (struct urb *urb)
688 684
689 685
690static void klsi_105_set_termios (struct usb_serial_port *port, 686static void klsi_105_set_termios (struct usb_serial_port *port,
691 struct termios *old_termios) 687 struct ktermios *old_termios)
692{ 688{
693 struct klsi_105_private *priv = usb_get_serial_port_data(port); 689 struct klsi_105_private *priv = usb_get_serial_port_data(port);
694 unsigned int iflag = port->tty->termios->c_iflag; 690 unsigned int iflag = port->tty->termios->c_iflag;
@@ -899,69 +895,6 @@ static int klsi_105_tiocmset (struct usb_serial_port *port, struct file *file,
899*/ 895*/
900 return retval; 896 return retval;
901} 897}
902
903static int klsi_105_ioctl (struct usb_serial_port *port, struct file * file,
904 unsigned int cmd, unsigned long arg)
905{
906 struct klsi_105_private *priv = usb_get_serial_port_data(port);
907 void __user *user_arg = (void __user *)arg;
908
909 dbg("%scmd=0x%x", __FUNCTION__, cmd);
910
911 /* Based on code from acm.c and others */
912 switch (cmd) {
913 case TIOCMIWAIT:
914 /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
915 /* TODO */
916 dbg("%s - TIOCMIWAIT not handled", __FUNCTION__);
917 return -ENOIOCTLCMD;
918 case TIOCGICOUNT:
919 /* return count of modemline transitions */
920 /* TODO */
921 dbg("%s - TIOCGICOUNT not handled", __FUNCTION__);
922 return -ENOIOCTLCMD;
923 case TCGETS:
924 /* return current info to caller */
925 dbg("%s - TCGETS data faked/incomplete", __FUNCTION__);
926
927 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct termios)))
928 return -EFAULT;
929
930 if (kernel_termios_to_user_termios((struct termios __user *)arg,
931 &priv->termios))
932 return -EFAULT;
933 return 0;
934 case TCSETS:
935 /* set port termios to the one given by the user */
936 dbg("%s - TCSETS not handled", __FUNCTION__);
937
938 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct termios)))
939 return -EFAULT;
940
941 if (user_termios_to_kernel_termios(&priv->termios,
942 (struct termios __user *)arg))
943 return -EFAULT;
944 klsi_105_set_termios(port, &priv->termios);
945 return 0;
946 case TCSETSW: {
947 /* set port termios and try to wait for completion of last
948 * write operation */
949 /* We guess here. If there are not too many write urbs
950 * outstanding, we lie. */
951 /* what is the right way to wait here? schedule() ? */
952 /*
953 while (klsi_105_chars_in_buffer(port) > (NUM_URBS / 4 ) * URB_TRANSFER_BUFFER_SIZE)
954 schedule();
955 */
956 return -ENOIOCTLCMD;
957 }
958 default:
959 dbg("%s: arg not supported - 0x%04x", __FUNCTION__,cmd);
960 return(-ENOIOCTLCMD);
961 break;
962 }
963 return 0;
964} /* klsi_105_ioctl */
965 898
966static void klsi_105_throttle (struct usb_serial_port *port) 899static void klsi_105_throttle (struct usb_serial_port *port)
967{ 900{