diff options
Diffstat (limited to 'drivers/usb/serial')
| -rw-r--r-- | drivers/usb/serial/cypress_m8.c | 251 | ||||
| -rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 56 | ||||
| -rw-r--r-- | drivers/usb/serial/ftdi_sio.h | 54 | ||||
| -rw-r--r-- | drivers/usb/serial/keyspan.c | 8 | ||||
| -rw-r--r-- | drivers/usb/serial/option.c | 203 | ||||
| -rw-r--r-- | drivers/usb/serial/pl2303.c | 6 | ||||
| -rw-r--r-- | drivers/usb/serial/usb-serial.c | 24 |
7 files changed, 364 insertions, 238 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 012e63e05806..05c44ae3ed32 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
| @@ -453,8 +453,8 @@ static int generic_startup (struct usb_serial *serial) | |||
| 453 | priv->cbr_mask = B300; | 453 | priv->cbr_mask = B300; |
| 454 | usb_set_serial_port_data(serial->port[0], priv); | 454 | usb_set_serial_port_data(serial->port[0], priv); |
| 455 | 455 | ||
| 456 | return (0); | 456 | return 0; |
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | 459 | ||
| 460 | static int cypress_earthmate_startup (struct usb_serial *serial) | 460 | static int cypress_earthmate_startup (struct usb_serial *serial) |
| @@ -464,14 +464,15 @@ static int cypress_earthmate_startup (struct usb_serial *serial) | |||
| 464 | dbg("%s", __FUNCTION__); | 464 | dbg("%s", __FUNCTION__); |
| 465 | 465 | ||
| 466 | if (generic_startup(serial)) { | 466 | if (generic_startup(serial)) { |
| 467 | dbg("%s - Failed setting up port %d", __FUNCTION__, serial->port[0]->number); | 467 | dbg("%s - Failed setting up port %d", __FUNCTION__, |
| 468 | serial->port[0]->number); | ||
| 468 | return 1; | 469 | return 1; |
| 469 | } | 470 | } |
| 470 | 471 | ||
| 471 | priv = usb_get_serial_port_data(serial->port[0]); | 472 | priv = usb_get_serial_port_data(serial->port[0]); |
| 472 | priv->chiptype = CT_EARTHMATE; | 473 | priv->chiptype = CT_EARTHMATE; |
| 473 | 474 | ||
| 474 | return (0); | 475 | return 0; |
| 475 | } /* cypress_earthmate_startup */ | 476 | } /* cypress_earthmate_startup */ |
| 476 | 477 | ||
| 477 | 478 | ||
| @@ -482,14 +483,15 @@ static int cypress_hidcom_startup (struct usb_serial *serial) | |||
| 482 | dbg("%s", __FUNCTION__); | 483 | dbg("%s", __FUNCTION__); |
| 483 | 484 | ||
| 484 | if (generic_startup(serial)) { | 485 | if (generic_startup(serial)) { |
| 485 | dbg("%s - Failed setting up port %d", __FUNCTION__, serial->port[0]->number); | 486 | dbg("%s - Failed setting up port %d", __FUNCTION__, |
| 487 | serial->port[0]->number); | ||
| 486 | return 1; | 488 | return 1; |
| 487 | } | 489 | } |
| 488 | 490 | ||
| 489 | priv = usb_get_serial_port_data(serial->port[0]); | 491 | priv = usb_get_serial_port_data(serial->port[0]); |
| 490 | priv->chiptype = CT_CYPHIDCOM; | 492 | priv->chiptype = CT_CYPHIDCOM; |
| 491 | 493 | ||
| 492 | return (0); | 494 | return 0; |
| 493 | } /* cypress_hidcom_startup */ | 495 | } /* cypress_hidcom_startup */ |
| 494 | 496 | ||
| 495 | 497 | ||
| @@ -909,7 +911,8 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi | |||
| 909 | } /* cypress_ioctl */ | 911 | } /* cypress_ioctl */ |
| 910 | 912 | ||
| 911 | 913 | ||
| 912 | static void cypress_set_termios (struct usb_serial_port *port, struct termios *old_termios) | 914 | static void cypress_set_termios (struct usb_serial_port *port, |
| 915 | struct termios *old_termios) | ||
| 913 | { | 916 | { |
| 914 | struct cypress_private *priv = usb_get_serial_port_data(port); | 917 | struct cypress_private *priv = usb_get_serial_port_data(port); |
| 915 | struct tty_struct *tty; | 918 | struct tty_struct *tty; |
| @@ -918,7 +921,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
| 918 | unsigned long flags; | 921 | unsigned long flags; |
| 919 | __u8 oldlines; | 922 | __u8 oldlines; |
| 920 | int linechange = 0; | 923 | int linechange = 0; |
| 921 | 924 | ||
| 922 | dbg("%s - port %d", __FUNCTION__, port->number); | 925 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 923 | 926 | ||
| 924 | tty = port->tty; | 927 | tty = port->tty; |
| @@ -931,10 +934,12 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
| 931 | if (!priv->termios_initialized) { | 934 | if (!priv->termios_initialized) { |
| 932 | if (priv->chiptype == CT_EARTHMATE) { | 935 | if (priv->chiptype == CT_EARTHMATE) { |
| 933 | *(tty->termios) = tty_std_termios; | 936 | *(tty->termios) = tty_std_termios; |
| 934 | tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL | CLOCAL; | 937 | tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL | |
| 938 | CLOCAL; | ||
| 935 | } else if (priv->chiptype == CT_CYPHIDCOM) { | 939 | } else if (priv->chiptype == CT_CYPHIDCOM) { |
| 936 | *(tty->termios) = tty_std_termios; | 940 | *(tty->termios) = tty_std_termios; |
| 937 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 941 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | |
| 942 | CLOCAL; | ||
| 938 | } | 943 | } |
| 939 | priv->termios_initialized = 1; | 944 | priv->termios_initialized = 1; |
| 940 | } | 945 | } |
| @@ -946,12 +951,15 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
| 946 | /* check if there are new settings */ | 951 | /* check if there are new settings */ |
| 947 | if (old_termios) { | 952 | if (old_termios) { |
| 948 | if ((cflag != old_termios->c_cflag) || | 953 | if ((cflag != old_termios->c_cflag) || |
| 949 | (RELEVANT_IFLAG(iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) { | 954 | (RELEVANT_IFLAG(iflag) != |
| 950 | dbg("%s - attempting to set new termios settings", __FUNCTION__); | 955 | RELEVANT_IFLAG(old_termios->c_iflag))) { |
| 951 | /* should make a copy of this in case something goes wrong in the function, we can restore it */ | 956 | dbg("%s - attempting to set new termios settings", |
| 957 | __FUNCTION__); | ||
| 958 | /* should make a copy of this in case something goes | ||
| 959 | * wrong in the function, we can restore it */ | ||
| 952 | spin_lock_irqsave(&priv->lock, flags); | 960 | spin_lock_irqsave(&priv->lock, flags); |
| 953 | priv->tmp_termios = *(tty->termios); | 961 | priv->tmp_termios = *(tty->termios); |
| 954 | spin_unlock_irqrestore(&priv->lock, flags); | 962 | spin_unlock_irqrestore(&priv->lock, flags); |
| 955 | } else { | 963 | } else { |
| 956 | dbg("%s - nothing to do, exiting", __FUNCTION__); | 964 | dbg("%s - nothing to do, exiting", __FUNCTION__); |
| 957 | return; | 965 | return; |
| @@ -962,21 +970,34 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
| 962 | /* set number of data bits, parity, stop bits */ | 970 | /* set number of data bits, parity, stop bits */ |
| 963 | /* when parity is disabled the parity type bit is ignored */ | 971 | /* when parity is disabled the parity type bit is ignored */ |
| 964 | 972 | ||
| 965 | stop_bits = cflag & CSTOPB ? 1 : 0; /* 1 means 2 stop bits, 0 means 1 stop bit */ | 973 | /* 1 means 2 stop bits, 0 means 1 stop bit */ |
| 966 | 974 | stop_bits = cflag & CSTOPB ? 1 : 0; | |
| 975 | |||
| 967 | if (cflag & PARENB) { | 976 | if (cflag & PARENB) { |
| 968 | parity_enable = 1; | 977 | parity_enable = 1; |
| 969 | parity_type = cflag & PARODD ? 1 : 0; /* 1 means odd parity, 0 means even parity */ | 978 | /* 1 means odd parity, 0 means even parity */ |
| 979 | parity_type = cflag & PARODD ? 1 : 0; | ||
| 970 | } else | 980 | } else |
| 971 | parity_enable = parity_type = 0; | 981 | parity_enable = parity_type = 0; |
| 972 | 982 | ||
| 973 | if (cflag & CSIZE) { | 983 | if (cflag & CSIZE) { |
| 974 | switch (cflag & CSIZE) { | 984 | switch (cflag & CSIZE) { |
| 975 | case CS5: data_bits = 0; break; | 985 | case CS5: |
| 976 | case CS6: data_bits = 1; break; | 986 | data_bits = 0; |
| 977 | case CS7: data_bits = 2; break; | 987 | break; |
| 978 | case CS8: data_bits = 3; break; | 988 | case CS6: |
| 979 | default: err("%s - CSIZE was set, but not CS5-CS8", __FUNCTION__); data_bits = 3; | 989 | data_bits = 1; |
| 990 | break; | ||
| 991 | case CS7: | ||
| 992 | data_bits = 2; | ||
| 993 | break; | ||
| 994 | case CS8: | ||
| 995 | data_bits = 3; | ||
| 996 | break; | ||
| 997 | default: | ||
| 998 | err("%s - CSIZE was set, but not CS5-CS8", | ||
| 999 | __FUNCTION__); | ||
| 1000 | data_bits = 3; | ||
| 980 | } | 1001 | } |
| 981 | } else | 1002 | } else |
| 982 | data_bits = 3; | 1003 | data_bits = 3; |
| @@ -991,63 +1012,85 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
| 991 | } else { | 1012 | } else { |
| 992 | baud_mask = (cflag & CBAUD); | 1013 | baud_mask = (cflag & CBAUD); |
| 993 | switch(baud_mask) { | 1014 | switch(baud_mask) { |
| 994 | case B300: dbg("%s - setting baud 300bps", __FUNCTION__); break; | 1015 | case B300: |
| 995 | case B600: dbg("%s - setting baud 600bps", __FUNCTION__); break; | 1016 | dbg("%s - setting baud 300bps", __FUNCTION__); |
| 996 | case B1200: dbg("%s - setting baud 1200bps", __FUNCTION__); break; | 1017 | break; |
| 997 | case B2400: dbg("%s - setting baud 2400bps", __FUNCTION__); break; | 1018 | case B600: |
| 998 | case B4800: dbg("%s - setting baud 4800bps", __FUNCTION__); break; | 1019 | dbg("%s - setting baud 600bps", __FUNCTION__); |
| 999 | case B9600: dbg("%s - setting baud 9600bps", __FUNCTION__); break; | 1020 | break; |
| 1000 | case B19200: dbg("%s - setting baud 19200bps", __FUNCTION__); break; | 1021 | case B1200: |
| 1001 | case B38400: dbg("%s - setting baud 38400bps", __FUNCTION__); break; | 1022 | dbg("%s - setting baud 1200bps", __FUNCTION__); |
| 1002 | case B57600: dbg("%s - setting baud 57600bps", __FUNCTION__); break; | 1023 | break; |
| 1003 | case B115200: dbg("%s - setting baud 115200bps", __FUNCTION__); break; | 1024 | case B2400: |
| 1004 | default: dbg("%s - unknown masked baud rate", __FUNCTION__); | 1025 | dbg("%s - setting baud 2400bps", __FUNCTION__); |
| 1026 | break; | ||
| 1027 | case B4800: | ||
| 1028 | dbg("%s - setting baud 4800bps", __FUNCTION__); | ||
| 1029 | break; | ||
| 1030 | case B9600: | ||
| 1031 | dbg("%s - setting baud 9600bps", __FUNCTION__); | ||
| 1032 | break; | ||
| 1033 | case B19200: | ||
| 1034 | dbg("%s - setting baud 19200bps", __FUNCTION__); | ||
| 1035 | break; | ||
| 1036 | case B38400: | ||
| 1037 | dbg("%s - setting baud 38400bps", __FUNCTION__); | ||
| 1038 | break; | ||
| 1039 | case B57600: | ||
| 1040 | dbg("%s - setting baud 57600bps", __FUNCTION__); | ||
| 1041 | break; | ||
| 1042 | case B115200: | ||
| 1043 | dbg("%s - setting baud 115200bps", __FUNCTION__); | ||
| 1044 | break; | ||
| 1045 | default: | ||
| 1046 | dbg("%s - unknown masked baud rate", __FUNCTION__); | ||
| 1005 | } | 1047 | } |
| 1006 | priv->line_control = (CONTROL_DTR | CONTROL_RTS); | 1048 | priv->line_control = (CONTROL_DTR | CONTROL_RTS); |
| 1007 | } | 1049 | } |
| 1008 | spin_unlock_irqrestore(&priv->lock, flags); | 1050 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1009 | |||
| 1010 | dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, %d data_bits (+5)", __FUNCTION__, | ||
| 1011 | stop_bits, parity_enable, parity_type, data_bits); | ||
| 1012 | 1051 | ||
| 1013 | cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable, | 1052 | dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, " |
| 1014 | parity_type, 0, CYPRESS_SET_CONFIG); | 1053 | "%d data_bits (+5)", __FUNCTION__, stop_bits, |
| 1054 | parity_enable, parity_type, data_bits); | ||
| 1055 | |||
| 1056 | cypress_serial_control(port, baud_mask, data_bits, stop_bits, | ||
| 1057 | parity_enable, parity_type, 0, CYPRESS_SET_CONFIG); | ||
| 1015 | 1058 | ||
| 1016 | /* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure | 1059 | /* we perform a CYPRESS_GET_CONFIG so that the current settings are |
| 1017 | * this should confirm that all is working if it returns what we just set */ | 1060 | * filled into the private structure this should confirm that all is |
| 1061 | * working if it returns what we just set */ | ||
| 1018 | cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG); | 1062 | cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG); |
| 1019 | 1063 | ||
| 1020 | /* Here we can define custom tty settings for devices | 1064 | /* Here we can define custom tty settings for devices; the main tty |
| 1021 | * | 1065 | * termios flag base comes from empeg.c */ |
| 1022 | * the main tty termios flag base comes from empeg.c | ||
| 1023 | */ | ||
| 1024 | 1066 | ||
| 1025 | spin_lock_irqsave(&priv->lock, flags); | 1067 | spin_lock_irqsave(&priv->lock, flags); |
| 1026 | if ( (priv->chiptype == CT_EARTHMATE) && (priv->baud_rate == 4800) ) { | 1068 | if ( (priv->chiptype == CT_EARTHMATE) && (priv->baud_rate == 4800) ) { |
| 1027 | 1069 | dbg("Using custom termios settings for a baud rate of " | |
| 1028 | dbg("Using custom termios settings for a baud rate of 4800bps."); | 1070 | "4800bps."); |
| 1029 | /* define custom termios settings for NMEA protocol */ | 1071 | /* define custom termios settings for NMEA protocol */ |
| 1030 | 1072 | ||
| 1031 | tty->termios->c_iflag /* input modes - */ | 1073 | tty->termios->c_iflag /* input modes - */ |
| 1032 | &= ~(IGNBRK /* disable ignore break */ | 1074 | &= ~(IGNBRK /* disable ignore break */ |
| 1033 | | BRKINT /* disable break causes interrupt */ | 1075 | | BRKINT /* disable break causes interrupt */ |
| 1034 | | PARMRK /* disable mark parity errors */ | 1076 | | PARMRK /* disable mark parity errors */ |
| 1035 | | ISTRIP /* disable clear high bit of input characters */ | 1077 | | ISTRIP /* disable clear high bit of input char */ |
| 1036 | | INLCR /* disable translate NL to CR */ | 1078 | | INLCR /* disable translate NL to CR */ |
| 1037 | | IGNCR /* disable ignore CR */ | 1079 | | IGNCR /* disable ignore CR */ |
| 1038 | | ICRNL /* disable translate CR to NL */ | 1080 | | ICRNL /* disable translate CR to NL */ |
| 1039 | | IXON); /* disable enable XON/XOFF flow control */ | 1081 | | IXON); /* disable enable XON/XOFF flow control */ |
| 1040 | 1082 | ||
| 1041 | tty->termios->c_oflag /* output modes */ | 1083 | tty->termios->c_oflag /* output modes */ |
| 1042 | &= ~OPOST; /* disable postprocess output characters */ | 1084 | &= ~OPOST; /* disable postprocess output char */ |
| 1043 | |||
| 1044 | tty->termios->c_lflag /* line discipline modes */ | ||
| 1045 | &= ~(ECHO /* disable echo input characters */ | ||
| 1046 | | ECHONL /* disable echo new line */ | ||
| 1047 | | ICANON /* disable erase, kill, werase, and rprnt special characters */ | ||
| 1048 | | ISIG /* disable interrupt, quit, and suspend special characters */ | ||
| 1049 | | IEXTEN); /* disable non-POSIX special characters */ | ||
| 1050 | 1085 | ||
| 1086 | tty->termios->c_lflag /* line discipline modes */ | ||
| 1087 | &= ~(ECHO /* disable echo input characters */ | ||
| 1088 | | ECHONL /* disable echo new line */ | ||
| 1089 | | ICANON /* disable erase, kill, werase, and rprnt | ||
| 1090 | special characters */ | ||
| 1091 | | ISIG /* disable interrupt, quit, and suspend | ||
| 1092 | special characters */ | ||
| 1093 | | IEXTEN); /* disable non-POSIX special characters */ | ||
| 1051 | } /* CT_CYPHIDCOM: Application should handle this for device */ | 1094 | } /* CT_CYPHIDCOM: Application should handle this for device */ |
| 1052 | 1095 | ||
| 1053 | linechange = (priv->line_control != oldlines); | 1096 | linechange = (priv->line_control != oldlines); |
| @@ -1060,7 +1103,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
| 1060 | } | 1103 | } |
| 1061 | } /* cypress_set_termios */ | 1104 | } /* cypress_set_termios */ |
| 1062 | 1105 | ||
| 1063 | 1106 | ||
| 1064 | /* returns amount of data still left in soft buffer */ | 1107 | /* returns amount of data still left in soft buffer */ |
| 1065 | static int cypress_chars_in_buffer(struct usb_serial_port *port) | 1108 | static int cypress_chars_in_buffer(struct usb_serial_port *port) |
| 1066 | { | 1109 | { |
| @@ -1088,7 +1131,7 @@ static void cypress_throttle (struct usb_serial_port *port) | |||
| 1088 | 1131 | ||
| 1089 | spin_lock_irqsave(&priv->lock, flags); | 1132 | spin_lock_irqsave(&priv->lock, flags); |
| 1090 | priv->rx_flags = THROTTLED; | 1133 | priv->rx_flags = THROTTLED; |
| 1091 | spin_unlock_irqrestore(&priv->lock, flags); | 1134 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1092 | } | 1135 | } |
| 1093 | 1136 | ||
| 1094 | 1137 | ||
| @@ -1110,7 +1153,8 @@ static void cypress_unthrottle (struct usb_serial_port *port) | |||
| 1110 | 1153 | ||
| 1111 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 1154 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
| 1112 | if (result) | 1155 | if (result) |
| 1113 | dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); | 1156 | dev_err(&port->dev, "%s - failed submitting read urb, " |
| 1157 | "error %d\n", __FUNCTION__, result); | ||
| 1114 | } | 1158 | } |
| 1115 | } | 1159 | } |
| 1116 | 1160 | ||
| @@ -1122,7 +1166,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
| 1122 | struct tty_struct *tty; | 1166 | struct tty_struct *tty; |
| 1123 | unsigned char *data = urb->transfer_buffer; | 1167 | unsigned char *data = urb->transfer_buffer; |
| 1124 | unsigned long flags; | 1168 | unsigned long flags; |
| 1125 | char tty_flag = TTY_NORMAL; | 1169 | char tty_flag = TTY_NORMAL; |
| 1126 | int havedata = 0; | 1170 | int havedata = 0; |
| 1127 | int bytes = 0; | 1171 | int bytes = 0; |
| 1128 | int result; | 1172 | int result; |
| @@ -1131,7 +1175,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
| 1131 | dbg("%s - port %d", __FUNCTION__, port->number); | 1175 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 1132 | 1176 | ||
| 1133 | if (urb->status) { | 1177 | if (urb->status) { |
| 1134 | dbg("%s - nonzero read status received: %d", __FUNCTION__, urb->status); | 1178 | dbg("%s - nonzero read status received: %d", __FUNCTION__, |
| 1179 | urb->status); | ||
| 1135 | return; | 1180 | return; |
| 1136 | } | 1181 | } |
| 1137 | 1182 | ||
| @@ -1155,51 +1200,55 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
| 1155 | case 32: | 1200 | case 32: |
| 1156 | /* This is for the CY7C64013... */ | 1201 | /* This is for the CY7C64013... */ |
| 1157 | priv->current_status = data[0] & 0xF8; | 1202 | priv->current_status = data[0] & 0xF8; |
| 1158 | bytes = data[1]+2; | 1203 | bytes = data[1] + 2; |
| 1159 | i=2; | 1204 | i = 2; |
| 1160 | if (bytes > 2) | 1205 | if (bytes > 2) |
| 1161 | havedata = 1; | 1206 | havedata = 1; |
| 1162 | break; | 1207 | break; |
| 1163 | case 8: | 1208 | case 8: |
| 1164 | /* This is for the CY7C63743... */ | 1209 | /* This is for the CY7C63743... */ |
| 1165 | priv->current_status = data[0] & 0xF8; | 1210 | priv->current_status = data[0] & 0xF8; |
| 1166 | bytes = (data[0] & 0x07)+1; | 1211 | bytes = (data[0] & 0x07) + 1; |
| 1167 | i=1; | 1212 | i = 1; |
| 1168 | if (bytes > 1) | 1213 | if (bytes > 1) |
| 1169 | havedata = 1; | 1214 | havedata = 1; |
| 1170 | break; | 1215 | break; |
| 1171 | default: | 1216 | default: |
| 1172 | dbg("%s - wrong packet size - received %d bytes", __FUNCTION__, urb->actual_length); | 1217 | dbg("%s - wrong packet size - received %d bytes", |
| 1218 | __FUNCTION__, urb->actual_length); | ||
| 1173 | spin_unlock_irqrestore(&priv->lock, flags); | 1219 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1174 | goto continue_read; | 1220 | goto continue_read; |
| 1175 | } | 1221 | } |
| 1176 | spin_unlock_irqrestore(&priv->lock, flags); | 1222 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1177 | 1223 | ||
| 1178 | usb_serial_debug_data (debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 1224 | usb_serial_debug_data (debug, &port->dev, __FUNCTION__, |
| 1225 | urb->actual_length, data); | ||
| 1179 | 1226 | ||
| 1180 | spin_lock_irqsave(&priv->lock, flags); | 1227 | spin_lock_irqsave(&priv->lock, flags); |
| 1181 | /* check to see if status has changed */ | 1228 | /* check to see if status has changed */ |
| 1182 | if (priv != NULL) { | 1229 | if (priv != NULL) { |
| 1183 | if (priv->current_status != priv->prev_status) { | 1230 | if (priv->current_status != priv->prev_status) { |
| 1184 | priv->diff_status |= priv->current_status ^ priv->prev_status; | 1231 | priv->diff_status |= priv->current_status ^ |
| 1232 | priv->prev_status; | ||
| 1185 | wake_up_interruptible(&priv->delta_msr_wait); | 1233 | wake_up_interruptible(&priv->delta_msr_wait); |
| 1186 | priv->prev_status = priv->current_status; | 1234 | priv->prev_status = priv->current_status; |
| 1187 | } | 1235 | } |
| 1188 | } | 1236 | } |
| 1189 | spin_unlock_irqrestore(&priv->lock, flags); | 1237 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1190 | 1238 | ||
| 1191 | /* hangup, as defined in acm.c... this might be a bad place for it though */ | 1239 | /* hangup, as defined in acm.c... this might be a bad place for it |
| 1192 | if (tty && !(tty->termios->c_cflag & CLOCAL) && !(priv->current_status & UART_CD)) { | 1240 | * though */ |
| 1241 | if (tty && !(tty->termios->c_cflag & CLOCAL) && | ||
| 1242 | !(priv->current_status & UART_CD)) { | ||
| 1193 | dbg("%s - calling hangup", __FUNCTION__); | 1243 | dbg("%s - calling hangup", __FUNCTION__); |
| 1194 | tty_hangup(tty); | 1244 | tty_hangup(tty); |
| 1195 | goto continue_read; | 1245 | goto continue_read; |
| 1196 | } | 1246 | } |
| 1197 | 1247 | ||
| 1198 | /* There is one error bit... I'm assuming it is a parity error indicator | 1248 | /* There is one error bit... I'm assuming it is a parity error |
| 1199 | * as the generic firmware will set this bit to 1 if a parity error occurs. | 1249 | * indicator as the generic firmware will set this bit to 1 if a |
| 1200 | * I can not find reference to any other error events. | 1250 | * parity error occurs. |
| 1201 | * | 1251 | * I can not find reference to any other error events. */ |
| 1202 | */ | ||
| 1203 | spin_lock_irqsave(&priv->lock, flags); | 1252 | spin_lock_irqsave(&priv->lock, flags); |
| 1204 | if (priv->current_status & CYP_ERROR) { | 1253 | if (priv->current_status & CYP_ERROR) { |
| 1205 | spin_unlock_irqrestore(&priv->lock, flags); | 1254 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -1211,7 +1260,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
| 1211 | /* process read if there is data other than line status */ | 1260 | /* process read if there is data other than line status */ |
| 1212 | if (tty && (bytes > i)) { | 1261 | if (tty && (bytes > i)) { |
| 1213 | for (; i < bytes ; ++i) { | 1262 | for (; i < bytes ; ++i) { |
| 1214 | dbg("pushing byte number %d - %d - %c",i,data[i],data[i]); | 1263 | dbg("pushing byte number %d - %d - %c", i, data[i], |
| 1264 | data[i]); | ||
| 1215 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1265 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { |
| 1216 | tty_flip_buffer_push(tty); | 1266 | tty_flip_buffer_push(tty); |
| 1217 | } | 1267 | } |
| @@ -1221,25 +1271,28 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
| 1221 | } | 1271 | } |
| 1222 | 1272 | ||
| 1223 | spin_lock_irqsave(&priv->lock, flags); | 1273 | spin_lock_irqsave(&priv->lock, flags); |
| 1224 | priv->bytes_in += bytes; /* control and status byte(s) are also counted */ | 1274 | /* control and status byte(s) are also counted */ |
| 1275 | priv->bytes_in += bytes; | ||
| 1225 | spin_unlock_irqrestore(&priv->lock, flags); | 1276 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1226 | 1277 | ||
| 1227 | continue_read: | 1278 | continue_read: |
| 1228 | 1279 | ||
| 1229 | /* Continue trying to always read... unless the port has closed. */ | 1280 | /* Continue trying to always read... unless the port has closed. */ |
| 1230 | 1281 | ||
| 1231 | if (port->open_count > 0) { | 1282 | if (port->open_count > 0) { |
| 1232 | usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev, | 1283 | usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev, |
| 1233 | usb_rcvintpipe(port->serial->dev, port->interrupt_in_endpointAddress), | 1284 | usb_rcvintpipe(port->serial->dev, |
| 1234 | port->interrupt_in_urb->transfer_buffer, | 1285 | port->interrupt_in_endpointAddress), |
| 1235 | port->interrupt_in_urb->transfer_buffer_length, | 1286 | port->interrupt_in_urb->transfer_buffer, |
| 1236 | cypress_read_int_callback, port, | 1287 | port->interrupt_in_urb->transfer_buffer_length, |
| 1237 | interval); | 1288 | cypress_read_int_callback, port, interval); |
| 1238 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 1289 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
| 1239 | if (result) | 1290 | if (result) |
| 1240 | dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); | 1291 | dev_err(&urb->dev->dev, "%s - failed resubmitting " |
| 1292 | "read urb, error %d\n", __FUNCTION__, | ||
| 1293 | result); | ||
| 1241 | } | 1294 | } |
| 1242 | 1295 | ||
| 1243 | return; | 1296 | return; |
| 1244 | } /* cypress_read_int_callback */ | 1297 | } /* cypress_read_int_callback */ |
| 1245 | 1298 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index d1964a0c4168..0a6e8b474b1f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -269,6 +269,8 @@ | |||
| 269 | #define DRIVER_DESC "USB FTDI Serial Converters Driver" | 269 | #define DRIVER_DESC "USB FTDI Serial Converters Driver" |
| 270 | 270 | ||
| 271 | static int debug; | 271 | static int debug; |
| 272 | static __u16 vendor = FTDI_VID; | ||
| 273 | static __u16 product; | ||
| 272 | 274 | ||
| 273 | /* struct ftdi_sio_quirk is used by devices requiring special attention. */ | 275 | /* struct ftdi_sio_quirk is used by devices requiring special attention. */ |
| 274 | struct ftdi_sio_quirk { | 276 | struct ftdi_sio_quirk { |
| @@ -407,6 +409,34 @@ static struct usb_device_id id_table_combined [] = { | |||
| 407 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88F_PID) }, | 409 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88F_PID) }, |
| 408 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, | 410 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, |
| 409 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, | 411 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, |
| 412 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UR100_PID) }, | ||
| 413 | { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, | ||
| 414 | /* | ||
| 415 | * These will probably use user-space drivers. Uncomment them if | ||
| 416 | * you need them or use the user-specified vendor/product module | ||
| 417 | * parameters (see ftdi_sio.h for the numbers). Make a fuss if | ||
| 418 | * you think the driver should recognize any of them by default. | ||
| 419 | */ | ||
| 420 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_CLI7000_PID) }, */ | ||
| 421 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PPS7330_PID) }, */ | ||
| 422 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_TFM100_PID) }, */ | ||
| 423 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_UDF77_PID) }, */ | ||
| 424 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_UIO88_PID) }, */ | ||
| 425 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_UAD8_PID) }, */ | ||
| 426 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_UDA7_PID) }, */ | ||
| 427 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_USI2_PID) }, */ | ||
| 428 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_T1100_PID) }, */ | ||
| 429 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PCD200_PID) }, */ | ||
| 430 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_ULA200_PID) }, */ | ||
| 431 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, */ | ||
| 432 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_CSI8_PID) }, */ | ||
| 433 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1000DL_PID) }, */ | ||
| 434 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) }, */ | ||
| 435 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_RFP500_PID) }, */ | ||
| 436 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) }, */ | ||
| 437 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, */ | ||
| 438 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, */ | ||
| 439 | /* { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, */ | ||
| 410 | { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, | 440 | { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, |
| 411 | { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, | 441 | { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, |
| 412 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, | 442 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, |
| @@ -418,6 +448,7 @@ static struct usb_device_id id_table_combined [] = { | |||
| 418 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, | 448 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, |
| 419 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, | 449 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, |
| 420 | { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, | 450 | { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, |
| 451 | { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, | ||
| 421 | { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, | 452 | { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, |
| 422 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, | 453 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
| 423 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, | 454 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
| @@ -427,12 +458,21 @@ static struct usb_device_id id_table_combined [] = { | |||
| 427 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID) }, | 458 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID) }, |
| 428 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, | 459 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, |
| 429 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, | 460 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, |
| 461 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, | ||
| 462 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) }, | ||
| 463 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) }, | ||
| 464 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_3_PID) }, | ||
| 465 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_4_PID) }, | ||
| 466 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, | ||
| 467 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, | ||
| 468 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, | ||
| 430 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 469 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
| 431 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, | 470 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, |
| 432 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, | 471 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, |
| 433 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, | 472 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, |
| 434 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | 473 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, |
| 435 | { } /* Terminating entry */ | 474 | { }, /* Optional parameter entry */ |
| 475 | { } /* Terminating entry */ | ||
| 436 | }; | 476 | }; |
| 437 | 477 | ||
| 438 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 478 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
| @@ -2030,6 +2070,15 @@ static int __init ftdi_init (void) | |||
| 2030 | int retval; | 2070 | int retval; |
| 2031 | 2071 | ||
| 2032 | dbg("%s", __FUNCTION__); | 2072 | dbg("%s", __FUNCTION__); |
| 2073 | if (vendor > 0 && product > 0) { | ||
| 2074 | /* Add user specified VID/PID to reserved element of table. */ | ||
| 2075 | int i; | ||
| 2076 | for (i = 0; id_table_combined[i].idVendor; i++) | ||
| 2077 | ; | ||
| 2078 | id_table_combined[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | ||
| 2079 | id_table_combined[i].idVendor = vendor; | ||
| 2080 | id_table_combined[i].idProduct = product; | ||
| 2081 | } | ||
| 2033 | retval = usb_serial_register(&ftdi_sio_device); | 2082 | retval = usb_serial_register(&ftdi_sio_device); |
| 2034 | if (retval) | 2083 | if (retval) |
| 2035 | goto failed_sio_register; | 2084 | goto failed_sio_register; |
| @@ -2066,4 +2115,9 @@ MODULE_LICENSE("GPL"); | |||
| 2066 | 2115 | ||
| 2067 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 2116 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
| 2068 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 2117 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
| 2118 | module_param(vendor, ushort, 0); | ||
| 2119 | MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" | ||
| 2120 | __MODULE_STRING(FTDI_VID)")"); | ||
| 2121 | module_param(product, ushort, 0); | ||
| 2122 | MODULE_PARM_DESC(vendor, "User specified product ID"); | ||
| 2069 | 2123 | ||
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 9f4342093e8b..2c35d74cc6d6 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
| @@ -142,10 +142,43 @@ | |||
| 142 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ | 142 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ |
| 143 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ | 143 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ |
| 144 | 144 | ||
| 145 | /* ELV USB Module UO100 (PID sent by Stefan Frings) */ | 145 | /* |
| 146 | #define FTDI_ELV_UO100_PID 0xFB58 /* Product Id */ | 146 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). |
| 147 | /* ELV USB Module UM100 (PID sent by Arnim Laeuger) */ | 147 | * All of these devices use FTDI's vendor ID (0x0403). |
| 148 | #define FTDI_ELV_UM100_PID 0xFB5A /* Product Id */ | 148 | * |
| 149 | * The previously included PID for the UO 100 module was incorrect. | ||
| 150 | * In fact, that PID was for ELV's UR 100 USB-RS232 converter (0xFB58). | ||
| 151 | * | ||
| 152 | * Armin Laeuger originally sent the PID for the UM 100 module. | ||
| 153 | */ | ||
| 154 | #define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */ | ||
| 155 | #define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */ | ||
| 156 | #define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */ | ||
| 157 | #define FTDI_ELV_ALC8500_PID 0xF06E /* ALC 8500 Expert */ | ||
| 158 | /* Additional ELV PIDs that default to using the FTDI D2XX drivers on | ||
| 159 | * MS Windows, rather than the FTDI Virtual Com Port drivers. | ||
| 160 | * Maybe these will be easier to use with the libftdi/libusb user-space | ||
| 161 | * drivers, or possibly the Comedi drivers in some cases. */ | ||
| 162 | #define FTDI_ELV_CLI7000_PID 0xFB59 /* Computer-Light-Interface (CLI 7000) */ | ||
| 163 | #define FTDI_ELV_PPS7330_PID 0xFB5C /* Processor-Power-Supply (PPS 7330) */ | ||
| 164 | #define FTDI_ELV_TFM100_PID 0xFB5D /* Temperartur-Feuchte Messgeraet (TFM 100) */ | ||
| 165 | #define FTDI_ELV_UDF77_PID 0xFB5E /* USB DCF Funkurh (UDF 77) */ | ||
| 166 | #define FTDI_ELV_UIO88_PID 0xFB5F /* USB-I/O Interface (UIO 88) */ | ||
| 167 | #define FTDI_ELV_UAD8_PID 0xF068 /* USB-AD-Wandler (UAD 8) */ | ||
| 168 | #define FTDI_ELV_UDA7_PID 0xF069 /* USB-DA-Wandler (UDA 7) */ | ||
| 169 | #define FTDI_ELV_USI2_PID 0xF06A /* USB-Schrittmotoren-Interface (USI 2) */ | ||
| 170 | #define FTDI_ELV_T1100_PID 0xF06B /* Thermometer (T 1100) */ | ||
| 171 | #define FTDI_ELV_PCD200_PID 0xF06C /* PC-Datenlogger (PCD 200) */ | ||
| 172 | #define FTDI_ELV_ULA200_PID 0xF06D /* USB-LCD-Ansteuerung (ULA 200) */ | ||
| 173 | #define FTDI_ELV_FHZ1000PC_PID 0xF06F /* FHZ 1000 PC */ | ||
| 174 | #define FTDI_ELV_CSI8_PID 0xE0F0 /* Computer-Schalt-Interface (CSI 8) */ | ||
| 175 | #define FTDI_ELV_EM1000DL_PID 0xE0F1 /* PC-Datenlogger fuer Energiemonitor (EM 1000 DL) */ | ||
| 176 | #define FTDI_ELV_PCK100_PID 0xE0F2 /* PC-Kabeltester (PCK 100) */ | ||
| 177 | #define FTDI_ELV_RFP500_PID 0xE0F3 /* HF-Leistungsmesser (RFP 500) */ | ||
| 178 | #define FTDI_ELV_FS20SIG_PID 0xE0F4 /* Signalgeber (FS 20 SIG) */ | ||
| 179 | #define FTDI_ELV_WS300PC_PID 0xE0F6 /* PC-Wetterstation (WS 300 PC) */ | ||
| 180 | #define FTDI_ELV_FHZ1300PC_PID 0xE0E8 /* FHZ 1300 PC */ | ||
| 181 | #define FTDI_ELV_WS500_PID 0xE0E9 /* PC-Wetterstation (WS 500) */ | ||
| 149 | 182 | ||
| 150 | /* | 183 | /* |
| 151 | * Definitions for ID TECH (www.idt-net.com) devices | 184 | * Definitions for ID TECH (www.idt-net.com) devices |
| @@ -222,6 +255,7 @@ | |||
| 222 | */ | 255 | */ |
| 223 | #define FALCOM_VID 0x0F94 /* Vendor Id */ | 256 | #define FALCOM_VID 0x0F94 /* Vendor Id */ |
| 224 | #define FALCOM_TWIST_PID 0x0001 /* Falcom Twist USB GPRS modem */ | 257 | #define FALCOM_TWIST_PID 0x0001 /* Falcom Twist USB GPRS modem */ |
| 258 | #define FALCOM_SAMBA_PID 0x0005 /* Falcom Samba USB GPRS modem */ | ||
| 225 | 259 | ||
| 226 | /* | 260 | /* |
| 227 | * SUUNTO product ids | 261 | * SUUNTO product ids |
| @@ -277,6 +311,18 @@ | |||
| 277 | #define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ | 311 | #define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ |
| 278 | 312 | ||
| 279 | /* | 313 | /* |
| 314 | * Xsens Technologies BV products (http://www.xsens.com). | ||
| 315 | */ | ||
| 316 | #define XSENS_CONVERTER_0_PID 0xD388 | ||
| 317 | #define XSENS_CONVERTER_1_PID 0xD389 | ||
| 318 | #define XSENS_CONVERTER_2_PID 0xD38A | ||
| 319 | #define XSENS_CONVERTER_3_PID 0xD38B | ||
| 320 | #define XSENS_CONVERTER_4_PID 0xD38C | ||
| 321 | #define XSENS_CONVERTER_5_PID 0xD38D | ||
| 322 | #define XSENS_CONVERTER_6_PID 0xD38E | ||
| 323 | #define XSENS_CONVERTER_7_PID 0xD38F | ||
| 324 | |||
| 325 | /* | ||
| 280 | * Evolution Robotics products (http://www.evolution.com/). | 326 | * Evolution Robotics products (http://www.evolution.com/). |
| 281 | * Submitted by Shawn M. Lavelle. | 327 | * Submitted by Shawn M. Lavelle. |
| 282 | */ | 328 | */ |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index fb0926292228..3b958e60f5e8 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
| @@ -383,11 +383,8 @@ static int keyspan_write(struct usb_serial_port *port, | |||
| 383 | dbg("%s - endpoint %d flip %d", __FUNCTION__, usb_pipeendpoint(this_urb->pipe), flip); | 383 | dbg("%s - endpoint %d flip %d", __FUNCTION__, usb_pipeendpoint(this_urb->pipe), flip); |
| 384 | 384 | ||
| 385 | if (this_urb->status == -EINPROGRESS) { | 385 | if (this_urb->status == -EINPROGRESS) { |
| 386 | if (this_urb->transfer_flags & URB_ASYNC_UNLINK) | ||
| 387 | break; | ||
| 388 | if (time_before(jiffies, p_priv->tx_start_time[flip] + 10 * HZ)) | 386 | if (time_before(jiffies, p_priv->tx_start_time[flip] + 10 * HZ)) |
| 389 | break; | 387 | break; |
| 390 | this_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
| 391 | usb_unlink_urb(this_urb); | 388 | usb_unlink_urb(this_urb); |
| 392 | break; | 389 | break; |
| 393 | } | 390 | } |
| @@ -402,7 +399,6 @@ static int keyspan_write(struct usb_serial_port *port, | |||
| 402 | /* send the data out the bulk port */ | 399 | /* send the data out the bulk port */ |
| 403 | this_urb->transfer_buffer_length = todo + dataOffset; | 400 | this_urb->transfer_buffer_length = todo + dataOffset; |
| 404 | 401 | ||
| 405 | this_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
| 406 | this_urb->dev = port->serial->dev; | 402 | this_urb->dev = port->serial->dev; |
| 407 | if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { | 403 | if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { |
| 408 | dbg("usb_submit_urb(write bulk) failed (%d)", err); | 404 | dbg("usb_submit_urb(write bulk) failed (%d)", err); |
| @@ -1119,10 +1115,8 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
| 1119 | 1115 | ||
| 1120 | static inline void stop_urb(struct urb *urb) | 1116 | static inline void stop_urb(struct urb *urb) |
| 1121 | { | 1117 | { |
| 1122 | if (urb && urb->status == -EINPROGRESS) { | 1118 | if (urb && urb->status == -EINPROGRESS) |
| 1123 | urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
| 1124 | usb_kill_urb(urb); | 1119 | usb_kill_urb(urb); |
| 1125 | } | ||
| 1126 | } | 1120 | } |
| 1127 | 1121 | ||
| 1128 | static void keyspan_close(struct usb_serial_port *port, struct file *filp) | 1122 | static void keyspan_close(struct usb_serial_port *port, struct file *filp) |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e9256408757f..92d0f925d053 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -45,29 +45,29 @@ | |||
| 45 | #include "usb-serial.h" | 45 | #include "usb-serial.h" |
| 46 | 46 | ||
| 47 | /* Function prototypes */ | 47 | /* Function prototypes */ |
| 48 | static int option_open (struct usb_serial_port *port, struct file *filp); | 48 | static int option_open(struct usb_serial_port *port, struct file *filp); |
| 49 | static void option_close (struct usb_serial_port *port, struct file *filp); | 49 | static void option_close(struct usb_serial_port *port, struct file *filp); |
| 50 | static int option_startup (struct usb_serial *serial); | 50 | static int option_startup(struct usb_serial *serial); |
| 51 | static void option_shutdown (struct usb_serial *serial); | 51 | static void option_shutdown(struct usb_serial *serial); |
| 52 | static void option_rx_throttle (struct usb_serial_port *port); | 52 | static void option_rx_throttle(struct usb_serial_port *port); |
| 53 | static void option_rx_unthrottle (struct usb_serial_port *port); | 53 | static void option_rx_unthrottle(struct usb_serial_port *port); |
| 54 | static int option_write_room (struct usb_serial_port *port); | 54 | static int option_write_room(struct usb_serial_port *port); |
| 55 | 55 | ||
| 56 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs); | 56 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs); |
| 57 | 57 | ||
| 58 | static int option_write (struct usb_serial_port *port, | 58 | static int option_write(struct usb_serial_port *port, |
| 59 | const unsigned char *buf, int count); | 59 | const unsigned char *buf, int count); |
| 60 | 60 | ||
| 61 | static int option_chars_in_buffer (struct usb_serial_port *port); | 61 | static int option_chars_in_buffer(struct usb_serial_port *port); |
| 62 | static int option_ioctl (struct usb_serial_port *port, struct file *file, | 62 | static int option_ioctl(struct usb_serial_port *port, struct file *file, |
| 63 | unsigned int cmd, unsigned long arg); | 63 | unsigned int cmd, unsigned long arg); |
| 64 | static void option_set_termios (struct usb_serial_port *port, | 64 | static void option_set_termios(struct usb_serial_port *port, |
| 65 | struct termios *old); | 65 | struct termios *old); |
| 66 | static void option_break_ctl (struct usb_serial_port *port, int break_state); | 66 | static void option_break_ctl(struct usb_serial_port *port, int break_state); |
| 67 | static int option_tiocmget (struct usb_serial_port *port, struct file *file); | 67 | static int option_tiocmget(struct usb_serial_port *port, struct file *file); |
| 68 | static int option_tiocmset (struct usb_serial_port *port, struct file *file, | 68 | static int option_tiocmset(struct usb_serial_port *port, struct file *file, |
| 69 | unsigned int set, unsigned int clear); | 69 | unsigned int set, unsigned int clear); |
| 70 | static int option_send_setup (struct usb_serial_port *port); | 70 | static int option_send_setup(struct usb_serial_port *port); |
| 71 | 71 | ||
| 72 | /* Vendor and product IDs */ | 72 | /* Vendor and product IDs */ |
| 73 | #define OPTION_VENDOR_ID 0x0AF0 | 73 | #define OPTION_VENDOR_ID 0x0AF0 |
| @@ -76,7 +76,6 @@ static int option_send_setup (struct usb_serial_port *port); | |||
| 76 | #define OPTION_PRODUCT_FUSION 0x6000 | 76 | #define OPTION_PRODUCT_FUSION 0x6000 |
| 77 | #define OPTION_PRODUCT_FUSION2 0x6300 | 77 | #define OPTION_PRODUCT_FUSION2 0x6300 |
| 78 | 78 | ||
| 79 | |||
| 80 | static struct usb_device_id option_ids[] = { | 79 | static struct usb_device_id option_ids[] = { |
| 81 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, | 80 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, |
| 82 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, | 81 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, |
| @@ -129,7 +128,6 @@ static int debug; | |||
| 129 | #define debug 0 | 128 | #define debug 0 |
| 130 | #endif | 129 | #endif |
| 131 | 130 | ||
| 132 | |||
| 133 | /* per port private data */ | 131 | /* per port private data */ |
| 134 | 132 | ||
| 135 | #define N_IN_URB 4 | 133 | #define N_IN_URB 4 |
| @@ -156,10 +154,8 @@ struct option_port_private { | |||
| 156 | unsigned long tx_start_time[N_OUT_URB]; | 154 | unsigned long tx_start_time[N_OUT_URB]; |
| 157 | }; | 155 | }; |
| 158 | 156 | ||
| 159 | |||
| 160 | /* Functions used by new usb-serial code. */ | 157 | /* Functions used by new usb-serial code. */ |
| 161 | static int __init | 158 | static int __init option_init(void) |
| 162 | option_init (void) | ||
| 163 | { | 159 | { |
| 164 | int retval; | 160 | int retval; |
| 165 | retval = usb_serial_register(&option_3port_device); | 161 | retval = usb_serial_register(&option_3port_device); |
| @@ -179,8 +175,7 @@ failed_3port_device_register: | |||
| 179 | return retval; | 175 | return retval; |
| 180 | } | 176 | } |
| 181 | 177 | ||
| 182 | static void __exit | 178 | static void __exit option_exit(void) |
| 183 | option_exit (void) | ||
| 184 | { | 179 | { |
| 185 | usb_deregister (&option_driver); | 180 | usb_deregister (&option_driver); |
| 186 | usb_serial_deregister (&option_3port_device); | 181 | usb_serial_deregister (&option_3port_device); |
| @@ -189,39 +184,31 @@ option_exit (void) | |||
| 189 | module_init(option_init); | 184 | module_init(option_init); |
| 190 | module_exit(option_exit); | 185 | module_exit(option_exit); |
| 191 | 186 | ||
| 192 | static void | 187 | static void option_rx_throttle(struct usb_serial_port *port) |
| 193 | option_rx_throttle (struct usb_serial_port *port) | ||
| 194 | { | 188 | { |
| 195 | dbg("%s", __FUNCTION__); | 189 | dbg("%s", __FUNCTION__); |
| 196 | } | 190 | } |
| 197 | 191 | ||
| 198 | 192 | static void option_rx_unthrottle(struct usb_serial_port *port) | |
| 199 | static void | ||
| 200 | option_rx_unthrottle (struct usb_serial_port *port) | ||
| 201 | { | 193 | { |
| 202 | dbg("%s", __FUNCTION__); | 194 | dbg("%s", __FUNCTION__); |
| 203 | } | 195 | } |
| 204 | 196 | ||
| 205 | 197 | static void option_break_ctl(struct usb_serial_port *port, int break_state) | |
| 206 | static void | ||
| 207 | option_break_ctl (struct usb_serial_port *port, int break_state) | ||
| 208 | { | 198 | { |
| 209 | /* Unfortunately, I don't know how to send a break */ | 199 | /* Unfortunately, I don't know how to send a break */ |
| 210 | dbg("%s", __FUNCTION__); | 200 | dbg("%s", __FUNCTION__); |
| 211 | } | 201 | } |
| 212 | 202 | ||
| 213 | 203 | static void option_set_termios(struct usb_serial_port *port, | |
| 214 | static void | 204 | struct termios *old_termios) |
| 215 | option_set_termios (struct usb_serial_port *port, | ||
| 216 | struct termios *old_termios) | ||
| 217 | { | 205 | { |
| 218 | dbg("%s", __FUNCTION__); | 206 | dbg("%s", __FUNCTION__); |
| 219 | 207 | ||
| 220 | option_send_setup(port); | 208 | option_send_setup(port); |
| 221 | } | 209 | } |
| 222 | 210 | ||
| 223 | static int | 211 | static int option_tiocmget(struct usb_serial_port *port, struct file *file) |
| 224 | option_tiocmget (struct usb_serial_port *port, struct file *file) | ||
| 225 | { | 212 | { |
| 226 | unsigned int value; | 213 | unsigned int value; |
| 227 | struct option_port_private *portdata; | 214 | struct option_port_private *portdata; |
| @@ -238,9 +225,8 @@ option_tiocmget (struct usb_serial_port *port, struct file *file) | |||
| 238 | return value; | 225 | return value; |
| 239 | } | 226 | } |
| 240 | 227 | ||
| 241 | static int | 228 | static int option_tiocmset(struct usb_serial_port *port, struct file *file, |
| 242 | option_tiocmset (struct usb_serial_port *port, struct file *file, | 229 | unsigned int set, unsigned int clear) |
| 243 | unsigned int set, unsigned int clear) | ||
| 244 | { | 230 | { |
| 245 | struct option_port_private *portdata; | 231 | struct option_port_private *portdata; |
| 246 | 232 | ||
| @@ -258,17 +244,15 @@ option_tiocmset (struct usb_serial_port *port, struct file *file, | |||
| 258 | return option_send_setup(port); | 244 | return option_send_setup(port); |
| 259 | } | 245 | } |
| 260 | 246 | ||
| 261 | static int | 247 | static int option_ioctl(struct usb_serial_port *port, struct file *file, |
| 262 | option_ioctl (struct usb_serial_port *port, struct file *file, | 248 | unsigned int cmd, unsigned long arg) |
| 263 | unsigned int cmd, unsigned long arg) | ||
| 264 | { | 249 | { |
| 265 | return -ENOIOCTLCMD; | 250 | return -ENOIOCTLCMD; |
| 266 | } | 251 | } |
| 267 | 252 | ||
| 268 | /* Write */ | 253 | /* Write */ |
| 269 | static int | 254 | static int option_write(struct usb_serial_port *port, |
| 270 | option_write (struct usb_serial_port *port, | 255 | const unsigned char *buf, int count) |
| 271 | const unsigned char *buf, int count) | ||
| 272 | { | 256 | { |
| 273 | struct option_port_private *portdata; | 257 | struct option_port_private *portdata; |
| 274 | int i; | 258 | int i; |
| @@ -289,28 +273,29 @@ option_write (struct usb_serial_port *port, | |||
| 289 | 273 | ||
| 290 | this_urb = portdata->out_urbs[i]; | 274 | this_urb = portdata->out_urbs[i]; |
| 291 | if (this_urb->status == -EINPROGRESS) { | 275 | if (this_urb->status == -EINPROGRESS) { |
| 292 | if (this_urb->transfer_flags & URB_ASYNC_UNLINK) | 276 | if (time_before(jiffies, |
| 293 | continue; | 277 | portdata->tx_start_time[i] + 10 * HZ)) |
| 294 | if (time_before(jiffies, portdata->tx_start_time[i] + 10 * HZ)) | ||
| 295 | continue; | 278 | continue; |
| 296 | this_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
| 297 | usb_unlink_urb(this_urb); | 279 | usb_unlink_urb(this_urb); |
| 298 | continue; | 280 | continue; |
| 299 | } | 281 | } |
| 300 | if (this_urb->status != 0) | 282 | if (this_urb->status != 0) |
| 301 | dbg("usb_write %p failed (err=%d)", this_urb, this_urb->status); | 283 | dbg("usb_write %p failed (err=%d)", |
| 284 | this_urb, this_urb->status); | ||
| 302 | 285 | ||
| 303 | dbg("%s: endpoint %d buf %d", __FUNCTION__, usb_pipeendpoint(this_urb->pipe), i); | 286 | dbg("%s: endpoint %d buf %d", __FUNCTION__, |
| 287 | usb_pipeendpoint(this_urb->pipe), i); | ||
| 304 | 288 | ||
| 305 | /* send the data */ | 289 | /* send the data */ |
| 306 | memcpy (this_urb->transfer_buffer, buf, todo); | 290 | memcpy (this_urb->transfer_buffer, buf, todo); |
| 307 | this_urb->transfer_buffer_length = todo; | 291 | this_urb->transfer_buffer_length = todo; |
| 308 | 292 | ||
| 309 | this_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
| 310 | this_urb->dev = port->serial->dev; | 293 | this_urb->dev = port->serial->dev; |
| 311 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 294 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
| 312 | if (err) { | 295 | if (err) { |
| 313 | dbg("usb_submit_urb %p (write bulk) failed (%d, has %d)", this_urb, err, this_urb->status); | 296 | dbg("usb_submit_urb %p (write bulk) failed " |
| 297 | "(%d, has %d)", this_urb, | ||
| 298 | err, this_urb->status); | ||
| 314 | continue; | 299 | continue; |
| 315 | } | 300 | } |
| 316 | portdata->tx_start_time[i] = jiffies; | 301 | portdata->tx_start_time[i] = jiffies; |
| @@ -323,8 +308,7 @@ option_write (struct usb_serial_port *port, | |||
| 323 | return count; | 308 | return count; |
| 324 | } | 309 | } |
| 325 | 310 | ||
| 326 | static void | 311 | static void option_indat_callback(struct urb *urb, struct pt_regs *regs) |
| 327 | option_indat_callback (struct urb *urb, struct pt_regs *regs) | ||
| 328 | { | 312 | { |
| 329 | int i, err; | 313 | int i, err; |
| 330 | int endpoint; | 314 | int endpoint; |
| @@ -357,14 +341,14 @@ option_indat_callback (struct urb *urb, struct pt_regs *regs) | |||
| 357 | if (port->open_count && urb->status != -ESHUTDOWN) { | 341 | if (port->open_count && urb->status != -ESHUTDOWN) { |
| 358 | err = usb_submit_urb(urb, GFP_ATOMIC); | 342 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 359 | if (err) | 343 | if (err) |
| 360 | printk(KERN_ERR "%s: resubmit read urb failed. (%d)", __FUNCTION__, err); | 344 | printk(KERN_ERR "%s: resubmit read urb failed. " |
| 345 | "(%d)", __FUNCTION__, err); | ||
| 361 | } | 346 | } |
| 362 | } | 347 | } |
| 363 | return; | 348 | return; |
| 364 | } | 349 | } |
| 365 | 350 | ||
| 366 | static void | 351 | static void option_outdat_callback(struct urb *urb, struct pt_regs *regs) |
| 367 | option_outdat_callback (struct urb *urb, struct pt_regs *regs) | ||
| 368 | { | 352 | { |
| 369 | struct usb_serial_port *port; | 353 | struct usb_serial_port *port; |
| 370 | 354 | ||
| @@ -376,8 +360,7 @@ option_outdat_callback (struct urb *urb, struct pt_regs *regs) | |||
| 376 | schedule_work(&port->work); | 360 | schedule_work(&port->work); |
| 377 | } | 361 | } |
| 378 | 362 | ||
| 379 | static void | 363 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs) |
| 380 | option_instat_callback (struct urb *urb, struct pt_regs *regs) | ||
| 381 | { | 364 | { |
| 382 | int err; | 365 | int err; |
| 383 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; | 366 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
| @@ -395,10 +378,12 @@ option_instat_callback (struct urb *urb, struct pt_regs *regs) | |||
| 395 | dbg("%s: NULL req_pkt\n", __FUNCTION__); | 378 | dbg("%s: NULL req_pkt\n", __FUNCTION__); |
| 396 | return; | 379 | return; |
| 397 | } | 380 | } |
| 398 | if ((req_pkt->bRequestType == 0xA1) && (req_pkt->bRequest == 0x20)) { | 381 | if ((req_pkt->bRequestType == 0xA1) && |
| 382 | (req_pkt->bRequest == 0x20)) { | ||
| 399 | int old_dcd_state; | 383 | int old_dcd_state; |
| 400 | unsigned char signals = *((unsigned char *) | 384 | unsigned char signals = *((unsigned char *) |
| 401 | urb->transfer_buffer + sizeof(struct usb_ctrlrequest)); | 385 | urb->transfer_buffer + |
| 386 | sizeof(struct usb_ctrlrequest)); | ||
| 402 | 387 | ||
| 403 | dbg("%s: signal x%x", __FUNCTION__, signals); | 388 | dbg("%s: signal x%x", __FUNCTION__, signals); |
| 404 | 389 | ||
| @@ -408,12 +393,13 @@ option_instat_callback (struct urb *urb, struct pt_regs *regs) | |||
| 408 | portdata->dsr_state = ((signals & 0x02) ? 1 : 0); | 393 | portdata->dsr_state = ((signals & 0x02) ? 1 : 0); |
| 409 | portdata->ri_state = ((signals & 0x08) ? 1 : 0); | 394 | portdata->ri_state = ((signals & 0x08) ? 1 : 0); |
| 410 | 395 | ||
| 411 | if (port->tty && !C_CLOCAL(port->tty) | 396 | if (port->tty && !C_CLOCAL(port->tty) && |
| 412 | && old_dcd_state && !portdata->dcd_state) { | 397 | old_dcd_state && !portdata->dcd_state) |
| 413 | tty_hangup(port->tty); | 398 | tty_hangup(port->tty); |
| 414 | } | 399 | } else { |
| 415 | } else | 400 | dbg("%s: type %x req %x", __FUNCTION__, |
| 416 | dbg("%s: type %x req %x", __FUNCTION__, req_pkt->bRequestType,req_pkt->bRequest); | 401 | req_pkt->bRequestType,req_pkt->bRequest); |
| 402 | } | ||
| 417 | } else | 403 | } else |
| 418 | dbg("%s: error %d", __FUNCTION__, urb->status); | 404 | dbg("%s: error %d", __FUNCTION__, urb->status); |
| 419 | 405 | ||
| @@ -422,13 +408,12 @@ option_instat_callback (struct urb *urb, struct pt_regs *regs) | |||
| 422 | urb->dev = serial->dev; | 408 | urb->dev = serial->dev; |
| 423 | err = usb_submit_urb(urb, GFP_ATOMIC); | 409 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 424 | if (err) | 410 | if (err) |
| 425 | dbg("%s: resubmit intr urb failed. (%d)", __FUNCTION__, err); | 411 | dbg("%s: resubmit intr urb failed. (%d)", |
| 412 | __FUNCTION__, err); | ||
| 426 | } | 413 | } |
| 427 | } | 414 | } |
| 428 | 415 | ||
| 429 | 416 | static int option_write_room(struct usb_serial_port *port) | |
| 430 | static int | ||
| 431 | option_write_room (struct usb_serial_port *port) | ||
| 432 | { | 417 | { |
| 433 | struct option_port_private *portdata; | 418 | struct option_port_private *portdata; |
| 434 | int i; | 419 | int i; |
| @@ -447,9 +432,7 @@ option_write_room (struct usb_serial_port *port) | |||
| 447 | return data_len; | 432 | return data_len; |
| 448 | } | 433 | } |
| 449 | 434 | ||
| 450 | 435 | static int option_chars_in_buffer(struct usb_serial_port *port) | |
| 451 | static int | ||
| 452 | option_chars_in_buffer (struct usb_serial_port *port) | ||
| 453 | { | 436 | { |
| 454 | struct option_port_private *portdata; | 437 | struct option_port_private *portdata; |
| 455 | int i; | 438 | int i; |
| @@ -467,9 +450,7 @@ option_chars_in_buffer (struct usb_serial_port *port) | |||
| 467 | return data_len; | 450 | return data_len; |
| 468 | } | 451 | } |
| 469 | 452 | ||
| 470 | 453 | static int option_open(struct usb_serial_port *port, struct file *filp) | |
| 471 | static int | ||
| 472 | option_open (struct usb_serial_port *port, struct file *filp) | ||
| 473 | { | 454 | { |
| 474 | struct option_port_private *portdata; | 455 | struct option_port_private *portdata; |
| 475 | struct usb_serial *serial = port->serial; | 456 | struct usb_serial *serial = port->serial; |
| @@ -490,17 +471,21 @@ option_open (struct usb_serial_port *port, struct file *filp) | |||
| 490 | if (! urb) | 471 | if (! urb) |
| 491 | continue; | 472 | continue; |
| 492 | if (urb->dev != serial->dev) { | 473 | if (urb->dev != serial->dev) { |
| 493 | dbg("%s: dev %p != %p", __FUNCTION__, urb->dev, serial->dev); | 474 | dbg("%s: dev %p != %p", __FUNCTION__, |
| 475 | urb->dev, serial->dev); | ||
| 494 | continue; | 476 | continue; |
| 495 | } | 477 | } |
| 496 | 478 | ||
| 497 | /* make sure endpoint data toggle is synchronized with the device */ | 479 | /* |
| 498 | 480 | * make sure endpoint data toggle is synchronized with the | |
| 481 | * device | ||
| 482 | */ | ||
| 499 | usb_clear_halt(urb->dev, urb->pipe); | 483 | usb_clear_halt(urb->dev, urb->pipe); |
| 500 | 484 | ||
| 501 | err = usb_submit_urb(urb, GFP_KERNEL); | 485 | err = usb_submit_urb(urb, GFP_KERNEL); |
| 502 | if (err) { | 486 | if (err) { |
| 503 | dbg("%s: submit urb %d failed (%d) %d", __FUNCTION__, i, err, | 487 | dbg("%s: submit urb %d failed (%d) %d", |
| 488 | __FUNCTION__, i, err, | ||
| 504 | urb->transfer_buffer_length); | 489 | urb->transfer_buffer_length); |
| 505 | } | 490 | } |
| 506 | } | 491 | } |
| @@ -511,7 +496,8 @@ option_open (struct usb_serial_port *port, struct file *filp) | |||
| 511 | if (! urb) | 496 | if (! urb) |
| 512 | continue; | 497 | continue; |
| 513 | urb->dev = serial->dev; | 498 | urb->dev = serial->dev; |
| 514 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ | 499 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), |
| 500 | usb_pipeout(urb->pipe), 0); */ | ||
| 515 | } | 501 | } |
| 516 | 502 | ||
| 517 | port->tty->low_latency = 1; | 503 | port->tty->low_latency = 1; |
| @@ -521,17 +507,13 @@ option_open (struct usb_serial_port *port, struct file *filp) | |||
| 521 | return (0); | 507 | return (0); |
| 522 | } | 508 | } |
| 523 | 509 | ||
| 524 | static inline void | 510 | static inline void stop_urb(struct urb *urb) |
| 525 | stop_urb (struct urb *urb) | ||
| 526 | { | 511 | { |
| 527 | if (urb && urb->status == -EINPROGRESS) { | 512 | if (urb && urb->status == -EINPROGRESS) |
| 528 | urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
| 529 | usb_kill_urb(urb); | 513 | usb_kill_urb(urb); |
| 530 | } | ||
| 531 | } | 514 | } |
| 532 | 515 | ||
| 533 | static void | 516 | static void option_close(struct usb_serial_port *port, struct file *filp) |
| 534 | option_close (struct usb_serial_port *port, struct file *filp) | ||
| 535 | { | 517 | { |
| 536 | int i; | 518 | int i; |
| 537 | struct usb_serial *serial = port->serial; | 519 | struct usb_serial *serial = port->serial; |
| @@ -555,12 +537,10 @@ option_close (struct usb_serial_port *port, struct file *filp) | |||
| 555 | port->tty = NULL; | 537 | port->tty = NULL; |
| 556 | } | 538 | } |
| 557 | 539 | ||
| 558 | |||
| 559 | /* Helper functions used by option_setup_urbs */ | 540 | /* Helper functions used by option_setup_urbs */ |
| 560 | static struct urb * | 541 | static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint, |
| 561 | option_setup_urb (struct usb_serial *serial, int endpoint, | 542 | int dir, void *ctx, char *buf, int len, |
| 562 | int dir, void *ctx, char *buf, int len, | 543 | void (*callback)(struct urb *, struct pt_regs *regs)) |
| 563 | void (*callback)(struct urb *, struct pt_regs *regs)) | ||
| 564 | { | 544 | { |
| 565 | struct urb *urb; | 545 | struct urb *urb; |
| 566 | 546 | ||
| @@ -582,8 +562,7 @@ option_setup_urb (struct usb_serial *serial, int endpoint, | |||
| 582 | } | 562 | } |
| 583 | 563 | ||
| 584 | /* Setup urbs */ | 564 | /* Setup urbs */ |
| 585 | static void | 565 | static void option_setup_urbs(struct usb_serial *serial) |
| 586 | option_setup_urbs (struct usb_serial *serial) | ||
| 587 | { | 566 | { |
| 588 | int j; | 567 | int j; |
| 589 | struct usb_serial_port *port; | 568 | struct usb_serial_port *port; |
| @@ -609,9 +588,7 @@ option_setup_urbs (struct usb_serial *serial) | |||
| 609 | } | 588 | } |
| 610 | } | 589 | } |
| 611 | 590 | ||
| 612 | 591 | static int option_send_setup(struct usb_serial_port *port) | |
| 613 | static int | ||
| 614 | option_send_setup (struct usb_serial_port *port) | ||
| 615 | { | 592 | { |
| 616 | struct usb_serial *serial = port->serial; | 593 | struct usb_serial *serial = port->serial; |
| 617 | struct option_port_private *portdata; | 594 | struct option_port_private *portdata; |
| @@ -627,16 +604,15 @@ option_send_setup (struct usb_serial_port *port) | |||
| 627 | if (portdata->rts_state) | 604 | if (portdata->rts_state) |
| 628 | val |= 0x02; | 605 | val |= 0x02; |
| 629 | 606 | ||
| 630 | return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 607 | return usb_control_msg(serial->dev, |
| 631 | 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); | 608 | usb_rcvctrlpipe(serial->dev, 0), |
| 609 | 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); | ||
| 632 | } | 610 | } |
| 633 | 611 | ||
| 634 | return 0; | 612 | return 0; |
| 635 | } | 613 | } |
| 636 | 614 | ||
| 637 | 615 | static int option_startup(struct usb_serial *serial) | |
| 638 | static int | ||
| 639 | option_startup (struct usb_serial *serial) | ||
| 640 | { | 616 | { |
| 641 | int i, err; | 617 | int i, err; |
| 642 | struct usb_serial_port *port; | 618 | struct usb_serial_port *port; |
| @@ -647,9 +623,10 @@ option_startup (struct usb_serial *serial) | |||
| 647 | /* Now setup per port private data */ | 623 | /* Now setup per port private data */ |
| 648 | for (i = 0; i < serial->num_ports; i++) { | 624 | for (i = 0; i < serial->num_ports; i++) { |
| 649 | port = serial->port[i]; | 625 | port = serial->port[i]; |
| 650 | portdata = kmalloc(sizeof(struct option_port_private), GFP_KERNEL); | 626 | portdata = kmalloc(sizeof(*portdata), GFP_KERNEL); |
| 651 | if (!portdata) { | 627 | if (!portdata) { |
| 652 | dbg("%s: kmalloc for option_port_private (%d) failed!.", __FUNCTION__, i); | 628 | dbg("%s: kmalloc for option_port_private (%d) failed!.", |
| 629 | __FUNCTION__, i); | ||
| 653 | return (1); | 630 | return (1); |
| 654 | } | 631 | } |
| 655 | memset(portdata, 0, sizeof(struct option_port_private)); | 632 | memset(portdata, 0, sizeof(struct option_port_private)); |
| @@ -660,7 +637,8 @@ option_startup (struct usb_serial *serial) | |||
| 660 | continue; | 637 | continue; |
| 661 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 638 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
| 662 | if (err) | 639 | if (err) |
| 663 | dbg("%s: submit irq_in urb failed %d", __FUNCTION__, err); | 640 | dbg("%s: submit irq_in urb failed %d", |
| 641 | __FUNCTION__, err); | ||
| 664 | } | 642 | } |
| 665 | 643 | ||
| 666 | option_setup_urbs(serial); | 644 | option_setup_urbs(serial); |
| @@ -668,8 +646,7 @@ option_startup (struct usb_serial *serial) | |||
| 668 | return (0); | 646 | return (0); |
| 669 | } | 647 | } |
| 670 | 648 | ||
| 671 | static void | 649 | static void option_shutdown(struct usb_serial *serial) |
| 672 | option_shutdown (struct usb_serial *serial) | ||
| 673 | { | 650 | { |
| 674 | int i, j; | 651 | int i, j; |
| 675 | struct usb_serial_port *port; | 652 | struct usb_serial_port *port; |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 7eab5d4cf3a8..461474176cfb 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
| @@ -538,8 +538,10 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp) | |||
| 538 | 538 | ||
| 539 | dbg("%s - port %d", __FUNCTION__, port->number); | 539 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 540 | 540 | ||
| 541 | usb_clear_halt(serial->dev, port->write_urb->pipe); | 541 | if (priv->type != HX) { |
| 542 | usb_clear_halt(serial->dev, port->read_urb->pipe); | 542 | usb_clear_halt(serial->dev, port->write_urb->pipe); |
| 543 | usb_clear_halt(serial->dev, port->read_urb->pipe); | ||
| 544 | } | ||
| 543 | 545 | ||
| 544 | buf = kmalloc(10, GFP_KERNEL); | 546 | buf = kmalloc(10, GFP_KERNEL); |
| 545 | if (buf==NULL) | 547 | if (buf==NULL) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 0267b26dde18..e77fbdfc782d 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -531,7 +531,7 @@ bailout_kref_put: | |||
| 531 | 531 | ||
| 532 | static void serial_close(struct tty_struct *tty, struct file * filp) | 532 | static void serial_close(struct tty_struct *tty, struct file * filp) |
| 533 | { | 533 | { |
| 534 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 534 | struct usb_serial_port *port = tty->driver_data; |
| 535 | 535 | ||
| 536 | if (!port) | 536 | if (!port) |
| 537 | return; | 537 | return; |
| @@ -561,7 +561,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp) | |||
| 561 | 561 | ||
| 562 | static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count) | 562 | static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count) |
| 563 | { | 563 | { |
| 564 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 564 | struct usb_serial_port *port = tty->driver_data; |
| 565 | int retval = -EINVAL; | 565 | int retval = -EINVAL; |
| 566 | 566 | ||
| 567 | dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); | 567 | dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); |
| @@ -580,7 +580,7 @@ exit: | |||
| 580 | 580 | ||
| 581 | static int serial_write_room (struct tty_struct *tty) | 581 | static int serial_write_room (struct tty_struct *tty) |
| 582 | { | 582 | { |
| 583 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 583 | struct usb_serial_port *port = tty->driver_data; |
| 584 | int retval = -EINVAL; | 584 | int retval = -EINVAL; |
| 585 | 585 | ||
| 586 | dbg("%s - port %d", __FUNCTION__, port->number); | 586 | dbg("%s - port %d", __FUNCTION__, port->number); |
| @@ -599,7 +599,7 @@ exit: | |||
| 599 | 599 | ||
| 600 | static int serial_chars_in_buffer (struct tty_struct *tty) | 600 | static int serial_chars_in_buffer (struct tty_struct *tty) |
| 601 | { | 601 | { |
| 602 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 602 | struct usb_serial_port *port = tty->driver_data; |
| 603 | int retval = -EINVAL; | 603 | int retval = -EINVAL; |
| 604 | 604 | ||
| 605 | dbg("%s = port %d", __FUNCTION__, port->number); | 605 | dbg("%s = port %d", __FUNCTION__, port->number); |
| @@ -618,7 +618,7 @@ exit: | |||
| 618 | 618 | ||
| 619 | static void serial_throttle (struct tty_struct * tty) | 619 | static void serial_throttle (struct tty_struct * tty) |
| 620 | { | 620 | { |
| 621 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 621 | struct usb_serial_port *port = tty->driver_data; |
| 622 | 622 | ||
| 623 | dbg("%s - port %d", __FUNCTION__, port->number); | 623 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 624 | 624 | ||
| @@ -634,7 +634,7 @@ static void serial_throttle (struct tty_struct * tty) | |||
| 634 | 634 | ||
| 635 | static void serial_unthrottle (struct tty_struct * tty) | 635 | static void serial_unthrottle (struct tty_struct * tty) |
| 636 | { | 636 | { |
| 637 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 637 | struct usb_serial_port *port = tty->driver_data; |
| 638 | 638 | ||
| 639 | dbg("%s - port %d", __FUNCTION__, port->number); | 639 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 640 | 640 | ||
| @@ -650,7 +650,7 @@ static void serial_unthrottle (struct tty_struct * tty) | |||
| 650 | 650 | ||
| 651 | static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) | 651 | static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) |
| 652 | { | 652 | { |
| 653 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 653 | struct usb_serial_port *port = tty->driver_data; |
| 654 | int retval = -ENODEV; | 654 | int retval = -ENODEV; |
| 655 | 655 | ||
| 656 | dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); | 656 | dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); |
| @@ -672,7 +672,7 @@ exit: | |||
| 672 | 672 | ||
| 673 | static void serial_set_termios (struct tty_struct *tty, struct termios * old) | 673 | static void serial_set_termios (struct tty_struct *tty, struct termios * old) |
| 674 | { | 674 | { |
| 675 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 675 | struct usb_serial_port *port = tty->driver_data; |
| 676 | 676 | ||
| 677 | dbg("%s - port %d", __FUNCTION__, port->number); | 677 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 678 | 678 | ||
| @@ -688,7 +688,7 @@ static void serial_set_termios (struct tty_struct *tty, struct termios * old) | |||
| 688 | 688 | ||
| 689 | static void serial_break (struct tty_struct *tty, int break_state) | 689 | static void serial_break (struct tty_struct *tty, int break_state) |
| 690 | { | 690 | { |
| 691 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 691 | struct usb_serial_port *port = tty->driver_data; |
| 692 | 692 | ||
| 693 | dbg("%s - port %d", __FUNCTION__, port->number); | 693 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 694 | 694 | ||
| @@ -749,7 +749,7 @@ done: | |||
| 749 | 749 | ||
| 750 | static int serial_tiocmget (struct tty_struct *tty, struct file *file) | 750 | static int serial_tiocmget (struct tty_struct *tty, struct file *file) |
| 751 | { | 751 | { |
| 752 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 752 | struct usb_serial_port *port = tty->driver_data; |
| 753 | 753 | ||
| 754 | dbg("%s - port %d", __FUNCTION__, port->number); | 754 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 755 | 755 | ||
| @@ -768,7 +768,7 @@ exit: | |||
| 768 | static int serial_tiocmset (struct tty_struct *tty, struct file *file, | 768 | static int serial_tiocmset (struct tty_struct *tty, struct file *file, |
| 769 | unsigned int set, unsigned int clear) | 769 | unsigned int set, unsigned int clear) |
| 770 | { | 770 | { |
| 771 | struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; | 771 | struct usb_serial_port *port = tty->driver_data; |
| 772 | 772 | ||
| 773 | dbg("%s - port %d", __FUNCTION__, port->number); | 773 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 774 | 774 | ||
| @@ -786,7 +786,7 @@ exit: | |||
| 786 | 786 | ||
| 787 | void usb_serial_port_softint(void *private) | 787 | void usb_serial_port_softint(void *private) |
| 788 | { | 788 | { |
| 789 | struct usb_serial_port *port = (struct usb_serial_port *)private; | 789 | struct usb_serial_port *port = private; |
| 790 | struct tty_struct *tty; | 790 | struct tty_struct *tty; |
| 791 | 791 | ||
| 792 | dbg("%s - port %d", __FUNCTION__, port->number); | 792 | dbg("%s - port %d", __FUNCTION__, port->number); |
