diff options
Diffstat (limited to 'drivers/usb/serial/ipw.c')
| -rw-r--r-- | drivers/usb/serial/ipw.c | 294 |
1 files changed, 153 insertions, 141 deletions
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index bc85ca5c1c37..a842025b9b57 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
| @@ -10,27 +10,27 @@ | |||
| 10 | * (at your option) any later version. | 10 | * (at your option) any later version. |
| 11 | * | 11 | * |
| 12 | * All information about the device was acquired using SnoopyPro | 12 | * All information about the device was acquired using SnoopyPro |
| 13 | * on MSFT's O/S, and examing the MSFT drivers' debug output | 13 | * on MSFT's O/S, and examing the MSFT drivers' debug output |
| 14 | * (insanely left _on_ in the enduser version) | 14 | * (insanely left _on_ in the enduser version) |
| 15 | * | 15 | * |
| 16 | * It was written out of frustration with the IPWireless USB modem | 16 | * It was written out of frustration with the IPWireless USB modem |
| 17 | * supplied by Axity3G/Sentech South Africa not supporting | 17 | * supplied by Axity3G/Sentech South Africa not supporting |
| 18 | * Linux whatsoever. | 18 | * Linux whatsoever. |
| 19 | * | 19 | * |
| 20 | * Nobody provided any proprietary information that was not already | 20 | * Nobody provided any proprietary information that was not already |
| 21 | * available for this device. | 21 | * available for this device. |
| 22 | * | 22 | * |
| 23 | * The modem adheres to the "3GPP TS 27.007 AT command set for 3G | 23 | * The modem adheres to the "3GPP TS 27.007 AT command set for 3G |
| 24 | * User Equipment (UE)" standard, available from | 24 | * User Equipment (UE)" standard, available from |
| 25 | * http://www.3gpp.org/ftp/Specs/html-info/27007.htm | 25 | * http://www.3gpp.org/ftp/Specs/html-info/27007.htm |
| 26 | * | 26 | * |
| 27 | * The code was only tested the IPWireless handheld modem distributed | 27 | * The code was only tested the IPWireless handheld modem distributed |
| 28 | * in South Africa by Sentech. | 28 | * in South Africa by Sentech. |
| 29 | * | 29 | * |
| 30 | * It may work for Woosh Inc in .nz too, as it appears they use the | 30 | * It may work for Woosh Inc in .nz too, as it appears they use the |
| 31 | * same kit. | 31 | * same kit. |
| 32 | * | 32 | * |
| 33 | * There is still some work to be done in terms of handling | 33 | * There is still some work to be done in terms of handling |
| 34 | * DCD, DTR, RTS, CTS which are currently faked. | 34 | * DCD, DTR, RTS, CTS which are currently faked. |
| 35 | * It's good enough for PPP at this point. It's based off all kinds of | 35 | * It's good enough for PPP at this point. It's based off all kinds of |
| 36 | * code found in usb/serial and usb/class | 36 | * code found in usb/serial and usb/class |
| @@ -47,7 +47,7 @@ | |||
| 47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
| 48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
| 49 | #include <linux/usb/serial.h> | 49 | #include <linux/usb/serial.h> |
| 50 | #include <asm/uaccess.h> | 50 | #include <linux/uaccess.h> |
| 51 | 51 | ||
| 52 | /* | 52 | /* |
| 53 | * Version Information | 53 | * Version Information |
| @@ -64,7 +64,7 @@ | |||
| 64 | 64 | ||
| 65 | /* Message sizes */ | 65 | /* Message sizes */ |
| 66 | #define EVENT_BUFFER_SIZE 0xFF | 66 | #define EVENT_BUFFER_SIZE 0xFF |
| 67 | #define CHAR2INT16(c1,c0) (((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff)) | 67 | #define CHAR2INT16(c1, c0) (((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff)) |
| 68 | #define NUM_BULK_URBS 24 | 68 | #define NUM_BULK_URBS 24 |
| 69 | #define NUM_CONTROL_URBS 16 | 69 | #define NUM_CONTROL_URBS 16 |
| 70 | 70 | ||
| @@ -94,33 +94,34 @@ enum { | |||
| 94 | 94 | ||
| 95 | /* data bits */ | 95 | /* data bits */ |
| 96 | #define ipw_dtb_7 0x700 | 96 | #define ipw_dtb_7 0x700 |
| 97 | #define ipw_dtb_8 0x810 // ok so the define is misleading, I know, but forces 8,n,1 | 97 | #define ipw_dtb_8 0x810 /* ok so the define is misleading, I know, but forces 8,n,1 */ |
| 98 | // I mean, is there a point to any other setting these days? :) | 98 | /* I mean, is there a point to any other setting these days? :) */ |
| 99 | 99 | ||
| 100 | /* usb control request types : */ | 100 | /* usb control request types : */ |
| 101 | #define IPW_SIO_RXCTL 0x00 // control bulk rx channel transmissions, value=1/0 (on/off) | 101 | #define IPW_SIO_RXCTL 0x00 /* control bulk rx channel transmissions, value=1/0 (on/off) */ |
| 102 | #define IPW_SIO_SET_BAUD 0x01 // set baud, value=requested ipw_sio_bxxxx | 102 | #define IPW_SIO_SET_BAUD 0x01 /* set baud, value=requested ipw_sio_bxxxx */ |
| 103 | #define IPW_SIO_SET_LINE 0x03 // set databits, parity. value=ipw_dtb_x | 103 | #define IPW_SIO_SET_LINE 0x03 /* set databits, parity. value=ipw_dtb_x */ |
| 104 | #define IPW_SIO_SET_PIN 0x03 // set/clear dtr/rts value=ipw_pin_xxx | 104 | #define IPW_SIO_SET_PIN 0x03 /* set/clear dtr/rts value=ipw_pin_xxx */ |
| 105 | #define IPW_SIO_POLL 0x08 // get serial port status byte, call with value=0 | 105 | #define IPW_SIO_POLL 0x08 /* get serial port status byte, call with value=0 */ |
| 106 | #define IPW_SIO_INIT 0x11 // initializes ? value=0 (appears as first thing todo on open) | 106 | #define IPW_SIO_INIT 0x11 /* initializes ? value=0 (appears as first thing todo on open) */ |
| 107 | #define IPW_SIO_PURGE 0x12 // purge all transmissions?, call with value=numchar_to_purge | 107 | #define IPW_SIO_PURGE 0x12 /* purge all transmissions?, call with value=numchar_to_purge */ |
| 108 | #define IPW_SIO_HANDFLOW 0x13 // set xon/xoff limits value=0, and a buffer of 0x10 bytes | 108 | #define IPW_SIO_HANDFLOW 0x13 /* set xon/xoff limits value=0, and a buffer of 0x10 bytes */ |
| 109 | #define IPW_SIO_SETCHARS 0x13 // set the flowcontrol special chars, value=0, buf=6 bytes, | 109 | #define IPW_SIO_SETCHARS 0x13 /* set the flowcontrol special chars, value=0, buf=6 bytes, */ |
| 110 | // last 2 bytes contain flowcontrol chars e.g. 00 00 00 00 11 13 | 110 | /* last 2 bytes contain flowcontrol chars e.g. 00 00 00 00 11 13 */ |
| 111 | 111 | ||
| 112 | /* values used for request IPW_SIO_SET_PIN */ | 112 | /* values used for request IPW_SIO_SET_PIN */ |
| 113 | #define IPW_PIN_SETDTR 0x101 | 113 | #define IPW_PIN_SETDTR 0x101 |
| 114 | #define IPW_PIN_SETRTS 0x202 | 114 | #define IPW_PIN_SETRTS 0x202 |
| 115 | #define IPW_PIN_CLRDTR 0x100 | 115 | #define IPW_PIN_CLRDTR 0x100 |
| 116 | #define IPW_PIN_CLRRTS 0x200 // unconfirmed | 116 | #define IPW_PIN_CLRRTS 0x200 /* unconfirmed */ |
| 117 | 117 | ||
| 118 | /* values used for request IPW_SIO_RXCTL */ | 118 | /* values used for request IPW_SIO_RXCTL */ |
| 119 | #define IPW_RXBULK_ON 1 | 119 | #define IPW_RXBULK_ON 1 |
| 120 | #define IPW_RXBULK_OFF 0 | 120 | #define IPW_RXBULK_OFF 0 |
| 121 | 121 | ||
| 122 | /* various 16 byte hardcoded transferbuffers used by flow control */ | 122 | /* various 16 byte hardcoded transferbuffers used by flow control */ |
| 123 | #define IPW_BYTES_FLOWINIT { 0x01, 0, 0, 0, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } | 123 | #define IPW_BYTES_FLOWINIT { 0x01, 0, 0, 0, 0x40, 0, 0, 0, \ |
| 124 | 0, 0, 0, 0, 0, 0, 0, 0 } | ||
| 124 | 125 | ||
| 125 | /* Interpretation of modem status lines */ | 126 | /* Interpretation of modem status lines */ |
| 126 | /* These need sorting out by individually connecting pins and checking | 127 | /* These need sorting out by individually connecting pins and checking |
| @@ -132,17 +133,6 @@ enum { | |||
| 132 | #define IPW_CTS ((1<<5) | (1<<4)) | 133 | #define IPW_CTS ((1<<5) | (1<<4)) |
| 133 | 134 | ||
| 134 | #define IPW_WANTS_TO_SEND 0x30 | 135 | #define IPW_WANTS_TO_SEND 0x30 |
| 135 | //#define IPW_DTR /* Data Terminal Ready */ | ||
| 136 | //#define IPW_CTS /* Clear To Send */ | ||
| 137 | //#define IPW_CD /* Carrier Detect */ | ||
| 138 | //#define IPW_DSR /* Data Set Ready */ | ||
| 139 | //#define IPW_RxD /* Receive pin */ | ||
| 140 | |||
| 141 | //#define IPW_LE | ||
| 142 | //#define IPW_RTS | ||
| 143 | //#define IPW_ST | ||
| 144 | //#define IPW_SR | ||
| 145 | //#define IPW_RI /* Ring Indicator */ | ||
| 146 | 136 | ||
| 147 | static struct usb_device_id usb_ipw_ids[] = { | 137 | static struct usb_device_id usb_ipw_ids[] = { |
| 148 | { USB_DEVICE(IPW_VID, IPW_PID) }, | 138 | { USB_DEVICE(IPW_VID, IPW_PID) }, |
| @@ -177,9 +167,10 @@ static void ipw_read_bulk_callback(struct urb *urb) | |||
| 177 | return; | 167 | return; |
| 178 | } | 168 | } |
| 179 | 169 | ||
| 180 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); | 170 | usb_serial_debug_data(debug, &port->dev, __func__, |
| 171 | urb->actual_length, data); | ||
| 181 | 172 | ||
| 182 | tty = port->tty; | 173 | tty = port->port.tty; |
| 183 | if (tty && urb->actual_length) { | 174 | if (tty && urb->actual_length) { |
| 184 | tty_buffer_request_room(tty, urb->actual_length); | 175 | tty_buffer_request_room(tty, urb->actual_length); |
| 185 | tty_insert_flip_string(tty, data, urb->actual_length); | 176 | tty_insert_flip_string(tty, data, urb->actual_length); |
| @@ -187,19 +178,22 @@ static void ipw_read_bulk_callback(struct urb *urb) | |||
| 187 | } | 178 | } |
| 188 | 179 | ||
| 189 | /* Continue trying to always read */ | 180 | /* Continue trying to always read */ |
| 190 | usb_fill_bulk_urb (port->read_urb, port->serial->dev, | 181 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, |
| 191 | usb_rcvbulkpipe(port->serial->dev, | 182 | usb_rcvbulkpipe(port->serial->dev, |
| 192 | port->bulk_in_endpointAddress), | 183 | port->bulk_in_endpointAddress), |
| 193 | port->read_urb->transfer_buffer, | 184 | port->read_urb->transfer_buffer, |
| 194 | port->read_urb->transfer_buffer_length, | 185 | port->read_urb->transfer_buffer_length, |
| 195 | ipw_read_bulk_callback, port); | 186 | ipw_read_bulk_callback, port); |
| 196 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 187 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
| 197 | if (result) | 188 | if (result) |
| 198 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); | 189 | dev_err(&port->dev, |
| 190 | "%s - failed resubmitting read urb, error %d\n", | ||
| 191 | __func__, result); | ||
| 199 | return; | 192 | return; |
| 200 | } | 193 | } |
| 201 | 194 | ||
| 202 | static int ipw_open(struct usb_serial_port *port, struct file *filp) | 195 | static int ipw_open(struct tty_struct *tty, |
| 196 | struct usb_serial_port *port, struct file *filp) | ||
| 203 | { | 197 | { |
| 204 | struct usb_device *dev = port->serial->dev; | 198 | struct usb_device *dev = port->serial->dev; |
| 205 | u8 buf_flow_static[16] = IPW_BYTES_FLOWINIT; | 199 | u8 buf_flow_static[16] = IPW_BYTES_FLOWINIT; |
| @@ -212,29 +206,33 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) | |||
| 212 | if (!buf_flow_init) | 206 | if (!buf_flow_init) |
| 213 | return -ENOMEM; | 207 | return -ENOMEM; |
| 214 | 208 | ||
| 215 | if (port->tty) | 209 | if (tty) |
| 216 | port->tty->low_latency = 1; | 210 | tty->low_latency = 1; |
| 217 | 211 | ||
| 218 | /* --1: Tell the modem to initialize (we think) From sniffs this is always the | 212 | /* --1: Tell the modem to initialize (we think) From sniffs this is |
| 219 | * first thing that gets sent to the modem during opening of the device */ | 213 | * always the first thing that gets sent to the modem during |
| 220 | dbg("%s: Sending SIO_INIT (we guess)",__func__); | 214 | * opening of the device */ |
| 221 | result = usb_control_msg(dev, usb_sndctrlpipe(dev,0), | 215 | dbg("%s: Sending SIO_INIT (we guess)", __func__); |
| 222 | IPW_SIO_INIT, | 216 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 223 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 217 | IPW_SIO_INIT, |
| 224 | 0, | 218 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 225 | 0, /* index */ | 219 | 0, |
| 226 | NULL, | 220 | 0, /* index */ |
| 227 | 0, | 221 | NULL, |
| 228 | 100000); | 222 | 0, |
| 223 | 100000); | ||
| 229 | if (result < 0) | 224 | if (result < 0) |
| 230 | dev_err(&port->dev, "Init of modem failed (error = %d)\n", result); | 225 | dev_err(&port->dev, |
| 226 | "Init of modem failed (error = %d)\n", result); | ||
| 231 | 227 | ||
| 232 | /* reset the bulk pipes */ | 228 | /* reset the bulk pipes */ |
| 233 | usb_clear_halt(dev, usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress)); | 229 | usb_clear_halt(dev, |
| 234 | usb_clear_halt(dev, usb_sndbulkpipe(dev, port->bulk_out_endpointAddress)); | 230 | usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress)); |
| 231 | usb_clear_halt(dev, | ||
| 232 | usb_sndbulkpipe(dev, port->bulk_out_endpointAddress)); | ||
| 235 | 233 | ||
| 236 | /*--2: Start reading from the device */ | 234 | /*--2: Start reading from the device */ |
| 237 | dbg("%s: setting up bulk read callback",__func__); | 235 | dbg("%s: setting up bulk read callback", __func__); |
| 238 | usb_fill_bulk_urb(port->read_urb, dev, | 236 | usb_fill_bulk_urb(port->read_urb, dev, |
| 239 | usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), | 237 | usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), |
| 240 | port->bulk_in_buffer, | 238 | port->bulk_in_buffer, |
| @@ -242,66 +240,72 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) | |||
| 242 | ipw_read_bulk_callback, port); | 240 | ipw_read_bulk_callback, port); |
| 243 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | 241 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); |
| 244 | if (result < 0) | 242 | if (result < 0) |
| 245 | dbg("%s - usb_submit_urb(read bulk) failed with status %d", __func__, result); | 243 | dbg("%s - usb_submit_urb(read bulk) failed with status %d", |
| 244 | __func__, result); | ||
| 246 | 245 | ||
| 247 | /*--3: Tell the modem to open the floodgates on the rx bulk channel */ | 246 | /*--3: Tell the modem to open the floodgates on the rx bulk channel */ |
| 248 | dbg("%s:asking modem for RxRead (RXBULK_ON)",__func__); | 247 | dbg("%s:asking modem for RxRead (RXBULK_ON)", __func__); |
| 249 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 248 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 250 | IPW_SIO_RXCTL, | 249 | IPW_SIO_RXCTL, |
| 251 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 250 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 252 | IPW_RXBULK_ON, | 251 | IPW_RXBULK_ON, |
| 253 | 0, /* index */ | 252 | 0, /* index */ |
| 254 | NULL, | 253 | NULL, |
| 255 | 0, | 254 | 0, |
| 256 | 100000); | 255 | 100000); |
| 257 | if (result < 0) | 256 | if (result < 0) |
| 258 | dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)\n", result); | 257 | dev_err(&port->dev, |
| 258 | "Enabling bulk RxRead failed (error = %d)\n", result); | ||
| 259 | 259 | ||
| 260 | /*--4: setup the initial flowcontrol */ | 260 | /*--4: setup the initial flowcontrol */ |
| 261 | dbg("%s:setting init flowcontrol (%s)",__func__,buf_flow_init); | 261 | dbg("%s:setting init flowcontrol (%s)", __func__, buf_flow_init); |
| 262 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 262 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 263 | IPW_SIO_HANDFLOW, | 263 | IPW_SIO_HANDFLOW, |
| 264 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 264 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 265 | 0, | 265 | 0, |
| 266 | 0, | 266 | 0, |
| 267 | buf_flow_init, | 267 | buf_flow_init, |
| 268 | 0x10, | 268 | 0x10, |
| 269 | 200000); | 269 | 200000); |
| 270 | if (result < 0) | 270 | if (result < 0) |
| 271 | dev_err(&port->dev, "initial flowcontrol failed (error = %d)\n", result); | 271 | dev_err(&port->dev, |
| 272 | "initial flowcontrol failed (error = %d)\n", result); | ||
| 272 | 273 | ||
| 273 | 274 | ||
| 274 | /*--5: raise the dtr */ | 275 | /*--5: raise the dtr */ |
| 275 | dbg("%s:raising dtr",__func__); | 276 | dbg("%s:raising dtr", __func__); |
| 276 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 277 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 277 | IPW_SIO_SET_PIN, | 278 | IPW_SIO_SET_PIN, |
| 278 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 279 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 279 | IPW_PIN_SETDTR, | 280 | IPW_PIN_SETDTR, |
| 280 | 0, | 281 | 0, |
| 281 | NULL, | 282 | NULL, |
| 282 | 0, | 283 | 0, |
| 283 | 200000); | 284 | 200000); |
| 284 | if (result < 0) | 285 | if (result < 0) |
| 285 | dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); | 286 | dev_err(&port->dev, |
| 287 | "setting dtr failed (error = %d)\n", result); | ||
| 286 | 288 | ||
| 287 | /*--6: raise the rts */ | 289 | /*--6: raise the rts */ |
| 288 | dbg("%s:raising rts",__func__); | 290 | dbg("%s:raising rts", __func__); |
| 289 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 291 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 290 | IPW_SIO_SET_PIN, | 292 | IPW_SIO_SET_PIN, |
| 291 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 293 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 292 | IPW_PIN_SETRTS, | 294 | IPW_PIN_SETRTS, |
| 293 | 0, | 295 | 0, |
| 294 | NULL, | 296 | NULL, |
| 295 | 0, | 297 | 0, |
| 296 | 200000); | 298 | 200000); |
| 297 | if (result < 0) | 299 | if (result < 0) |
| 298 | dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); | 300 | dev_err(&port->dev, |
| 299 | 301 | "setting dtr failed (error = %d)\n", result); | |
| 302 | |||
| 300 | kfree(buf_flow_init); | 303 | kfree(buf_flow_init); |
| 301 | return 0; | 304 | return 0; |
| 302 | } | 305 | } |
| 303 | 306 | ||
| 304 | static void ipw_close(struct usb_serial_port *port, struct file * filp) | 307 | static void ipw_close(struct tty_struct *tty, |
| 308 | struct usb_serial_port *port, struct file *filp) | ||
| 305 | { | 309 | { |
| 306 | struct usb_device *dev = port->serial->dev; | 310 | struct usb_device *dev = port->serial->dev; |
| 307 | int result; | 311 | int result; |
| @@ -312,56 +316,62 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) | |||
| 312 | } | 316 | } |
| 313 | 317 | ||
| 314 | /*--1: drop the dtr */ | 318 | /*--1: drop the dtr */ |
| 315 | dbg("%s:dropping dtr",__func__); | 319 | dbg("%s:dropping dtr", __func__); |
| 316 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 320 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 317 | IPW_SIO_SET_PIN, | 321 | IPW_SIO_SET_PIN, |
| 318 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 322 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 319 | IPW_PIN_CLRDTR, | 323 | IPW_PIN_CLRDTR, |
| 320 | 0, | 324 | 0, |
| 321 | NULL, | 325 | NULL, |
| 322 | 0, | 326 | 0, |
| 323 | 200000); | 327 | 200000); |
| 324 | if (result < 0) | 328 | if (result < 0) |
| 325 | dev_err(&port->dev, "dropping dtr failed (error = %d)\n", result); | 329 | dev_err(&port->dev, "dropping dtr failed (error = %d)\n", |
| 330 | result); | ||
| 326 | 331 | ||
| 327 | /*--2: drop the rts */ | 332 | /*--2: drop the rts */ |
| 328 | dbg("%s:dropping rts",__func__); | 333 | dbg("%s:dropping rts", __func__); |
| 329 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 334 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 330 | IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 335 | IPW_SIO_SET_PIN, USB_TYPE_VENDOR | |
| 331 | IPW_PIN_CLRRTS, | 336 | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 332 | 0, | 337 | IPW_PIN_CLRRTS, |
| 333 | NULL, | 338 | 0, |
| 334 | 0, | 339 | NULL, |
| 335 | 200000); | 340 | 0, |
| 341 | 200000); | ||
| 336 | if (result < 0) | 342 | if (result < 0) |
| 337 | dev_err(&port->dev, "dropping rts failed (error = %d)\n", result); | 343 | dev_err(&port->dev, |
| 344 | "dropping rts failed (error = %d)\n", result); | ||
| 338 | 345 | ||
| 339 | 346 | ||
| 340 | /*--3: purge */ | 347 | /*--3: purge */ |
| 341 | dbg("%s:sending purge",__func__); | 348 | dbg("%s:sending purge", __func__); |
| 342 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 349 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 343 | IPW_SIO_PURGE, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 350 | IPW_SIO_PURGE, USB_TYPE_VENDOR | |
| 344 | 0x03, | 351 | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 345 | 0, | 352 | 0x03, |
| 346 | NULL, | 353 | 0, |
| 347 | 0, | 354 | NULL, |
| 348 | 200000); | 355 | 0, |
| 356 | 200000); | ||
| 349 | if (result < 0) | 357 | if (result < 0) |
| 350 | dev_err(&port->dev, "purge failed (error = %d)\n", result); | 358 | dev_err(&port->dev, "purge failed (error = %d)\n", result); |
| 351 | 359 | ||
| 352 | 360 | ||
| 353 | /* send RXBULK_off (tell modem to stop transmitting bulk data on rx chan) */ | 361 | /* send RXBULK_off (tell modem to stop transmitting bulk data on |
| 362 | rx chan) */ | ||
| 354 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 363 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
| 355 | IPW_SIO_RXCTL, | 364 | IPW_SIO_RXCTL, |
| 356 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 365 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
| 357 | IPW_RXBULK_OFF, | 366 | IPW_RXBULK_OFF, |
| 358 | 0, /* index */ | 367 | 0, /* index */ |
| 359 | NULL, | 368 | NULL, |
| 360 | 0, | 369 | 0, |
| 361 | 100000); | 370 | 100000); |
| 362 | 371 | ||
| 363 | if (result < 0) | 372 | if (result < 0) |
| 364 | dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)\n", result); | 373 | dev_err(&port->dev, |
| 374 | "Disabling bulk RxRead failed (error = %d)\n", result); | ||
| 365 | 375 | ||
| 366 | /* shutdown any in-flight urbs that we know about */ | 376 | /* shutdown any in-flight urbs that we know about */ |
| 367 | usb_kill_urb(port->read_urb); | 377 | usb_kill_urb(port->read_urb); |
| @@ -384,13 +394,14 @@ static void ipw_write_bulk_callback(struct urb *urb) | |||
| 384 | usb_serial_port_softint(port); | 394 | usb_serial_port_softint(port); |
| 385 | } | 395 | } |
| 386 | 396 | ||
| 387 | static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count) | 397 | static int ipw_write(struct tty_struct *tty, struct usb_serial_port *port, |
| 398 | const unsigned char *buf, int count) | ||
| 388 | { | 399 | { |
| 389 | struct usb_device *dev = port->serial->dev; | 400 | struct usb_device *dev = port->serial->dev; |
| 390 | int ret; | 401 | int ret; |
| 391 | 402 | ||
| 392 | dbg("%s: TOP: count=%d, in_interrupt=%ld", __func__, | 403 | dbg("%s: TOP: count=%d, in_interrupt=%ld", __func__, |
| 393 | count, in_interrupt() ); | 404 | count, in_interrupt()); |
| 394 | 405 | ||
| 395 | if (count == 0) { | 406 | if (count == 0) { |
| 396 | dbg("%s - write request of 0 bytes", __func__); | 407 | dbg("%s - write request of 0 bytes", __func__); |
| @@ -421,13 +432,14 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int | |||
| 421 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 432 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
| 422 | if (ret != 0) { | 433 | if (ret != 0) { |
| 423 | port->write_urb_busy = 0; | 434 | port->write_urb_busy = 0; |
| 424 | dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __func__, ret); | 435 | dbg("%s - usb_submit_urb(write bulk) failed with error = %d", |
| 436 | __func__, ret); | ||
| 425 | return ret; | 437 | return ret; |
| 426 | } | 438 | } |
| 427 | 439 | ||
| 428 | dbg("%s returning %d", __func__, count); | 440 | dbg("%s returning %d", __func__, count); |
| 429 | return count; | 441 | return count; |
| 430 | } | 442 | } |
| 431 | 443 | ||
| 432 | static int ipw_probe(struct usb_serial_port *port) | 444 | static int ipw_probe(struct usb_serial_port *port) |
| 433 | { | 445 | { |
| @@ -486,8 +498,8 @@ module_init(usb_ipw_init); | |||
| 486 | module_exit(usb_ipw_exit); | 498 | module_exit(usb_ipw_exit); |
| 487 | 499 | ||
| 488 | /* Module information */ | 500 | /* Module information */ |
| 489 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 501 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 490 | MODULE_DESCRIPTION( DRIVER_DESC ); | 502 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 491 | MODULE_LICENSE("GPL"); | 503 | MODULE_LICENSE("GPL"); |
| 492 | 504 | ||
| 493 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 505 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
