blob: c6bfb83efb1e5b988afa71e1fbcbeaa264101237 [file] [log] [blame]
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -08001/*
2 * Opticon USB barcode to serial driver
3 *
Johan Hovold7a6ee2b2012-11-18 13:23:36 +01004 * Copyright (C) 2011 - 2012 Johan Hovold <jhovold@gmail.com>
Martin Jansen309a0572011-02-24 14:50:16 +01005 * Copyright (C) 2011 Martin Jansen <martin.jansen@opticon.com>
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -08006 * Copyright (C) 2008 - 2009 Greg Kroah-Hartman <gregkh@suse.de>
7 * Copyright (C) 2008 - 2009 Novell Inc.
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -08008 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/tty.h>
17#include <linux/tty_driver.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090018#include <linux/slab.h>
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -080019#include <linux/tty_flip.h>
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -080020#include <linux/serial.h>
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -080021#include <linux/module.h>
22#include <linux/usb.h>
23#include <linux/usb/serial.h>
24#include <linux/uaccess.h>
25
Martin Jansen309a0572011-02-24 14:50:16 +010026#define CONTROL_RTS 0x02
27#define RESEND_CTS_STATE 0x03
28
29/* max number of write urbs in flight */
30#define URB_UPPER_LIMIT 8
31
32/* This driver works for the Opticon 1D barcode reader
33 * an examples of 1D barcode types are EAN, UPC, Code39, IATA etc.. */
34#define DRIVER_DESC "Opticon USB barcode to serial driver (1D)"
35
Németh Márton7d40d7e2010-01-10 15:34:24 +010036static const struct usb_device_id id_table[] = {
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -080037 { USB_DEVICE(0x065a, 0x0009) },
38 { },
39};
40MODULE_DEVICE_TABLE(usb, id_table);
41
42/* This structure holds all of the individual device information */
43struct opticon_private {
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -080044 spinlock_t lock; /* protects the following flags */
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -080045 bool rts;
Martin Jansen309a0572011-02-24 14:50:16 +010046 bool cts;
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -080047 int outstanding_urbs;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -080048};
49
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -080050
Johan Hovold32802072012-11-18 13:23:35 +010051static void opticon_process_data_packet(struct usb_serial_port *port,
52 const unsigned char *buf, size_t len)
53{
54 struct tty_struct *tty;
55
56 tty = tty_port_tty_get(&port->port);
57 if (!tty)
58 return;
59
60 tty_insert_flip_string(tty, buf, len);
61 tty_flip_buffer_push(tty);
62 tty_kref_put(tty);
63}
64
65static void opticon_process_status_packet(struct usb_serial_port *port,
66 const unsigned char *buf, size_t len)
67{
68 struct opticon_private *priv = usb_get_serial_port_data(port);
69 unsigned long flags;
70
71 spin_lock_irqsave(&priv->lock, flags);
72 if (buf[0] == 0x00)
73 priv->cts = false;
74 else
75 priv->cts = true;
76 spin_unlock_irqrestore(&priv->lock, flags);
77}
78
79static void opticon_process_read_urb(struct urb *urb)
80{
81 struct usb_serial_port *port = urb->context;
82 const unsigned char *hdr = urb->transfer_buffer;
83 const unsigned char *data = hdr + 2;
84 size_t data_len = urb->actual_length - 2;
85
86 if (urb->actual_length <= 2) {
87 dev_dbg(&port->dev, "malformed packet received: %d bytes\n",
88 urb->actual_length);
89 return;
90 }
91 /*
92 * Data from the device comes with a 2 byte header:
93 *
94 * <0x00><0x00>data...
95 * This is real data to be sent to the tty layer
96 * <0x00><0x01>level
97 * This is a CTS level change, the third byte is the CTS
98 * value (0 for low, 1 for high).
99 */
100 if ((hdr[0] == 0x00) && (hdr[1] == 0x00)) {
101 opticon_process_data_packet(port, data, data_len);
102 } else if ((hdr[0] == 0x00) && (hdr[1] == 0x01)) {
103 opticon_process_status_packet(port, data, data_len);
104 } else {
105 dev_dbg(&port->dev, "unknown packet received: %02x %02x\n",
106 hdr[0], hdr[1]);
107 }
108}
Martin Jansen309a0572011-02-24 14:50:16 +0100109
Martin Jansen309a0572011-02-24 14:50:16 +0100110static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
111 u8 val)
112{
113 struct usb_serial *serial = port->serial;
114 int retval;
Johan Hovoldea0dbeb2012-10-25 10:29:11 +0200115 u8 *buffer;
116
117 buffer = kzalloc(1, GFP_KERNEL);
118 if (!buffer)
119 return -ENOMEM;
Martin Jansen309a0572011-02-24 14:50:16 +0100120
121 buffer[0] = val;
122 /* Send the message to the vendor control endpoint
123 * of the connected device */
124 retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
125 requesttype,
126 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
127 0, 0, buffer, 1, 0);
Johan Hovoldea0dbeb2012-10-25 10:29:11 +0200128 kfree(buffer);
Martin Jansen309a0572011-02-24 14:50:16 +0100129
130 return retval;
131}
132
Alan Coxa509a7e2009-09-19 13:13:26 -0700133static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800134{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100135 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800136 unsigned long flags;
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100137 int res;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800138
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800139 spin_lock_irqsave(&priv->lock, flags);
Martin Jansen309a0572011-02-24 14:50:16 +0100140 priv->rts = false;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800141 spin_unlock_irqrestore(&priv->lock, flags);
142
Martin Jansen309a0572011-02-24 14:50:16 +0100143 /* Clear RTS line */
144 send_control_msg(port, CONTROL_RTS, 0);
145
Martin Jansen309a0572011-02-24 14:50:16 +0100146 /* clear the halt status of the enpoint */
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100147 usb_clear_halt(port->serial->dev, port->read_urb->pipe);
Martin Jansen309a0572011-02-24 14:50:16 +0100148
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100149 res = usb_serial_generic_open(tty, port);
150 if (!res)
151 return res;
152
Martin Jansen309a0572011-02-24 14:50:16 +0100153 /* Request CTS line state, sometimes during opening the current
154 * CTS state can be missed. */
155 send_control_msg(port, RESEND_CTS_STATE, 1);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800156
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100157 return res;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800158}
159
Martin Jansen309a0572011-02-24 14:50:16 +0100160static void opticon_write_control_callback(struct urb *urb)
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800161{
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100162 struct usb_serial_port *port = urb->context;
163 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800164 int status = urb->status;
165 unsigned long flags;
166
167 /* free up the transfer buffer, as usb_free_urb() does not do this */
168 kfree(urb->transfer_buffer);
169
Alon Ziv0d930e52010-10-10 08:32:19 +0200170 /* setup packet may be set if we're using it for writing */
171 kfree(urb->setup_packet);
172
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800173 if (status)
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100174 dev_dbg(&port->dev,
Johan Hovolde29a7732012-11-18 13:23:23 +0100175 "%s - non-zero urb status received: %d\n",
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700176 __func__, status);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800177
178 spin_lock_irqsave(&priv->lock, flags);
179 --priv->outstanding_urbs;
180 spin_unlock_irqrestore(&priv->lock, flags);
181
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100182 usb_serial_port_softint(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800183}
184
185static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
186 const unsigned char *buf, int count)
187{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100188 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800189 struct usb_serial *serial = port->serial;
190 struct urb *urb;
191 unsigned char *buffer;
192 unsigned long flags;
193 int status;
Martin Jansen309a0572011-02-24 14:50:16 +0100194 struct usb_ctrlrequest *dr;
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800195
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800196 spin_lock_irqsave(&priv->lock, flags);
197 if (priv->outstanding_urbs > URB_UPPER_LIMIT) {
198 spin_unlock_irqrestore(&priv->lock, flags);
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700199 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800200 return 0;
201 }
202 priv->outstanding_urbs++;
203 spin_unlock_irqrestore(&priv->lock, flags);
204
205 buffer = kmalloc(count, GFP_ATOMIC);
206 if (!buffer) {
207 dev_err(&port->dev, "out of memory\n");
208 count = -ENOMEM;
Martin Jansen309a0572011-02-24 14:50:16 +0100209
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800210 goto error_no_buffer;
211 }
212
213 urb = usb_alloc_urb(0, GFP_ATOMIC);
214 if (!urb) {
215 dev_err(&port->dev, "no more free urbs\n");
216 count = -ENOMEM;
217 goto error_no_urb;
218 }
219
220 memcpy(buffer, buf, count);
221
Greg Kroah-Hartman59d33f22012-09-18 09:58:57 +0100222 usb_serial_debug_data(&port->dev, __func__, count, buffer);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800223
Martin Jansen309a0572011-02-24 14:50:16 +0100224 /* The conncected devices do not have a bulk write endpoint,
225 * to transmit data to de barcode device the control endpoint is used */
226 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
Julia Lawallb0795bb2011-05-13 17:30:46 +0200227 if (!dr) {
228 dev_err(&port->dev, "out of memory\n");
229 count = -ENOMEM;
Johan Hovoldacbf0e52012-10-25 10:29:12 +0200230 goto error_no_dr;
Julia Lawallb0795bb2011-05-13 17:30:46 +0200231 }
Alon Ziv0d930e52010-10-10 08:32:19 +0200232
Martin Jansen309a0572011-02-24 14:50:16 +0100233 dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
234 dr->bRequest = 0x01;
235 dr->wValue = 0;
236 dr->wIndex = 0;
237 dr->wLength = cpu_to_le16(count);
Alon Ziv0d930e52010-10-10 08:32:19 +0200238
Martin Jansen309a0572011-02-24 14:50:16 +0100239 usb_fill_control_urb(urb, serial->dev,
240 usb_sndctrlpipe(serial->dev, 0),
241 (unsigned char *)dr, buffer, count,
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100242 opticon_write_control_callback, port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800243
244 /* send it down the pipe */
245 status = usb_submit_urb(urb, GFP_ATOMIC);
246 if (status) {
247 dev_err(&port->dev,
Martin Jansen309a0572011-02-24 14:50:16 +0100248 "%s - usb_submit_urb(write endpoint) failed status = %d\n",
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800249 __func__, status);
250 count = status;
251 goto error;
252 }
253
254 /* we are done with this urb, so let the host driver
255 * really free it when it is finished with it */
256 usb_free_urb(urb);
257
258 return count;
259error:
Johan Hovoldacbf0e52012-10-25 10:29:12 +0200260 kfree(dr);
261error_no_dr:
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800262 usb_free_urb(urb);
263error_no_urb:
264 kfree(buffer);
265error_no_buffer:
266 spin_lock_irqsave(&priv->lock, flags);
267 --priv->outstanding_urbs;
268 spin_unlock_irqrestore(&priv->lock, flags);
269 return count;
270}
271
272static int opticon_write_room(struct tty_struct *tty)
273{
274 struct usb_serial_port *port = tty->driver_data;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100275 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800276 unsigned long flags;
277
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800278 /*
279 * We really can take almost anything the user throws at us
280 * but let's pick a nice big number to tell the tty
281 * layer that we have lots of free space, unless we don't.
282 */
283 spin_lock_irqsave(&priv->lock, flags);
284 if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) {
285 spin_unlock_irqrestore(&priv->lock, flags);
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700286 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800287 return 0;
288 }
289 spin_unlock_irqrestore(&priv->lock, flags);
290
291 return 2048;
292}
293
Alan Cox60b33c12011-02-14 16:26:14 +0000294static int opticon_tiocmget(struct tty_struct *tty)
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800295{
296 struct usb_serial_port *port = tty->driver_data;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100297 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800298 unsigned long flags;
299 int result = 0;
300
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800301 spin_lock_irqsave(&priv->lock, flags);
302 if (priv->rts)
Martin Jansen309a0572011-02-24 14:50:16 +0100303 result |= TIOCM_RTS;
304 if (priv->cts)
305 result |= TIOCM_CTS;
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800306 spin_unlock_irqrestore(&priv->lock, flags);
307
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700308 dev_dbg(&port->dev, "%s - %x\n", __func__, result);
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800309 return result;
310}
311
Randy Dunlap4acfaf82011-04-03 11:42:00 -0700312static int opticon_tiocmset(struct tty_struct *tty,
Martin Jansen309a0572011-02-24 14:50:16 +0100313 unsigned int set, unsigned int clear)
314{
315 struct usb_serial_port *port = tty->driver_data;
Johan Hovold81d5a672012-04-25 15:56:29 +0200316 struct usb_serial *serial = port->serial;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100317 struct opticon_private *priv = usb_get_serial_port_data(port);
Martin Jansen309a0572011-02-24 14:50:16 +0100318 unsigned long flags;
319 bool rts;
320 bool changed = false;
Johan Hovold81d5a672012-04-25 15:56:29 +0200321 int ret;
Martin Jansen309a0572011-02-24 14:50:16 +0100322
Martin Jansen309a0572011-02-24 14:50:16 +0100323 /* We only support RTS so we only handle that */
324 spin_lock_irqsave(&priv->lock, flags);
325
326 rts = priv->rts;
327 if (set & TIOCM_RTS)
328 priv->rts = true;
329 if (clear & TIOCM_RTS)
330 priv->rts = false;
331 changed = rts ^ priv->rts;
332 spin_unlock_irqrestore(&priv->lock, flags);
333
334 if (!changed)
335 return 0;
336
337 /* Send the new RTS state to the connected device */
Johan Hovold81d5a672012-04-25 15:56:29 +0200338 mutex_lock(&serial->disc_mutex);
339 if (!serial->disconnected)
340 ret = send_control_msg(port, CONTROL_RTS, !rts);
341 else
342 ret = -ENODEV;
343 mutex_unlock(&serial->disc_mutex);
344
345 return ret;
Martin Jansen309a0572011-02-24 14:50:16 +0100346}
347
Johan Hovold56be1a12012-11-18 13:23:31 +0100348static int get_serial_info(struct usb_serial_port *port,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800349 struct serial_struct __user *serial)
350{
351 struct serial_struct tmp;
352
353 if (!serial)
354 return -EFAULT;
355
356 memset(&tmp, 0x00, sizeof(tmp));
357
358 /* fake emulate a 16550 uart to make userspace code happy */
359 tmp.type = PORT_16550A;
Johan Hovold56be1a12012-11-18 13:23:31 +0100360 tmp.line = port->serial->minor;
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800361 tmp.port = 0;
362 tmp.irq = 0;
363 tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
364 tmp.xmit_fifo_size = 1024;
365 tmp.baud_base = 9600;
366 tmp.close_delay = 5*HZ;
367 tmp.closing_wait = 30*HZ;
368
369 if (copy_to_user(serial, &tmp, sizeof(*serial)))
370 return -EFAULT;
371 return 0;
372}
373
Alan Cox00a0d0d2011-02-14 16:27:06 +0000374static int opticon_ioctl(struct tty_struct *tty,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800375 unsigned int cmd, unsigned long arg)
376{
377 struct usb_serial_port *port = tty->driver_data;
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800378
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700379 dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd);
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800380
381 switch (cmd) {
382 case TIOCGSERIAL:
Johan Hovold56be1a12012-11-18 13:23:31 +0100383 return get_serial_info(port,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800384 (struct serial_struct __user *)arg);
385 }
386
387 return -ENOIOCTLCMD;
388}
389
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800390static int opticon_startup(struct usb_serial *serial)
391{
Johan Hovolda0a5fd92012-11-18 13:23:27 +0100392 if (!serial->num_bulk_in) {
393 dev_err(&serial->dev->dev, "no bulk in endpoint\n");
394 return -ENODEV;
395 }
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800396
Johan Hovold70d25ee2012-11-18 13:23:30 +0100397 return 0;
398}
399
400static int opticon_port_probe(struct usb_serial_port *port)
401{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100402 struct opticon_private *priv;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100403
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800404 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
Johan Hovold70d25ee2012-11-18 13:23:30 +0100405 if (!priv)
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800406 return -ENOMEM;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100407
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800408 spin_lock_init(&priv->lock);
Johan Hovold0b8718a2012-11-18 13:23:22 +0100409
Johan Hovold70d25ee2012-11-18 13:23:30 +0100410 usb_set_serial_port_data(port, priv);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800411
Johan Hovold70d25ee2012-11-18 13:23:30 +0100412 return 0;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800413}
414
Johan Hovold70d25ee2012-11-18 13:23:30 +0100415static int opticon_port_remove(struct usb_serial_port *port)
Alan Sternf9c99bb2009-06-02 11:53:55 -0400416{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100417 struct opticon_private *priv = usb_get_serial_port_data(port);
Alan Sternf9c99bb2009-06-02 11:53:55 -0400418
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800419 kfree(priv);
Johan Hovold70d25ee2012-11-18 13:23:30 +0100420
421 return 0;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800422}
423
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800424static struct usb_serial_driver opticon_device = {
425 .driver = {
426 .owner = THIS_MODULE,
427 .name = "opticon",
428 },
429 .id_table = id_table,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800430 .num_ports = 1,
Johan Hovold333396f2012-11-18 13:23:33 +0100431 .bulk_in_size = 256,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800432 .attach = opticon_startup,
Johan Hovold70d25ee2012-11-18 13:23:30 +0100433 .port_probe = opticon_port_probe,
434 .port_remove = opticon_port_remove,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800435 .open = opticon_open,
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800436 .write = opticon_write,
437 .write_room = opticon_write_room,
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100438 .throttle = usb_serial_generic_throttle,
439 .unthrottle = usb_serial_generic_unthrottle,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800440 .ioctl = opticon_ioctl,
441 .tiocmget = opticon_tiocmget,
Martin Jansen309a0572011-02-24 14:50:16 +0100442 .tiocmset = opticon_tiocmset,
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100443 .process_read_urb = opticon_process_read_urb,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800444};
445
Alan Sternf667dda2012-02-23 14:57:18 -0500446static struct usb_serial_driver * const serial_drivers[] = {
447 &opticon_device, NULL
448};
449
Greg Kroah-Hartman68e24112012-05-08 15:46:14 -0700450module_usb_serial_driver(serial_drivers, id_table);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800451
Martin Jansen309a0572011-02-24 14:50:16 +0100452MODULE_DESCRIPTION(DRIVER_DESC);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800453MODULE_LICENSE("GPL");