aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/airprime.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/airprime.c')
-rw-r--r--drivers/usb/serial/airprime.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 18816bf96a4d..39a498362594 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,11 +18,6 @@
18 18
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
22 { USB_DEVICE(0x1410, 0x1130) }, /* Novatel Wireless S720 CDMA/EV-DO */
23 { USB_DEVICE(0x1410, 0x2110) }, /* Novatel Wireless U720 CDMA/EV-DO */
24 { USB_DEVICE(0x1410, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */
25 { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
26 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */ 21 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
27 { }, 22 { },
28}; 23};
@@ -44,8 +39,43 @@ struct airprime_private {
44 int outstanding_urbs; 39 int outstanding_urbs;
45 int throttled; 40 int throttled;
46 struct urb *read_urbp[NUM_READ_URBS]; 41 struct urb *read_urbp[NUM_READ_URBS];
42
43 /* Settings for the port */
44 int rts_state; /* Handshaking pins (outputs) */
45 int dtr_state;
46 int cts_state; /* Handshaking pins (inputs) */
47 int dsr_state;
48 int dcd_state;
49 int ri_state;
47}; 50};
48 51
52static int airprime_send_setup(struct usb_serial_port *port)
53{
54 struct usb_serial *serial = port->serial;
55 struct airprime_private *priv;
56
57 dbg("%s", __FUNCTION__);
58
59 if (port->number != 0)
60 return 0;
61
62 priv = usb_get_serial_port_data(port);
63
64 if (port->tty) {
65 int val = 0;
66 if (priv->dtr_state)
67 val |= 0x01;
68 if (priv->rts_state)
69 val |= 0x02;
70
71 return usb_control_msg(serial->dev,
72 usb_rcvctrlpipe(serial->dev, 0),
73 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
74 }
75
76 return 0;
77}
78
49static void airprime_read_bulk_callback(struct urb *urb) 79static void airprime_read_bulk_callback(struct urb *urb)
50{ 80{
51 struct usb_serial_port *port = urb->context; 81 struct usb_serial_port *port = urb->context;
@@ -118,6 +148,10 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
118 usb_set_serial_port_data(port, priv); 148 usb_set_serial_port_data(port, priv);
119 } 149 }
120 150
151 /* Set some sane defaults */
152 priv->rts_state = 1;
153 priv->dtr_state = 1;
154
121 for (i = 0; i < NUM_READ_URBS; ++i) { 155 for (i = 0; i < NUM_READ_URBS; ++i) {
122 buffer = kmalloc(buffer_size, GFP_KERNEL); 156 buffer = kmalloc(buffer_size, GFP_KERNEL);
123 if (!buffer) { 157 if (!buffer) {
@@ -151,6 +185,9 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
151 /* remember this urb so we can kill it when the port is closed */ 185 /* remember this urb so we can kill it when the port is closed */
152 priv->read_urbp[i] = urb; 186 priv->read_urbp[i] = urb;
153 } 187 }
188
189 airprime_send_setup(port);
190
154 goto out; 191 goto out;
155 192
156 errout: 193 errout:
@@ -176,6 +213,11 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp)
176 213
177 dbg("%s - port %d", __FUNCTION__, port->number); 214 dbg("%s - port %d", __FUNCTION__, port->number);
178 215
216 priv->rts_state = 0;
217 priv->dtr_state = 0;
218
219 airprime_send_setup(port);
220
179 for (i = 0; i < NUM_READ_URBS; ++i) { 221 for (i = 0; i < NUM_READ_URBS; ++i) {
180 usb_kill_urb (priv->read_urbp[i]); 222 usb_kill_urb (priv->read_urbp[i]);
181 kfree (priv->read_urbp[i]->transfer_buffer); 223 kfree (priv->read_urbp[i]->transfer_buffer);