Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | Option Card (PCMCIA to) USB to Serial Driver |
| 3 | |
| 4 | Copyright (C) 2005 Matthias Urlichs <smurf@smurf.noris.de> |
| 5 | |
| 6 | This driver is free software; you can redistribute it and/or modify |
| 7 | it under the terms of Version 2 of the GNU General Public License as |
| 8 | published by the Free Software Foundation. |
| 9 | |
| 10 | Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
| 11 | |
| 12 | History: |
| 13 | |
| 14 | 2005-05-19 v0.1 Initial version, based on incomplete docs |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 15 | and analysis of misbehavior with the standard driver |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 16 | 2005-05-20 v0.2 Extended the input buffer to avoid losing |
| 17 | random 64-byte chunks of data |
| 18 | 2005-05-21 v0.3 implemented chars_in_buffer() |
| 19 | turned on low_latency |
| 20 | simplified the code somewhat |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 21 | 2005-05-24 v0.4 option_write() sometimes deadlocked under heavy load |
| 22 | removed some dead code |
| 23 | added sponsor notice |
| 24 | coding style clean-up |
| 25 | 2005-06-20 v0.4.1 add missing braces :-/ |
| 26 | killed end-of-line whitespace |
| 27 | 2005-07-15 v0.4.2 rename WLAN product to FUSION, add FUSION2 |
Matthias Urlichs | b613738 | 2005-09-22 00:48:40 -0700 | [diff] [blame^] | 28 | 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 29 | |
| 30 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> |
| 31 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 32 | */ |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 33 | |
| 34 | #define DRIVER_VERSION "v0.4" |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 35 | #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" |
| 36 | #define DRIVER_DESC "Option Card (PC-Card to) USB to Serial Driver" |
| 37 | |
| 38 | #include <linux/config.h> |
| 39 | #include <linux/kernel.h> |
| 40 | #include <linux/jiffies.h> |
| 41 | #include <linux/errno.h> |
| 42 | #include <linux/tty.h> |
| 43 | #include <linux/tty_flip.h> |
| 44 | #include <linux/module.h> |
| 45 | #include <linux/usb.h> |
| 46 | #include "usb-serial.h" |
| 47 | |
| 48 | /* Function prototypes */ |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 49 | static int option_open(struct usb_serial_port *port, struct file *filp); |
| 50 | static void option_close(struct usb_serial_port *port, struct file *filp); |
| 51 | static int option_startup(struct usb_serial *serial); |
| 52 | static void option_shutdown(struct usb_serial *serial); |
| 53 | static void option_rx_throttle(struct usb_serial_port *port); |
| 54 | static void option_rx_unthrottle(struct usb_serial_port *port); |
| 55 | static int option_write_room(struct usb_serial_port *port); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 56 | |
| 57 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs); |
| 58 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 59 | static int option_write(struct usb_serial_port *port, |
| 60 | const unsigned char *buf, int count); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 61 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 62 | static int option_chars_in_buffer(struct usb_serial_port *port); |
| 63 | static int option_ioctl(struct usb_serial_port *port, struct file *file, |
| 64 | unsigned int cmd, unsigned long arg); |
| 65 | static void option_set_termios(struct usb_serial_port *port, |
| 66 | struct termios *old); |
| 67 | static void option_break_ctl(struct usb_serial_port *port, int break_state); |
| 68 | static int option_tiocmget(struct usb_serial_port *port, struct file *file); |
| 69 | static int option_tiocmset(struct usb_serial_port *port, struct file *file, |
| 70 | unsigned int set, unsigned int clear); |
| 71 | static int option_send_setup(struct usb_serial_port *port); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 72 | |
| 73 | /* Vendor and product IDs */ |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 74 | #define OPTION_VENDOR_ID 0x0AF0 |
Matthias Urlichs | b613738 | 2005-09-22 00:48:40 -0700 | [diff] [blame^] | 75 | #define HUAWEI_VENDOR_ID 0x12D1 |
| 76 | #define AUDIOVOX_VENDOR_ID 0x0F3D |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 77 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 78 | #define OPTION_PRODUCT_OLD 0x5000 |
| 79 | #define OPTION_PRODUCT_FUSION 0x6000 |
| 80 | #define OPTION_PRODUCT_FUSION2 0x6300 |
Matthias Urlichs | b613738 | 2005-09-22 00:48:40 -0700 | [diff] [blame^] | 81 | #define HUAWEI_PRODUCT_E600 0x1001 |
| 82 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 83 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 84 | static struct usb_device_id option_ids[] = { |
| 85 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 86 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, |
| 87 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, |
Matthias Urlichs | b613738 | 2005-09-22 00:48:40 -0700 | [diff] [blame^] | 88 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
| 89 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 90 | { } /* Terminating entry */ |
| 91 | }; |
| 92 | |
| 93 | MODULE_DEVICE_TABLE(usb, option_ids); |
| 94 | |
| 95 | static struct usb_driver option_driver = { |
| 96 | .owner = THIS_MODULE, |
| 97 | .name = "option", |
| 98 | .probe = usb_serial_probe, |
| 99 | .disconnect = usb_serial_disconnect, |
| 100 | .id_table = option_ids, |
| 101 | }; |
| 102 | |
| 103 | /* The card has three separate interfaces, wich the serial driver |
| 104 | * recognizes separately, thus num_port=1. |
| 105 | */ |
| 106 | static struct usb_serial_device_type option_3port_device = { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 107 | .owner = THIS_MODULE, |
| 108 | .name = "Option 3G data card", |
| 109 | .short_name = "option", |
| 110 | .id_table = option_ids, |
| 111 | .num_interrupt_in = NUM_DONT_CARE, |
| 112 | .num_bulk_in = NUM_DONT_CARE, |
| 113 | .num_bulk_out = NUM_DONT_CARE, |
| 114 | .num_ports = 1, /* 3, but the card reports its ports separately */ |
| 115 | .open = option_open, |
| 116 | .close = option_close, |
| 117 | .write = option_write, |
| 118 | .write_room = option_write_room, |
| 119 | .chars_in_buffer = option_chars_in_buffer, |
| 120 | .throttle = option_rx_throttle, |
| 121 | .unthrottle = option_rx_unthrottle, |
| 122 | .ioctl = option_ioctl, |
| 123 | .set_termios = option_set_termios, |
| 124 | .break_ctl = option_break_ctl, |
| 125 | .tiocmget = option_tiocmget, |
| 126 | .tiocmset = option_tiocmset, |
| 127 | .attach = option_startup, |
| 128 | .shutdown = option_shutdown, |
| 129 | .read_int_callback = option_instat_callback, |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 130 | }; |
| 131 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 132 | #ifdef CONFIG_USB_DEBUG |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 133 | static int debug; |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 134 | #else |
| 135 | #define debug 0 |
| 136 | #endif |
| 137 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 138 | /* per port private data */ |
| 139 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 140 | #define N_IN_URB 4 |
| 141 | #define N_OUT_URB 1 |
| 142 | #define IN_BUFLEN 1024 |
| 143 | #define OUT_BUFLEN 128 |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 144 | |
| 145 | struct option_port_private { |
| 146 | /* Input endpoints and buffer for this port */ |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 147 | struct urb *in_urbs[N_IN_URB]; |
| 148 | char in_buffer[N_IN_URB][IN_BUFLEN]; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 149 | /* Output endpoints and buffer for this port */ |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 150 | struct urb *out_urbs[N_OUT_URB]; |
| 151 | char out_buffer[N_OUT_URB][OUT_BUFLEN]; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 152 | |
| 153 | /* Settings for the port */ |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 154 | int rts_state; /* Handshaking pins (outputs) */ |
| 155 | int dtr_state; |
| 156 | int cts_state; /* Handshaking pins (inputs) */ |
| 157 | int dsr_state; |
| 158 | int dcd_state; |
| 159 | int ri_state; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 160 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 161 | unsigned long tx_start_time[N_OUT_URB]; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 162 | }; |
| 163 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 164 | /* Functions used by new usb-serial code. */ |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 165 | static int __init option_init(void) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 166 | { |
| 167 | int retval; |
| 168 | retval = usb_serial_register(&option_3port_device); |
| 169 | if (retval) |
| 170 | goto failed_3port_device_register; |
| 171 | retval = usb_register(&option_driver); |
| 172 | if (retval) |
| 173 | goto failed_driver_register; |
| 174 | |
| 175 | info(DRIVER_DESC ": " DRIVER_VERSION); |
| 176 | |
| 177 | return 0; |
| 178 | |
| 179 | failed_driver_register: |
| 180 | usb_serial_deregister (&option_3port_device); |
| 181 | failed_3port_device_register: |
| 182 | return retval; |
| 183 | } |
| 184 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 185 | static void __exit option_exit(void) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 186 | { |
| 187 | usb_deregister (&option_driver); |
| 188 | usb_serial_deregister (&option_3port_device); |
| 189 | } |
| 190 | |
| 191 | module_init(option_init); |
| 192 | module_exit(option_exit); |
| 193 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 194 | static void option_rx_throttle(struct usb_serial_port *port) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 195 | { |
| 196 | dbg("%s", __FUNCTION__); |
| 197 | } |
| 198 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 199 | static void option_rx_unthrottle(struct usb_serial_port *port) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 200 | { |
| 201 | dbg("%s", __FUNCTION__); |
| 202 | } |
| 203 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 204 | static void option_break_ctl(struct usb_serial_port *port, int break_state) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 205 | { |
| 206 | /* Unfortunately, I don't know how to send a break */ |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 207 | dbg("%s", __FUNCTION__); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 208 | } |
| 209 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 210 | static void option_set_termios(struct usb_serial_port *port, |
| 211 | struct termios *old_termios) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 212 | { |
| 213 | dbg("%s", __FUNCTION__); |
| 214 | |
| 215 | option_send_setup(port); |
| 216 | } |
| 217 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 218 | static int option_tiocmget(struct usb_serial_port *port, struct file *file) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 219 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 220 | unsigned int value; |
| 221 | struct option_port_private *portdata; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 222 | |
| 223 | portdata = usb_get_serial_port_data(port); |
| 224 | |
| 225 | value = ((portdata->rts_state) ? TIOCM_RTS : 0) | |
| 226 | ((portdata->dtr_state) ? TIOCM_DTR : 0) | |
| 227 | ((portdata->cts_state) ? TIOCM_CTS : 0) | |
| 228 | ((portdata->dsr_state) ? TIOCM_DSR : 0) | |
| 229 | ((portdata->dcd_state) ? TIOCM_CAR : 0) | |
| 230 | ((portdata->ri_state) ? TIOCM_RNG : 0); |
| 231 | |
| 232 | return value; |
| 233 | } |
| 234 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 235 | static int option_tiocmset(struct usb_serial_port *port, struct file *file, |
| 236 | unsigned int set, unsigned int clear) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 237 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 238 | struct option_port_private *portdata; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 239 | |
| 240 | portdata = usb_get_serial_port_data(port); |
| 241 | |
| 242 | if (set & TIOCM_RTS) |
| 243 | portdata->rts_state = 1; |
| 244 | if (set & TIOCM_DTR) |
| 245 | portdata->dtr_state = 1; |
| 246 | |
| 247 | if (clear & TIOCM_RTS) |
| 248 | portdata->rts_state = 0; |
| 249 | if (clear & TIOCM_DTR) |
| 250 | portdata->dtr_state = 0; |
| 251 | return option_send_setup(port); |
| 252 | } |
| 253 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 254 | static int option_ioctl(struct usb_serial_port *port, struct file *file, |
| 255 | unsigned int cmd, unsigned long arg) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 256 | { |
| 257 | return -ENOIOCTLCMD; |
| 258 | } |
| 259 | |
| 260 | /* Write */ |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 261 | static int option_write(struct usb_serial_port *port, |
| 262 | const unsigned char *buf, int count) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 263 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 264 | struct option_port_private *portdata; |
| 265 | int i; |
| 266 | int left, todo; |
| 267 | struct urb *this_urb = NULL; /* spurious */ |
| 268 | int err; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 269 | |
| 270 | portdata = usb_get_serial_port_data(port); |
| 271 | |
| 272 | dbg("%s: write (%d chars)", __FUNCTION__, count); |
| 273 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 274 | i = 0; |
| 275 | left = count; |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 276 | for (i=0; left > 0 && i < N_OUT_URB; i++) { |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 277 | todo = left; |
| 278 | if (todo > OUT_BUFLEN) |
| 279 | todo = OUT_BUFLEN; |
| 280 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 281 | this_urb = portdata->out_urbs[i]; |
| 282 | if (this_urb->status == -EINPROGRESS) { |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 283 | if (time_before(jiffies, |
| 284 | portdata->tx_start_time[i] + 10 * HZ)) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 285 | continue; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 286 | usb_unlink_urb(this_urb); |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 287 | continue; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 288 | } |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 289 | if (this_urb->status != 0) |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 290 | dbg("usb_write %p failed (err=%d)", |
| 291 | this_urb, this_urb->status); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 292 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 293 | dbg("%s: endpoint %d buf %d", __FUNCTION__, |
| 294 | usb_pipeendpoint(this_urb->pipe), i); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 295 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 296 | /* send the data */ |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 297 | memcpy (this_urb->transfer_buffer, buf, todo); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 298 | this_urb->transfer_buffer_length = todo; |
| 299 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 300 | this_urb->dev = port->serial->dev; |
| 301 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
| 302 | if (err) { |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 303 | dbg("usb_submit_urb %p (write bulk) failed " |
| 304 | "(%d, has %d)", this_urb, |
| 305 | err, this_urb->status); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 306 | continue; |
| 307 | } |
| 308 | portdata->tx_start_time[i] = jiffies; |
| 309 | buf += todo; |
| 310 | left -= todo; |
| 311 | } |
| 312 | |
| 313 | count -= left; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 314 | dbg("%s: wrote (did %d)", __FUNCTION__, count); |
| 315 | return count; |
| 316 | } |
| 317 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 318 | static void option_indat_callback(struct urb *urb, struct pt_regs *regs) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 319 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 320 | int i, err; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 321 | int endpoint; |
| 322 | struct usb_serial_port *port; |
| 323 | struct tty_struct *tty; |
| 324 | unsigned char *data = urb->transfer_buffer; |
| 325 | |
| 326 | dbg("%s: %p", __FUNCTION__, urb); |
| 327 | |
| 328 | endpoint = usb_pipeendpoint(urb->pipe); |
| 329 | port = (struct usb_serial_port *) urb->context; |
| 330 | |
| 331 | if (urb->status) { |
| 332 | dbg("%s: nonzero status: %d on endpoint %02x.", |
| 333 | __FUNCTION__, urb->status, endpoint); |
| 334 | } else { |
| 335 | tty = port->tty; |
| 336 | if (urb->actual_length) { |
| 337 | for (i = 0; i < urb->actual_length ; ++i) { |
| 338 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) |
| 339 | tty_flip_buffer_push(tty); |
| 340 | tty_insert_flip_char(tty, data[i], 0); |
| 341 | } |
| 342 | tty_flip_buffer_push(tty); |
| 343 | } else { |
| 344 | dbg("%s: empty read urb received", __FUNCTION__); |
| 345 | } |
| 346 | |
| 347 | /* Resubmit urb so we continue receiving */ |
| 348 | if (port->open_count && urb->status != -ESHUTDOWN) { |
| 349 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 350 | if (err) |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 351 | printk(KERN_ERR "%s: resubmit read urb failed. " |
| 352 | "(%d)", __FUNCTION__, err); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 353 | } |
| 354 | } |
| 355 | return; |
| 356 | } |
| 357 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 358 | static void option_outdat_callback(struct urb *urb, struct pt_regs *regs) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 359 | { |
| 360 | struct usb_serial_port *port; |
| 361 | |
| 362 | dbg("%s", __FUNCTION__); |
| 363 | |
| 364 | port = (struct usb_serial_port *) urb->context; |
| 365 | |
| 366 | if (port->open_count) |
| 367 | schedule_work(&port->work); |
| 368 | } |
| 369 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 370 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 371 | { |
| 372 | int err; |
| 373 | struct usb_serial_port *port = (struct usb_serial_port *) urb->context; |
| 374 | struct option_port_private *portdata = usb_get_serial_port_data(port); |
| 375 | struct usb_serial *serial = port->serial; |
| 376 | |
| 377 | dbg("%s", __FUNCTION__); |
| 378 | dbg("%s: urb %p port %p has data %p", __FUNCTION__,urb,port,portdata); |
| 379 | |
| 380 | if (urb->status == 0) { |
| 381 | struct usb_ctrlrequest *req_pkt = |
| 382 | (struct usb_ctrlrequest *)urb->transfer_buffer; |
| 383 | |
| 384 | if (!req_pkt) { |
| 385 | dbg("%s: NULL req_pkt\n", __FUNCTION__); |
| 386 | return; |
| 387 | } |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 388 | if ((req_pkt->bRequestType == 0xA1) && |
| 389 | (req_pkt->bRequest == 0x20)) { |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 390 | int old_dcd_state; |
| 391 | unsigned char signals = *((unsigned char *) |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 392 | urb->transfer_buffer + |
| 393 | sizeof(struct usb_ctrlrequest)); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 394 | |
| 395 | dbg("%s: signal x%x", __FUNCTION__, signals); |
| 396 | |
| 397 | old_dcd_state = portdata->dcd_state; |
| 398 | portdata->cts_state = 1; |
| 399 | portdata->dcd_state = ((signals & 0x01) ? 1 : 0); |
| 400 | portdata->dsr_state = ((signals & 0x02) ? 1 : 0); |
| 401 | portdata->ri_state = ((signals & 0x08) ? 1 : 0); |
| 402 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 403 | if (port->tty && !C_CLOCAL(port->tty) && |
| 404 | old_dcd_state && !portdata->dcd_state) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 405 | tty_hangup(port->tty); |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 406 | } else { |
| 407 | dbg("%s: type %x req %x", __FUNCTION__, |
| 408 | req_pkt->bRequestType,req_pkt->bRequest); |
| 409 | } |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 410 | } else |
| 411 | dbg("%s: error %d", __FUNCTION__, urb->status); |
| 412 | |
| 413 | /* Resubmit urb so we continue receiving IRQ data */ |
| 414 | if (urb->status != -ESHUTDOWN) { |
| 415 | urb->dev = serial->dev; |
| 416 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 417 | if (err) |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 418 | dbg("%s: resubmit intr urb failed. (%d)", |
| 419 | __FUNCTION__, err); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 420 | } |
| 421 | } |
| 422 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 423 | static int option_write_room(struct usb_serial_port *port) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 424 | { |
| 425 | struct option_port_private *portdata; |
| 426 | int i; |
| 427 | int data_len = 0; |
| 428 | struct urb *this_urb; |
| 429 | |
| 430 | portdata = usb_get_serial_port_data(port); |
| 431 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 432 | for (i=0; i < N_OUT_URB; i++) { |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 433 | this_urb = portdata->out_urbs[i]; |
| 434 | if (this_urb && this_urb->status != -EINPROGRESS) |
| 435 | data_len += OUT_BUFLEN; |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 436 | } |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 437 | |
| 438 | dbg("%s: %d", __FUNCTION__, data_len); |
| 439 | return data_len; |
| 440 | } |
| 441 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 442 | static int option_chars_in_buffer(struct usb_serial_port *port) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 443 | { |
| 444 | struct option_port_private *portdata; |
| 445 | int i; |
| 446 | int data_len = 0; |
| 447 | struct urb *this_urb; |
| 448 | |
| 449 | portdata = usb_get_serial_port_data(port); |
| 450 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 451 | for (i=0; i < N_OUT_URB; i++) { |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 452 | this_urb = portdata->out_urbs[i]; |
| 453 | if (this_urb && this_urb->status == -EINPROGRESS) |
| 454 | data_len += this_urb->transfer_buffer_length; |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 455 | } |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 456 | dbg("%s: %d", __FUNCTION__, data_len); |
| 457 | return data_len; |
| 458 | } |
| 459 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 460 | static int option_open(struct usb_serial_port *port, struct file *filp) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 461 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 462 | struct option_port_private *portdata; |
| 463 | struct usb_serial *serial = port->serial; |
| 464 | int i, err; |
| 465 | struct urb *urb; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 466 | |
| 467 | portdata = usb_get_serial_port_data(port); |
| 468 | |
| 469 | dbg("%s", __FUNCTION__); |
| 470 | |
| 471 | /* Set some sane defaults */ |
| 472 | portdata->rts_state = 1; |
| 473 | portdata->dtr_state = 1; |
| 474 | |
| 475 | /* Reset low level data toggle and start reading from endpoints */ |
| 476 | for (i = 0; i < N_IN_URB; i++) { |
| 477 | urb = portdata->in_urbs[i]; |
| 478 | if (! urb) |
| 479 | continue; |
| 480 | if (urb->dev != serial->dev) { |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 481 | dbg("%s: dev %p != %p", __FUNCTION__, |
| 482 | urb->dev, serial->dev); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 483 | continue; |
| 484 | } |
| 485 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 486 | /* |
| 487 | * make sure endpoint data toggle is synchronized with the |
| 488 | * device |
| 489 | */ |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 490 | usb_clear_halt(urb->dev, urb->pipe); |
| 491 | |
| 492 | err = usb_submit_urb(urb, GFP_KERNEL); |
| 493 | if (err) { |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 494 | dbg("%s: submit urb %d failed (%d) %d", |
| 495 | __FUNCTION__, i, err, |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 496 | urb->transfer_buffer_length); |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /* Reset low level data toggle on out endpoints */ |
| 501 | for (i = 0; i < N_OUT_URB; i++) { |
| 502 | urb = portdata->out_urbs[i]; |
| 503 | if (! urb) |
| 504 | continue; |
| 505 | urb->dev = serial->dev; |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 506 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), |
| 507 | usb_pipeout(urb->pipe), 0); */ |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | port->tty->low_latency = 1; |
| 511 | |
| 512 | option_send_setup(port); |
| 513 | |
| 514 | return (0); |
| 515 | } |
| 516 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 517 | static inline void stop_urb(struct urb *urb) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 518 | { |
Greg Kroah-Hartman | 242cf67 | 2005-07-29 16:11:07 -0400 | [diff] [blame] | 519 | if (urb && urb->status == -EINPROGRESS) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 520 | usb_kill_urb(urb); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 521 | } |
| 522 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 523 | static void option_close(struct usb_serial_port *port, struct file *filp) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 524 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 525 | int i; |
| 526 | struct usb_serial *serial = port->serial; |
| 527 | struct option_port_private *portdata; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 528 | |
| 529 | dbg("%s", __FUNCTION__); |
| 530 | portdata = usb_get_serial_port_data(port); |
| 531 | |
| 532 | portdata->rts_state = 0; |
| 533 | portdata->dtr_state = 0; |
| 534 | |
| 535 | if (serial->dev) { |
| 536 | option_send_setup(port); |
| 537 | |
| 538 | /* Stop reading/writing urbs */ |
| 539 | for (i = 0; i < N_IN_URB; i++) |
| 540 | stop_urb(portdata->in_urbs[i]); |
| 541 | for (i = 0; i < N_OUT_URB; i++) |
| 542 | stop_urb(portdata->out_urbs[i]); |
| 543 | } |
| 544 | port->tty = NULL; |
| 545 | } |
| 546 | |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 547 | /* Helper functions used by option_setup_urbs */ |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 548 | static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint, |
| 549 | int dir, void *ctx, char *buf, int len, |
| 550 | void (*callback)(struct urb *, struct pt_regs *regs)) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 551 | { |
| 552 | struct urb *urb; |
| 553 | |
| 554 | if (endpoint == -1) |
| 555 | return NULL; /* endpoint not needed */ |
| 556 | |
| 557 | urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ |
| 558 | if (urb == NULL) { |
| 559 | dbg("%s: alloc for endpoint %d failed.", __FUNCTION__, endpoint); |
| 560 | return NULL; |
| 561 | } |
| 562 | |
| 563 | /* Fill URB using supplied data. */ |
| 564 | usb_fill_bulk_urb(urb, serial->dev, |
| 565 | usb_sndbulkpipe(serial->dev, endpoint) | dir, |
| 566 | buf, len, callback, ctx); |
| 567 | |
| 568 | return urb; |
| 569 | } |
| 570 | |
| 571 | /* Setup urbs */ |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 572 | static void option_setup_urbs(struct usb_serial *serial) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 573 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 574 | int j; |
| 575 | struct usb_serial_port *port; |
| 576 | struct option_port_private *portdata; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 577 | |
| 578 | dbg("%s", __FUNCTION__); |
| 579 | |
| 580 | port = serial->port[0]; |
| 581 | portdata = usb_get_serial_port_data(port); |
| 582 | |
| 583 | /* Do indat endpoints first */ |
| 584 | for (j = 0; j <= N_IN_URB; ++j) { |
| 585 | portdata->in_urbs[j] = option_setup_urb (serial, |
| 586 | port->bulk_in_endpointAddress, USB_DIR_IN, port, |
| 587 | portdata->in_buffer[j], IN_BUFLEN, option_indat_callback); |
| 588 | } |
| 589 | |
| 590 | /* outdat endpoints */ |
| 591 | for (j = 0; j <= N_OUT_URB; ++j) { |
| 592 | portdata->out_urbs[j] = option_setup_urb (serial, |
| 593 | port->bulk_out_endpointAddress, USB_DIR_OUT, port, |
| 594 | portdata->out_buffer[j], OUT_BUFLEN, option_outdat_callback); |
| 595 | } |
| 596 | } |
| 597 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 598 | static int option_send_setup(struct usb_serial_port *port) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 599 | { |
| 600 | struct usb_serial *serial = port->serial; |
| 601 | struct option_port_private *portdata; |
| 602 | |
| 603 | dbg("%s", __FUNCTION__); |
| 604 | |
| 605 | portdata = usb_get_serial_port_data(port); |
| 606 | |
| 607 | if (port->tty) { |
| 608 | int val = 0; |
| 609 | if (portdata->dtr_state) |
| 610 | val |= 0x01; |
| 611 | if (portdata->rts_state) |
| 612 | val |= 0x02; |
| 613 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 614 | return usb_control_msg(serial->dev, |
| 615 | usb_rcvctrlpipe(serial->dev, 0), |
| 616 | 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | return 0; |
| 620 | } |
| 621 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 622 | static int option_startup(struct usb_serial *serial) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 623 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 624 | int i, err; |
| 625 | struct usb_serial_port *port; |
| 626 | struct option_port_private *portdata; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 627 | |
| 628 | dbg("%s", __FUNCTION__); |
| 629 | |
| 630 | /* Now setup per port private data */ |
| 631 | for (i = 0; i < serial->num_ports; i++) { |
| 632 | port = serial->port[i]; |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 633 | portdata = kmalloc(sizeof(*portdata), GFP_KERNEL); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 634 | if (!portdata) { |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 635 | dbg("%s: kmalloc for option_port_private (%d) failed!.", |
| 636 | __FUNCTION__, i); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 637 | return (1); |
| 638 | } |
| 639 | memset(portdata, 0, sizeof(struct option_port_private)); |
| 640 | |
| 641 | usb_set_serial_port_data(port, portdata); |
| 642 | |
| 643 | if (! port->interrupt_in_urb) |
| 644 | continue; |
| 645 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
| 646 | if (err) |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 647 | dbg("%s: submit irq_in urb failed %d", |
| 648 | __FUNCTION__, err); |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 649 | } |
| 650 | |
| 651 | option_setup_urbs(serial); |
| 652 | |
| 653 | return (0); |
| 654 | } |
| 655 | |
Andrew Morton | 7bb75ae | 2005-07-27 01:08:30 -0700 | [diff] [blame] | 656 | static void option_shutdown(struct usb_serial *serial) |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 657 | { |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 658 | int i, j; |
| 659 | struct usb_serial_port *port; |
| 660 | struct option_port_private *portdata; |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 661 | |
| 662 | dbg("%s", __FUNCTION__); |
| 663 | |
| 664 | /* Stop reading/writing urbs */ |
| 665 | for (i = 0; i < serial->num_ports; ++i) { |
| 666 | port = serial->port[i]; |
| 667 | portdata = usb_get_serial_port_data(port); |
| 668 | for (j = 0; j < N_IN_URB; j++) |
| 669 | stop_urb(portdata->in_urbs[j]); |
| 670 | for (j = 0; j < N_OUT_URB; j++) |
| 671 | stop_urb(portdata->out_urbs[j]); |
| 672 | } |
| 673 | |
| 674 | /* Now free them */ |
| 675 | for (i = 0; i < serial->num_ports; ++i) { |
| 676 | port = serial->port[i]; |
| 677 | portdata = usb_get_serial_port_data(port); |
| 678 | |
| 679 | for (j = 0; j < N_IN_URB; j++) { |
| 680 | if (portdata->in_urbs[j]) { |
| 681 | usb_free_urb(portdata->in_urbs[j]); |
| 682 | portdata->in_urbs[j] = NULL; |
| 683 | } |
| 684 | } |
| 685 | for (j = 0; j < N_OUT_URB; j++) { |
| 686 | if (portdata->out_urbs[j]) { |
| 687 | usb_free_urb(portdata->out_urbs[j]); |
| 688 | portdata->out_urbs[j] = NULL; |
| 689 | } |
| 690 | } |
| 691 | } |
| 692 | |
| 693 | /* Now free per port private data */ |
| 694 | for (i = 0; i < serial->num_ports; i++) { |
| 695 | port = serial->port[i]; |
| 696 | kfree(usb_get_serial_port_data(port)); |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 701 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 702 | MODULE_VERSION(DRIVER_VERSION); |
| 703 | MODULE_LICENSE("GPL"); |
| 704 | |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 705 | #ifdef CONFIG_USB_DEBUG |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 706 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
| 707 | MODULE_PARM_DESC(debug, "Debug messages"); |
Matthias Urlichs | ba460e4 | 2005-07-14 00:33:47 -0700 | [diff] [blame] | 708 | #endif |
Matthias Urlichs | 58cfe91 | 2005-05-23 17:00:48 -0700 | [diff] [blame] | 709 | |