blob: cbe779f578f9be8c1d5b1f0dfc95c1cc165a1e84 [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{
Jiri Slaby05c7cd32013-01-03 15:53:04 +010054 tty_insert_flip_string(&port->port, buf, len);
Jiri Slaby2e124b42013-01-03 15:53:06 +010055 tty_flip_buffer_push(&port->port);
Johan Hovold32802072012-11-18 13:23:35 +010056}
57
58static void opticon_process_status_packet(struct usb_serial_port *port,
59 const unsigned char *buf, size_t len)
60{
61 struct opticon_private *priv = usb_get_serial_port_data(port);
62 unsigned long flags;
63
64 spin_lock_irqsave(&priv->lock, flags);
65 if (buf[0] == 0x00)
66 priv->cts = false;
67 else
68 priv->cts = true;
69 spin_unlock_irqrestore(&priv->lock, flags);
70}
71
72static void opticon_process_read_urb(struct urb *urb)
73{
74 struct usb_serial_port *port = urb->context;
75 const unsigned char *hdr = urb->transfer_buffer;
76 const unsigned char *data = hdr + 2;
77 size_t data_len = urb->actual_length - 2;
78
79 if (urb->actual_length <= 2) {
80 dev_dbg(&port->dev, "malformed packet received: %d bytes\n",
81 urb->actual_length);
82 return;
83 }
84 /*
85 * Data from the device comes with a 2 byte header:
86 *
87 * <0x00><0x00>data...
88 * This is real data to be sent to the tty layer
89 * <0x00><0x01>level
90 * This is a CTS level change, the third byte is the CTS
91 * value (0 for low, 1 for high).
92 */
93 if ((hdr[0] == 0x00) && (hdr[1] == 0x00)) {
94 opticon_process_data_packet(port, data, data_len);
95 } else if ((hdr[0] == 0x00) && (hdr[1] == 0x01)) {
96 opticon_process_status_packet(port, data, data_len);
97 } else {
98 dev_dbg(&port->dev, "unknown packet received: %02x %02x\n",
99 hdr[0], hdr[1]);
100 }
101}
Martin Jansen309a0572011-02-24 14:50:16 +0100102
Martin Jansen309a0572011-02-24 14:50:16 +0100103static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
104 u8 val)
105{
106 struct usb_serial *serial = port->serial;
107 int retval;
Johan Hovoldea0dbeb2012-10-25 10:29:11 +0200108 u8 *buffer;
109
110 buffer = kzalloc(1, GFP_KERNEL);
111 if (!buffer)
112 return -ENOMEM;
Martin Jansen309a0572011-02-24 14:50:16 +0100113
114 buffer[0] = val;
115 /* Send the message to the vendor control endpoint
116 * of the connected device */
117 retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
118 requesttype,
119 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
120 0, 0, buffer, 1, 0);
Johan Hovoldea0dbeb2012-10-25 10:29:11 +0200121 kfree(buffer);
Martin Jansen309a0572011-02-24 14:50:16 +0100122
Johan Hovold94c51dc2013-03-21 12:37:42 +0100123 if (retval < 0)
124 return retval;
125
126 return 0;
Martin Jansen309a0572011-02-24 14:50:16 +0100127}
128
Alan Coxa509a7e2009-09-19 13:13:26 -0700129static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800130{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100131 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800132 unsigned long flags;
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100133 int res;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800134
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800135 spin_lock_irqsave(&priv->lock, flags);
Martin Jansen309a0572011-02-24 14:50:16 +0100136 priv->rts = false;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800137 spin_unlock_irqrestore(&priv->lock, flags);
138
Martin Jansen309a0572011-02-24 14:50:16 +0100139 /* Clear RTS line */
140 send_control_msg(port, CONTROL_RTS, 0);
141
Martin Jansen309a0572011-02-24 14:50:16 +0100142 /* clear the halt status of the enpoint */
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100143 usb_clear_halt(port->serial->dev, port->read_urb->pipe);
Martin Jansen309a0572011-02-24 14:50:16 +0100144
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100145 res = usb_serial_generic_open(tty, port);
146 if (!res)
147 return res;
148
Martin Jansen309a0572011-02-24 14:50:16 +0100149 /* Request CTS line state, sometimes during opening the current
150 * CTS state can be missed. */
151 send_control_msg(port, RESEND_CTS_STATE, 1);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800152
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100153 return res;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800154}
155
Martin Jansen309a0572011-02-24 14:50:16 +0100156static void opticon_write_control_callback(struct urb *urb)
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800157{
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100158 struct usb_serial_port *port = urb->context;
159 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800160 int status = urb->status;
161 unsigned long flags;
162
163 /* free up the transfer buffer, as usb_free_urb() does not do this */
164 kfree(urb->transfer_buffer);
165
Alon Ziv0d930e52010-10-10 08:32:19 +0200166 /* setup packet may be set if we're using it for writing */
167 kfree(urb->setup_packet);
168
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800169 if (status)
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100170 dev_dbg(&port->dev,
Johan Hovolde29a7732012-11-18 13:23:23 +0100171 "%s - non-zero urb status received: %d\n",
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700172 __func__, status);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800173
174 spin_lock_irqsave(&priv->lock, flags);
175 --priv->outstanding_urbs;
176 spin_unlock_irqrestore(&priv->lock, flags);
177
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100178 usb_serial_port_softint(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800179}
180
181static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
182 const unsigned char *buf, int count)
183{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100184 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800185 struct usb_serial *serial = port->serial;
186 struct urb *urb;
187 unsigned char *buffer;
188 unsigned long flags;
189 int status;
Martin Jansen309a0572011-02-24 14:50:16 +0100190 struct usb_ctrlrequest *dr;
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800191
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800192 spin_lock_irqsave(&priv->lock, flags);
193 if (priv->outstanding_urbs > URB_UPPER_LIMIT) {
194 spin_unlock_irqrestore(&priv->lock, flags);
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700195 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800196 return 0;
197 }
198 priv->outstanding_urbs++;
199 spin_unlock_irqrestore(&priv->lock, flags);
200
201 buffer = kmalloc(count, GFP_ATOMIC);
202 if (!buffer) {
203 dev_err(&port->dev, "out of memory\n");
204 count = -ENOMEM;
Martin Jansen309a0572011-02-24 14:50:16 +0100205
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800206 goto error_no_buffer;
207 }
208
209 urb = usb_alloc_urb(0, GFP_ATOMIC);
210 if (!urb) {
211 dev_err(&port->dev, "no more free urbs\n");
212 count = -ENOMEM;
213 goto error_no_urb;
214 }
215
216 memcpy(buffer, buf, count);
217
Greg Kroah-Hartman59d33f22012-09-18 09:58:57 +0100218 usb_serial_debug_data(&port->dev, __func__, count, buffer);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800219
Martin Jansen309a0572011-02-24 14:50:16 +0100220 /* The conncected devices do not have a bulk write endpoint,
221 * to transmit data to de barcode device the control endpoint is used */
222 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
Julia Lawallb0795bb2011-05-13 17:30:46 +0200223 if (!dr) {
224 dev_err(&port->dev, "out of memory\n");
225 count = -ENOMEM;
Johan Hovoldacbf0e52012-10-25 10:29:12 +0200226 goto error_no_dr;
Julia Lawallb0795bb2011-05-13 17:30:46 +0200227 }
Alon Ziv0d930e52010-10-10 08:32:19 +0200228
Martin Jansen309a0572011-02-24 14:50:16 +0100229 dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
230 dr->bRequest = 0x01;
231 dr->wValue = 0;
232 dr->wIndex = 0;
233 dr->wLength = cpu_to_le16(count);
Alon Ziv0d930e52010-10-10 08:32:19 +0200234
Martin Jansen309a0572011-02-24 14:50:16 +0100235 usb_fill_control_urb(urb, serial->dev,
236 usb_sndctrlpipe(serial->dev, 0),
237 (unsigned char *)dr, buffer, count,
Johan Hovolde32d82bc2012-11-18 13:23:32 +0100238 opticon_write_control_callback, port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800239
240 /* send it down the pipe */
241 status = usb_submit_urb(urb, GFP_ATOMIC);
242 if (status) {
243 dev_err(&port->dev,
Martin Jansen309a0572011-02-24 14:50:16 +0100244 "%s - usb_submit_urb(write endpoint) failed status = %d\n",
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800245 __func__, status);
246 count = status;
247 goto error;
248 }
249
250 /* we are done with this urb, so let the host driver
251 * really free it when it is finished with it */
252 usb_free_urb(urb);
253
254 return count;
255error:
Johan Hovoldacbf0e52012-10-25 10:29:12 +0200256 kfree(dr);
257error_no_dr:
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800258 usb_free_urb(urb);
259error_no_urb:
260 kfree(buffer);
261error_no_buffer:
262 spin_lock_irqsave(&priv->lock, flags);
263 --priv->outstanding_urbs;
264 spin_unlock_irqrestore(&priv->lock, flags);
265 return count;
266}
267
268static int opticon_write_room(struct tty_struct *tty)
269{
270 struct usb_serial_port *port = tty->driver_data;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100271 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800272 unsigned long flags;
273
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800274 /*
275 * We really can take almost anything the user throws at us
276 * but let's pick a nice big number to tell the tty
277 * layer that we have lots of free space, unless we don't.
278 */
279 spin_lock_irqsave(&priv->lock, flags);
280 if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) {
281 spin_unlock_irqrestore(&priv->lock, flags);
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700282 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800283 return 0;
284 }
285 spin_unlock_irqrestore(&priv->lock, flags);
286
287 return 2048;
288}
289
Alan Cox60b33c12011-02-14 16:26:14 +0000290static int opticon_tiocmget(struct tty_struct *tty)
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800291{
292 struct usb_serial_port *port = tty->driver_data;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100293 struct opticon_private *priv = usb_get_serial_port_data(port);
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800294 unsigned long flags;
295 int result = 0;
296
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800297 spin_lock_irqsave(&priv->lock, flags);
298 if (priv->rts)
Martin Jansen309a0572011-02-24 14:50:16 +0100299 result |= TIOCM_RTS;
300 if (priv->cts)
301 result |= TIOCM_CTS;
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800302 spin_unlock_irqrestore(&priv->lock, flags);
303
Greg Kroah-Hartmand44d9ab2012-09-13 17:18:19 -0700304 dev_dbg(&port->dev, "%s - %x\n", __func__, result);
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800305 return result;
306}
307
Randy Dunlap4acfaf82011-04-03 11:42:00 -0700308static int opticon_tiocmset(struct tty_struct *tty,
Martin Jansen309a0572011-02-24 14:50:16 +0100309 unsigned int set, unsigned int clear)
310{
311 struct usb_serial_port *port = tty->driver_data;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100312 struct opticon_private *priv = usb_get_serial_port_data(port);
Martin Jansen309a0572011-02-24 14:50:16 +0100313 unsigned long flags;
314 bool rts;
315 bool changed = false;
Johan Hovold81d5a672012-04-25 15:56:29 +0200316 int ret;
Martin Jansen309a0572011-02-24 14:50:16 +0100317
Martin Jansen309a0572011-02-24 14:50:16 +0100318 /* We only support RTS so we only handle that */
319 spin_lock_irqsave(&priv->lock, flags);
320
321 rts = priv->rts;
322 if (set & TIOCM_RTS)
323 priv->rts = true;
324 if (clear & TIOCM_RTS)
325 priv->rts = false;
326 changed = rts ^ priv->rts;
327 spin_unlock_irqrestore(&priv->lock, flags);
328
329 if (!changed)
330 return 0;
331
Johan Hovold94bcef62013-03-21 12:37:43 +0100332 ret = send_control_msg(port, CONTROL_RTS, !rts);
333 if (ret)
334 return usb_translate_errors(ret);
Johan Hovold81d5a672012-04-25 15:56:29 +0200335
Johan Hovold94bcef62013-03-21 12:37:43 +0100336 return 0;
Martin Jansen309a0572011-02-24 14:50:16 +0100337}
338
Johan Hovold56be1a12012-11-18 13:23:31 +0100339static int get_serial_info(struct usb_serial_port *port,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800340 struct serial_struct __user *serial)
341{
342 struct serial_struct tmp;
343
344 if (!serial)
345 return -EFAULT;
346
347 memset(&tmp, 0x00, sizeof(tmp));
348
349 /* fake emulate a 16550 uart to make userspace code happy */
350 tmp.type = PORT_16550A;
Greg Kroah-Hartmane5b1e202013-06-07 11:04:28 -0700351 tmp.line = port->minor;
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800352 tmp.port = 0;
353 tmp.irq = 0;
354 tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
355 tmp.xmit_fifo_size = 1024;
356 tmp.baud_base = 9600;
357 tmp.close_delay = 5*HZ;
358 tmp.closing_wait = 30*HZ;
359
360 if (copy_to_user(serial, &tmp, sizeof(*serial)))
361 return -EFAULT;
362 return 0;
363}
364
Alan Cox00a0d0d2011-02-14 16:27:06 +0000365static int opticon_ioctl(struct tty_struct *tty,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800366 unsigned int cmd, unsigned long arg)
367{
368 struct usb_serial_port *port = tty->driver_data;
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800369
Greg Kroah-Hartman11438322013-06-06 10:32:00 -0700370 dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd);
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800371
372 switch (cmd) {
373 case TIOCGSERIAL:
Johan Hovold56be1a12012-11-18 13:23:31 +0100374 return get_serial_info(port,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800375 (struct serial_struct __user *)arg);
376 }
377
378 return -ENOIOCTLCMD;
379}
380
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800381static int opticon_startup(struct usb_serial *serial)
382{
Johan Hovolda0a5fd92012-11-18 13:23:27 +0100383 if (!serial->num_bulk_in) {
384 dev_err(&serial->dev->dev, "no bulk in endpoint\n");
385 return -ENODEV;
386 }
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800387
Johan Hovold70d25ee2012-11-18 13:23:30 +0100388 return 0;
389}
390
391static int opticon_port_probe(struct usb_serial_port *port)
392{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100393 struct opticon_private *priv;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100394
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800395 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
Johan Hovold70d25ee2012-11-18 13:23:30 +0100396 if (!priv)
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800397 return -ENOMEM;
Johan Hovold70d25ee2012-11-18 13:23:30 +0100398
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800399 spin_lock_init(&priv->lock);
Johan Hovold0b8718a2012-11-18 13:23:22 +0100400
Johan Hovold70d25ee2012-11-18 13:23:30 +0100401 usb_set_serial_port_data(port, priv);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800402
Johan Hovold70d25ee2012-11-18 13:23:30 +0100403 return 0;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800404}
405
Johan Hovold70d25ee2012-11-18 13:23:30 +0100406static int opticon_port_remove(struct usb_serial_port *port)
Alan Sternf9c99bb2009-06-02 11:53:55 -0400407{
Johan Hovold70d25ee2012-11-18 13:23:30 +0100408 struct opticon_private *priv = usb_get_serial_port_data(port);
Alan Sternf9c99bb2009-06-02 11:53:55 -0400409
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800410 kfree(priv);
Johan Hovold70d25ee2012-11-18 13:23:30 +0100411
412 return 0;
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800413}
414
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800415static struct usb_serial_driver opticon_device = {
416 .driver = {
417 .owner = THIS_MODULE,
418 .name = "opticon",
419 },
420 .id_table = id_table,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800421 .num_ports = 1,
Johan Hovold333396f2012-11-18 13:23:33 +0100422 .bulk_in_size = 256,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800423 .attach = opticon_startup,
Johan Hovold70d25ee2012-11-18 13:23:30 +0100424 .port_probe = opticon_port_probe,
425 .port_remove = opticon_port_remove,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800426 .open = opticon_open,
Greg Kroah-Hartman648d4e12009-02-06 18:30:56 -0800427 .write = opticon_write,
428 .write_room = opticon_write_room,
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100429 .throttle = usb_serial_generic_throttle,
430 .unthrottle = usb_serial_generic_unthrottle,
Greg Kroah-Hartmanfaac64a2009-02-06 18:31:46 -0800431 .ioctl = opticon_ioctl,
432 .tiocmget = opticon_tiocmget,
Martin Jansen309a0572011-02-24 14:50:16 +0100433 .tiocmset = opticon_tiocmset,
Johan Hovold7a6ee2b2012-11-18 13:23:36 +0100434 .process_read_urb = opticon_process_read_urb,
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800435};
436
Alan Sternf667dda2012-02-23 14:57:18 -0500437static struct usb_serial_driver * const serial_drivers[] = {
438 &opticon_device, NULL
439};
440
Greg Kroah-Hartman68e24112012-05-08 15:46:14 -0700441module_usb_serial_driver(serial_drivers, id_table);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800442
Martin Jansen309a0572011-02-24 14:50:16 +0100443MODULE_DESCRIPTION(DRIVER_DESC);
Greg Kroah-Hartman57262b82008-11-03 13:27:03 -0800444MODULE_LICENSE("GPL");