2 * KOBIL USB Smart Card Terminal Driver
4 * Copyright (C) 2002 KOBIL Systems GmbH
5 * Author: Thomas Wahrenbruch
7 * Contact: linuxusb@kobil.de
9 * This program is largely derived from work by the linux-usb group
10 * and associated source files. Please see the usb/serial files for
11 * individual credits and copyrights.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * Thanks to Greg Kroah-Hartman (greg@kroah.com) for his help and
21 * Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus
22 * (Adapter K), B1 Professional and KAAN Professional (Adapter B)
25 * Fix bug with P'n'P readers
28 * Add support for KAAN SIM
38 #include <linux/config.h>
39 #include <linux/kernel.h>
40 #include <linux/errno.h>
41 #include <linux/init.h>
42 #include <linux/slab.h>
43 #include <linux/tty.h>
44 #include <linux/tty_driver.h>
45 #include <linux/tty_flip.h>
46 #include <linux/module.h>
47 #include <linux/spinlock.h>
48 #include <asm/uaccess.h>
49 #include <linux/usb.h>
50 #include <linux/ioctl.h>
51 #include "usb-serial.h"
52 #include "kobil_sct.h"
56 /* Version Information */
57 #define DRIVER_VERSION "21/05/2004"
58 #define DRIVER_AUTHOR "KOBIL Systems GmbH - http://www.kobil.com"
59 #define DRIVER_DESC "KOBIL USB Smart Card Terminal Driver (experimental)"
61 #define KOBIL_VENDOR_ID 0x0D46
62 #define KOBIL_ADAPTER_B_PRODUCT_ID 0x2011
63 #define KOBIL_ADAPTER_K_PRODUCT_ID 0x2012
64 #define KOBIL_USBTWIN_PRODUCT_ID 0x0078
65 #define KOBIL_KAAN_SIM_PRODUCT_ID 0x0081
67 #define KOBIL_TIMEOUT 500
68 #define KOBIL_BUF_LENGTH 300
71 /* Function prototypes */
72 static int kobil_startup (struct usb_serial *serial);
73 static void kobil_shutdown (struct usb_serial *serial);
74 static int kobil_open (struct usb_serial_port *port, struct file *filp);
75 static void kobil_close (struct usb_serial_port *port, struct file *filp);
76 static int kobil_write (struct usb_serial_port *port,
77 const unsigned char *buf, int count);
78 static int kobil_write_room(struct usb_serial_port *port);
79 static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
80 unsigned int cmd, unsigned long arg);
81 static int kobil_tiocmget(struct usb_serial_port *port, struct file *file);
82 static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
83 unsigned int set, unsigned int clear);
84 static void kobil_read_int_callback( struct urb *urb, struct pt_regs *regs );
85 static void kobil_write_callback( struct urb *purb, struct pt_regs *regs );
88 static struct usb_device_id id_table [] = {
89 { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_ADAPTER_B_PRODUCT_ID) },
90 { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_ADAPTER_K_PRODUCT_ID) },
91 { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_USBTWIN_PRODUCT_ID) },
92 { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_KAAN_SIM_PRODUCT_ID) },
93 { } /* Terminating entry */
97 MODULE_DEVICE_TABLE (usb, id_table);
99 static struct usb_driver kobil_driver = {
101 .probe = usb_serial_probe,
102 .disconnect = usb_serial_disconnect,
103 .id_table = id_table,
108 static struct usb_serial_driver kobil_device = {
110 .owner = THIS_MODULE,
113 .description = "KOBIL USB smart card terminal",
114 .id_table = id_table,
115 .num_interrupt_in = NUM_DONT_CARE,
119 .attach = kobil_startup,
120 .shutdown = kobil_shutdown,
121 .ioctl = kobil_ioctl,
122 .tiocmget = kobil_tiocmget,
123 .tiocmset = kobil_tiocmset,
125 .close = kobil_close,
126 .write = kobil_write,
127 .write_room = kobil_write_room,
128 .read_int_callback = kobil_read_int_callback,
132 struct kobil_private {
133 int write_int_endpoint_address;
134 int read_int_endpoint_address;
135 unsigned char buf[KOBIL_BUF_LENGTH]; // buffer for the APDU to send
136 int filled; // index of the last char in buf
137 int cur_pos; // index of the next char to send in buf
140 struct termios internal_termios;
144 static int kobil_startup (struct usb_serial *serial)
147 struct kobil_private *priv;
148 struct usb_device *pdev;
149 struct usb_host_config *actconfig;
150 struct usb_interface *interface;
151 struct usb_host_interface *altsetting;
152 struct usb_host_endpoint *endpoint;
154 priv = kmalloc(sizeof(struct kobil_private), GFP_KERNEL);
161 priv->device_type = le16_to_cpu(serial->dev->descriptor.idProduct);
162 priv->line_state = 0;
164 switch (priv->device_type){
165 case KOBIL_ADAPTER_B_PRODUCT_ID:
166 printk(KERN_DEBUG "KOBIL B1 PRO / KAAN PRO detected\n");
168 case KOBIL_ADAPTER_K_PRODUCT_ID:
169 printk(KERN_DEBUG "KOBIL KAAN Standard Plus / SecOVID Reader Plus detected\n");
171 case KOBIL_USBTWIN_PRODUCT_ID:
172 printk(KERN_DEBUG "KOBIL USBTWIN detected\n");
174 case KOBIL_KAAN_SIM_PRODUCT_ID:
175 printk(KERN_DEBUG "KOBIL KAAN SIM detected\n");
178 usb_set_serial_port_data(serial->port[0], priv);
180 // search for the necessary endpoints
182 actconfig = pdev->actconfig;
183 interface = actconfig->interface[0];
184 altsetting = interface->cur_altsetting;
185 endpoint = altsetting->endpoint;
187 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
188 endpoint = &altsetting->endpoint[i];
189 if (((endpoint->desc.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) &&
190 ((endpoint->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) {
191 dbg("%s Found interrupt out endpoint. Address: %d", __FUNCTION__, endpoint->desc.bEndpointAddress);
192 priv->write_int_endpoint_address = endpoint->desc.bEndpointAddress;
194 if (((endpoint->desc.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) &&
195 ((endpoint->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) {
196 dbg("%s Found interrupt in endpoint. Address: %d", __FUNCTION__, endpoint->desc.bEndpointAddress);
197 priv->read_int_endpoint_address = endpoint->desc.bEndpointAddress;
204 static void kobil_shutdown (struct usb_serial *serial)
207 dbg("%s - port %d", __FUNCTION__, serial->port[0]->number);
209 for (i=0; i < serial->num_ports; ++i) {
210 while (serial->port[i]->open_count > 0) {
211 kobil_close (serial->port[i], NULL);
213 kfree(usb_get_serial_port_data(serial->port[i]));
214 usb_set_serial_port_data(serial->port[i], NULL);
219 static int kobil_open (struct usb_serial_port *port, struct file *filp)
222 struct kobil_private *priv;
223 unsigned char *transfer_buffer;
224 int transfer_buffer_length = 8;
225 int write_urb_transfer_buffer_length = 8;
227 dbg("%s - port %d", __FUNCTION__, port->number);
228 priv = usb_get_serial_port_data(port);
229 priv->line_state = 0;
231 // someone sets the dev to 0 if the close method has been called
232 port->interrupt_in_urb->dev = port->serial->dev;
235 /* force low_latency on so that our tty_push actually forces
236 * the data through, otherwise it is scheduled, and with high
237 * data rates (like with OHCI) data can get lost.
239 port->tty->low_latency = 1;
241 // without this, every push_tty_char is echoed :-(
242 port->tty->termios->c_lflag = 0;
243 port->tty->termios->c_lflag &= ~(ISIG | ICANON | ECHO | IEXTEN | XCASE);
244 port->tty->termios->c_iflag = IGNBRK | IGNPAR | IXOFF;
245 port->tty->termios->c_oflag &= ~ONLCR; // do NOT translate CR to CR-NL (0x0A -> 0x0A 0x0D)
247 // set up internal termios structure
248 priv->internal_termios.c_iflag = port->tty->termios->c_iflag;
249 priv->internal_termios.c_oflag = port->tty->termios->c_oflag;
250 priv->internal_termios.c_cflag = port->tty->termios->c_cflag;
251 priv->internal_termios.c_lflag = port->tty->termios->c_lflag;
253 for (i=0; i<NCCS; i++) {
254 priv->internal_termios.c_cc[i] = port->tty->termios->c_cc[i];
257 // allocate memory for transfer buffer
258 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
259 if (! transfer_buffer) {
263 // allocate write_urb
264 if (!port->write_urb) {
265 dbg("%s - port %d Allocating port->write_urb", __FUNCTION__, port->number);
266 port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
267 if (!port->write_urb) {
268 dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number);
269 kfree(transfer_buffer);
274 // allocate memory for write_urb transfer buffer
275 port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL);
276 if (! port->write_urb->transfer_buffer) {
277 kfree(transfer_buffer);
278 usb_free_urb(port->write_urb);
279 port->write_urb = NULL;
283 // get hardware version
284 result = usb_control_msg( port->serial->dev,
285 usb_rcvctrlpipe(port->serial->dev, 0 ),
286 SUSBCRequest_GetMisc,
287 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN,
288 SUSBCR_MSC_GetHWVersion,
291 transfer_buffer_length,
294 dbg("%s - port %d Send get_HW_version URB returns: %i", __FUNCTION__, port->number, result);
295 dbg("Harware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] );
297 // get firmware version
298 result = usb_control_msg( port->serial->dev,
299 usb_rcvctrlpipe(port->serial->dev, 0 ),
300 SUSBCRequest_GetMisc,
301 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN,
302 SUSBCR_MSC_GetFWVersion,
305 transfer_buffer_length,
308 dbg("%s - port %d Send get_FW_version URB returns: %i", __FUNCTION__, port->number, result);
309 dbg("Firmware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] );
311 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
312 // Setting Baudrate, Parity and Stopbits
313 result = usb_control_msg( port->serial->dev,
314 usb_rcvctrlpipe(port->serial->dev, 0 ),
315 SUSBCRequest_SetBaudRateParityAndStopBits,
316 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
317 SUSBCR_SBR_9600 | SUSBCR_SPASB_EvenParity | SUSBCR_SPASB_1StopBit,
323 dbg("%s - port %d Send set_baudrate URB returns: %i", __FUNCTION__, port->number, result);
326 result = usb_control_msg( port->serial->dev,
327 usb_rcvctrlpipe(port->serial->dev, 0 ),
329 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
330 SUSBCR_MSC_ResetAllQueues,
336 dbg("%s - port %d Send reset_all_queues URB returns: %i", __FUNCTION__, port->number, result);
338 if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
339 priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
340 // start reading (Adapter B 'cause PNP string)
341 result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC );
342 dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
345 kfree(transfer_buffer);
350 static void kobil_close (struct usb_serial_port *port, struct file *filp)
352 dbg("%s - port %d", __FUNCTION__, port->number);
354 if (port->write_urb) {
355 usb_kill_urb(port->write_urb);
356 usb_free_urb( port->write_urb );
357 port->write_urb = NULL;
359 if (port->interrupt_in_urb)
360 usb_kill_urb(port->interrupt_in_urb);
364 static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs)
367 struct usb_serial_port *port = (struct usb_serial_port *) purb->context;
368 struct tty_struct *tty;
369 unsigned char *data = purb->transfer_buffer;
372 dbg("%s - port %d", __FUNCTION__, port->number);
375 dbg("%s - port %d Read int status not zero: %d", __FUNCTION__, port->number, purb->status);
380 if (purb->actual_length) {
384 dbg_data = kzalloc((3 * purb->actual_length + 10) * sizeof(char), GFP_KERNEL);
388 for (i = 0; i < purb->actual_length; i++) {
389 sprintf(dbg_data +3*i, "%02X ", data[i]);
391 dbg(" <-- %s", dbg_data );
396 tty_buffer_request_room(tty, purb->actual_length);
397 tty_insert_flip_string(tty, data, purb->actual_length);
398 tty_flip_buffer_push(tty);
401 // someone sets the dev to 0 if the close method has been called
402 port->interrupt_in_urb->dev = port->serial->dev;
404 result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC );
405 dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
409 static void kobil_write_callback( struct urb *purb, struct pt_regs *regs )
414 static int kobil_write (struct usb_serial_port *port,
415 const unsigned char *buf, int count)
420 struct kobil_private * priv;
423 dbg("%s - port %d write request of 0 bytes", __FUNCTION__, port->number);
427 priv = usb_get_serial_port_data(port);
429 if (count > (KOBIL_BUF_LENGTH - priv->filled)) {
430 dbg("%s - port %d Error: write request bigger than buffer size", __FUNCTION__, port->number);
434 // Copy data to buffer
435 memcpy (priv->buf + priv->filled, buf, count);
437 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, priv->buf + priv->filled);
439 priv->filled = priv->filled + count;
442 // only send complete block. TWIN, KAAN SIM and adapter K use the same protocol.
443 if ( ((priv->device_type != KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 2) && (priv->filled >= (priv->buf[1] + 3))) ||
444 ((priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 3) && (priv->filled >= (priv->buf[2] + 4))) ) {
446 // stop reading (except TWIN and KAAN SIM)
447 if ( (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) )
448 usb_kill_urb(port->interrupt_in_urb);
450 todo = priv->filled - priv->cur_pos;
453 // max 8 byte in one urb (endpoint size)
454 length = (todo < 8) ? todo : 8;
455 // copy data to transfer buffer
456 memcpy(port->write_urb->transfer_buffer, priv->buf + priv->cur_pos, length );
457 usb_fill_int_urb( port->write_urb,
459 usb_sndintpipe(port->serial->dev, priv->write_int_endpoint_address),
460 port->write_urb->transfer_buffer,
462 kobil_write_callback,
467 priv->cur_pos = priv->cur_pos + length;
468 result = usb_submit_urb( port->write_urb, GFP_NOIO );
469 dbg("%s - port %d Send write URB returns: %i", __FUNCTION__, port->number, result);
470 todo = priv->filled - priv->cur_pos;
481 // someone sets the dev to 0 if the close method has been called
482 port->interrupt_in_urb->dev = port->serial->dev;
484 // start reading (except TWIN and KAAN SIM)
485 if ( (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) ) {
486 // someone sets the dev to 0 if the close method has been called
487 port->interrupt_in_urb->dev = port->serial->dev;
489 result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO );
490 dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
497 static int kobil_write_room (struct usb_serial_port *port)
499 //dbg("%s - port %d", __FUNCTION__, port->number);
504 static int kobil_tiocmget(struct usb_serial_port *port, struct file *file)
506 struct kobil_private * priv;
508 unsigned char *transfer_buffer;
509 int transfer_buffer_length = 8;
511 priv = usb_get_serial_port_data(port);
512 if ((priv->device_type == KOBIL_USBTWIN_PRODUCT_ID) || (priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)) {
513 // This device doesn't support ioctl calls
517 // allocate memory for transfer buffer
518 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
519 if (!transfer_buffer) {
523 result = usb_control_msg( port->serial->dev,
524 usb_rcvctrlpipe(port->serial->dev, 0 ),
525 SUSBCRequest_GetStatusLineState,
526 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN,
530 transfer_buffer_length,
533 dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x",
534 __FUNCTION__, port->number, result, transfer_buffer[0]);
536 if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) {
537 priv->line_state |= TIOCM_DSR;
539 priv->line_state &= ~TIOCM_DSR;
542 kfree(transfer_buffer);
543 return priv->line_state;
546 static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
547 unsigned int set, unsigned int clear)
549 struct kobil_private * priv;
553 unsigned char *transfer_buffer;
554 int transfer_buffer_length = 8;
556 priv = usb_get_serial_port_data(port);
557 if ((priv->device_type == KOBIL_USBTWIN_PRODUCT_ID) || (priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)) {
558 // This device doesn't support ioctl calls
562 // allocate memory for transfer buffer
563 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
564 if (! transfer_buffer) {
572 if (clear & TIOCM_RTS)
574 if (clear & TIOCM_DTR)
577 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) {
579 dbg("%s - port %d Setting DTR", __FUNCTION__, port->number);
581 dbg("%s - port %d Clearing DTR", __FUNCTION__, port->number);
582 result = usb_control_msg( port->serial->dev,
583 usb_rcvctrlpipe(port->serial->dev, 0 ),
584 SUSBCRequest_SetStatusLinesOrQueues,
585 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
586 ((dtr != 0) ? SUSBCR_SSL_SETDTR : SUSBCR_SSL_CLRDTR),
593 dbg("%s - port %d Setting RTS", __FUNCTION__, port->number);
595 dbg("%s - port %d Clearing RTS", __FUNCTION__, port->number);
596 result = usb_control_msg( port->serial->dev,
597 usb_rcvctrlpipe(port->serial->dev, 0 ),
598 SUSBCRequest_SetStatusLinesOrQueues,
599 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
600 ((rts != 0) ? SUSBCR_SSL_SETRTS : SUSBCR_SSL_CLRRTS),
606 dbg("%s - port %d Send set_status_line URB returns: %i", __FUNCTION__, port->number, result);
607 kfree(transfer_buffer);
608 return (result < 0) ? result : 0;
612 static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
613 unsigned int cmd, unsigned long arg)
615 struct kobil_private * priv;
617 unsigned short urb_val = 0;
618 unsigned char *transfer_buffer;
619 int transfer_buffer_length = 8;
621 void __user *user_arg = (void __user *)arg;
623 priv = usb_get_serial_port_data(port);
624 if ((priv->device_type == KOBIL_USBTWIN_PRODUCT_ID) || (priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)) {
625 // This device doesn't support ioctl calls
630 case TCGETS: // 0x5401
631 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct termios))) {
632 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number);
635 if (kernel_termios_to_user_termios((struct termios __user *)arg,
636 &priv->internal_termios))
640 case TCSETS: // 0x5402
641 if (!(port->tty->termios)) {
642 dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number);
645 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct termios))) {
646 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number);
649 if (user_termios_to_kernel_termios(&priv->internal_termios,
650 (struct termios __user *)arg))
653 settings = kzalloc(50, GFP_KERNEL);
658 switch (priv->internal_termios.c_cflag & CBAUD) {
660 urb_val = SUSBCR_SBR_1200;
661 strcat(settings, "1200 ");
665 urb_val = SUSBCR_SBR_9600;
666 strcat(settings, "9600 ");
670 urb_val |= (priv->internal_termios.c_cflag & CSTOPB) ? SUSBCR_SPASB_2StopBits : SUSBCR_SPASB_1StopBit;
671 strcat(settings, (priv->internal_termios.c_cflag & CSTOPB) ? "2 StopBits " : "1 StopBit ");
673 if (priv->internal_termios.c_cflag & PARENB) {
674 if (priv->internal_termios.c_cflag & PARODD) {
675 urb_val |= SUSBCR_SPASB_OddParity;
676 strcat(settings, "Odd Parity");
678 urb_val |= SUSBCR_SPASB_EvenParity;
679 strcat(settings, "Even Parity");
682 urb_val |= SUSBCR_SPASB_NoParity;
683 strcat(settings, "No Parity");
685 dbg("%s - port %d setting port to: %s", __FUNCTION__, port->number, settings );
687 result = usb_control_msg( port->serial->dev,
688 usb_rcvctrlpipe(port->serial->dev, 0 ),
689 SUSBCRequest_SetBaudRateParityAndStopBits,
690 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
698 dbg("%s - port %d Send set_baudrate URB returns: %i", __FUNCTION__, port->number, result);
702 case TCFLSH: // 0x540B
703 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL);
704 if (! transfer_buffer) {
708 result = usb_control_msg( port->serial->dev,
709 usb_rcvctrlpipe(port->serial->dev, 0 ),
711 USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
712 SUSBCR_MSC_ResetAllQueues,
714 NULL,//transfer_buffer,
719 dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __FUNCTION__, port->number, result);
721 kfree(transfer_buffer);
722 return ((result < 0) ? -EFAULT : 0);
729 static int __init kobil_init (void)
732 retval = usb_serial_register(&kobil_device);
734 goto failed_usb_serial_register;
735 retval = usb_register(&kobil_driver);
737 goto failed_usb_register;
739 info(DRIVER_VERSION " " DRIVER_AUTHOR);
744 usb_serial_deregister(&kobil_device);
745 failed_usb_serial_register:
750 static void __exit kobil_exit (void)
752 usb_deregister (&kobil_driver);
753 usb_serial_deregister (&kobil_device);
756 module_init(kobil_init);
757 module_exit(kobil_exit);
759 MODULE_AUTHOR( DRIVER_AUTHOR );
760 MODULE_DESCRIPTION( DRIVER_DESC );
761 MODULE_LICENSE( "GPL" );
763 module_param(debug, bool, S_IRUGO | S_IWUSR);
764 MODULE_PARM_DESC(debug, "Debug enabled or not");