kobil_sct.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. * KOBIL USB Smart Card Terminal Driver
  3. *
  4. * Copyright (C) 2002 KOBIL Systems GmbH
  5. * Author: Thomas Wahrenbruch
  6. *
  7. * Contact: linuxusb@kobil.de
  8. *
  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.
  12. *
  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.
  17. *
  18. * Thanks to Greg Kroah-Hartman (greg@kroah.com) for his help and
  19. * patience.
  20. *
  21. * Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus
  22. * (Adapter K), B1 Professional and KAAN Professional (Adapter B)
  23. */
  24. #include <linux/kernel.h>
  25. #include <linux/errno.h>
  26. #include <linux/slab.h>
  27. #include <linux/tty.h>
  28. #include <linux/tty_driver.h>
  29. #include <linux/tty_flip.h>
  30. #include <linux/module.h>
  31. #include <linux/spinlock.h>
  32. #include <linux/uaccess.h>
  33. #include <linux/usb.h>
  34. #include <linux/usb/serial.h>
  35. #include <linux/ioctl.h>
  36. #include "kobil_sct.h"
  37. #define DRIVER_AUTHOR "KOBIL Systems GmbH - http://www.kobil.com"
  38. #define DRIVER_DESC "KOBIL USB Smart Card Terminal Driver (experimental)"
  39. #define KOBIL_VENDOR_ID 0x0D46
  40. #define KOBIL_ADAPTER_B_PRODUCT_ID 0x2011
  41. #define KOBIL_ADAPTER_K_PRODUCT_ID 0x2012
  42. #define KOBIL_USBTWIN_PRODUCT_ID 0x0078
  43. #define KOBIL_KAAN_SIM_PRODUCT_ID 0x0081
  44. #define KOBIL_TIMEOUT 500
  45. #define KOBIL_BUF_LENGTH 300
  46. /* Function prototypes */
  47. static int kobil_attach(struct usb_serial *serial);
  48. static int kobil_port_probe(struct usb_serial_port *probe);
  49. static int kobil_port_remove(struct usb_serial_port *probe);
  50. static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port);
  51. static void kobil_close(struct usb_serial_port *port);
  52. static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
  53. const unsigned char *buf, int count);
  54. static int kobil_write_room(struct tty_struct *tty);
  55. static int kobil_ioctl(struct tty_struct *tty,
  56. unsigned int cmd, unsigned long arg);
  57. static int kobil_tiocmget(struct tty_struct *tty);
  58. static int kobil_tiocmset(struct tty_struct *tty,
  59. unsigned int set, unsigned int clear);
  60. static void kobil_read_int_callback(struct urb *urb);
  61. static void kobil_write_int_callback(struct urb *urb);
  62. static void kobil_set_termios(struct tty_struct *tty,
  63. struct usb_serial_port *port, struct ktermios *old);
  64. static void kobil_init_termios(struct tty_struct *tty);
  65. static const struct usb_device_id id_table[] = {
  66. { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_ADAPTER_B_PRODUCT_ID) },
  67. { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_ADAPTER_K_PRODUCT_ID) },
  68. { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_USBTWIN_PRODUCT_ID) },
  69. { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_KAAN_SIM_PRODUCT_ID) },
  70. { } /* Terminating entry */
  71. };
  72. MODULE_DEVICE_TABLE(usb, id_table);
  73. static struct usb_serial_driver kobil_device = {
  74. .driver = {
  75. .owner = THIS_MODULE,
  76. .name = "kobil",
  77. },
  78. .description = "KOBIL USB smart card terminal",
  79. .id_table = id_table,
  80. .num_ports = 1,
  81. .attach = kobil_attach,
  82. .port_probe = kobil_port_probe,
  83. .port_remove = kobil_port_remove,
  84. .ioctl = kobil_ioctl,
  85. .set_termios = kobil_set_termios,
  86. .init_termios = kobil_init_termios,
  87. .tiocmget = kobil_tiocmget,
  88. .tiocmset = kobil_tiocmset,
  89. .open = kobil_open,
  90. .close = kobil_close,
  91. .write = kobil_write,
  92. .write_room = kobil_write_room,
  93. .read_int_callback = kobil_read_int_callback,
  94. .write_int_callback = kobil_write_int_callback,
  95. };
  96. static struct usb_serial_driver * const serial_drivers[] = {
  97. &kobil_device, NULL
  98. };
  99. struct kobil_private {
  100. unsigned char buf[KOBIL_BUF_LENGTH]; /* buffer for the APDU to send */
  101. int filled; /* index of the last char in buf */
  102. int cur_pos; /* index of the next char to send in buf */
  103. __u16 device_type;
  104. };
  105. static int kobil_attach(struct usb_serial *serial)
  106. {
  107. if (serial->num_interrupt_out < serial->num_ports) {
  108. dev_err(&serial->interface->dev, "missing interrupt-out endpoint\n");
  109. return -ENODEV;
  110. }
  111. return 0;
  112. }
  113. static int kobil_port_probe(struct usb_serial_port *port)
  114. {
  115. struct usb_serial *serial = port->serial;
  116. struct kobil_private *priv;
  117. priv = kmalloc(sizeof(struct kobil_private), GFP_KERNEL);
  118. if (!priv)
  119. return -ENOMEM;
  120. priv->filled = 0;
  121. priv->cur_pos = 0;
  122. priv->device_type = le16_to_cpu(serial->dev->descriptor.idProduct);
  123. switch (priv->device_type) {
  124. case KOBIL_ADAPTER_B_PRODUCT_ID:
  125. dev_dbg(&serial->dev->dev, "KOBIL B1 PRO / KAAN PRO detected\n");
  126. break;
  127. case KOBIL_ADAPTER_K_PRODUCT_ID:
  128. dev_dbg(&serial->dev->dev, "KOBIL KAAN Standard Plus / SecOVID Reader Plus detected\n");
  129. break;
  130. case KOBIL_USBTWIN_PRODUCT_ID:
  131. dev_dbg(&serial->dev->dev, "KOBIL USBTWIN detected\n");
  132. break;
  133. case KOBIL_KAAN_SIM_PRODUCT_ID:
  134. dev_dbg(&serial->dev->dev, "KOBIL KAAN SIM detected\n");
  135. break;
  136. }
  137. usb_set_serial_port_data(port, priv);
  138. return 0;
  139. }
  140. static int kobil_port_remove(struct usb_serial_port *port)
  141. {
  142. struct kobil_private *priv;
  143. priv = usb_get_serial_port_data(port);
  144. kfree(priv);
  145. return 0;
  146. }
  147. static void kobil_init_termios(struct tty_struct *tty)
  148. {
  149. /* Default to echo off and other sane device settings */
  150. tty->termios.c_lflag = 0;
  151. tty->termios.c_iflag &= ~(ISIG | ICANON | ECHO | IEXTEN | XCASE);
  152. tty->termios.c_iflag |= IGNBRK | IGNPAR | IXOFF;
  153. /* do NOT translate CR to CR-NL (0x0A -> 0x0A 0x0D) */
  154. tty->termios.c_oflag &= ~ONLCR;
  155. }
  156. static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
  157. {
  158. struct device *dev = &port->dev;
  159. int result = 0;
  160. struct kobil_private *priv;
  161. unsigned char *transfer_buffer;
  162. int transfer_buffer_length = 8;
  163. priv = usb_get_serial_port_data(port);
  164. /* allocate memory for transfer buffer */
  165. transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
  166. if (!transfer_buffer)
  167. return -ENOMEM;
  168. /* get hardware version */
  169. result = usb_control_msg(port->serial->dev,
  170. usb_rcvctrlpipe(port->serial->dev, 0),
  171. SUSBCRequest_GetMisc,
  172. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN,
  173. SUSBCR_MSC_GetHWVersion,
  174. 0,
  175. transfer_buffer,
  176. transfer_buffer_length,
  177. KOBIL_TIMEOUT
  178. );
  179. dev_dbg(dev, "%s - Send get_HW_version URB returns: %i\n", __func__, result);
  180. dev_dbg(dev, "Hardware version: %i.%i.%i\n", transfer_buffer[0],
  181. transfer_buffer[1], transfer_buffer[2]);
  182. /* get firmware version */
  183. result = usb_control_msg(port->serial->dev,
  184. usb_rcvctrlpipe(port->serial->dev, 0),
  185. SUSBCRequest_GetMisc,
  186. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN,
  187. SUSBCR_MSC_GetFWVersion,
  188. 0,
  189. transfer_buffer,
  190. transfer_buffer_length,
  191. KOBIL_TIMEOUT
  192. );
  193. dev_dbg(dev, "%s - Send get_FW_version URB returns: %i\n", __func__, result);
  194. dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0],
  195. transfer_buffer[1], transfer_buffer[2]);
  196. if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
  197. priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
  198. /* Setting Baudrate, Parity and Stopbits */
  199. result = usb_control_msg(port->serial->dev,
  200. usb_sndctrlpipe(port->serial->dev, 0),
  201. SUSBCRequest_SetBaudRateParityAndStopBits,
  202. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
  203. SUSBCR_SBR_9600 | SUSBCR_SPASB_EvenParity |
  204. SUSBCR_SPASB_1StopBit,
  205. 0,
  206. NULL,
  207. 0,
  208. KOBIL_TIMEOUT
  209. );
  210. dev_dbg(dev, "%s - Send set_baudrate URB returns: %i\n", __func__, result);
  211. /* reset all queues */
  212. result = usb_control_msg(port->serial->dev,
  213. usb_sndctrlpipe(port->serial->dev, 0),
  214. SUSBCRequest_Misc,
  215. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
  216. SUSBCR_MSC_ResetAllQueues,
  217. 0,
  218. NULL,
  219. 0,
  220. KOBIL_TIMEOUT
  221. );
  222. dev_dbg(dev, "%s - Send reset_all_queues URB returns: %i\n", __func__, result);
  223. }
  224. if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
  225. priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
  226. priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
  227. /* start reading (Adapter B 'cause PNP string) */
  228. result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
  229. dev_dbg(dev, "%s - Send read URB returns: %i\n", __func__, result);
  230. }
  231. kfree(transfer_buffer);
  232. return 0;
  233. }
  234. static void kobil_close(struct usb_serial_port *port)
  235. {
  236. /* FIXME: Add rts/dtr methods */
  237. usb_kill_urb(port->interrupt_out_urb);
  238. usb_kill_urb(port->interrupt_in_urb);
  239. }
  240. static void kobil_read_int_callback(struct urb *urb)
  241. {
  242. int result;
  243. struct usb_serial_port *port = urb->context;
  244. unsigned char *data = urb->transfer_buffer;
  245. int status = urb->status;
  246. if (status) {
  247. dev_dbg(&port->dev, "%s - Read int status not zero: %d\n", __func__, status);
  248. return;
  249. }
  250. if (urb->actual_length) {
  251. usb_serial_debug_data(&port->dev, __func__, urb->actual_length,
  252. data);
  253. tty_insert_flip_string(&port->port, data, urb->actual_length);
  254. tty_flip_buffer_push(&port->port);
  255. }
  256. result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
  257. dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
  258. }
  259. static void kobil_write_int_callback(struct urb *urb)
  260. {
  261. }
  262. static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
  263. const unsigned char *buf, int count)
  264. {
  265. int length = 0;
  266. int result = 0;
  267. int todo = 0;
  268. struct kobil_private *priv;
  269. if (count == 0) {
  270. dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
  271. return 0;
  272. }
  273. priv = usb_get_serial_port_data(port);
  274. if (count > (KOBIL_BUF_LENGTH - priv->filled)) {
  275. dev_dbg(&port->dev, "%s - Error: write request bigger than buffer size\n", __func__);
  276. return -ENOMEM;
  277. }
  278. /* Copy data to buffer */
  279. memcpy(priv->buf + priv->filled, buf, count);
  280. usb_serial_debug_data(&port->dev, __func__, count, priv->buf + priv->filled);
  281. priv->filled = priv->filled + count;
  282. /* only send complete block. TWIN, KAAN SIM and adapter K
  283. use the same protocol. */
  284. if (((priv->device_type != KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 2) && (priv->filled >= (priv->buf[1] + 3))) ||
  285. ((priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 3) && (priv->filled >= (priv->buf[2] + 4)))) {
  286. /* stop reading (except TWIN and KAAN SIM) */
  287. if ((priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID)
  288. || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID))
  289. usb_kill_urb(port->interrupt_in_urb);
  290. todo = priv->filled - priv->cur_pos;
  291. while (todo > 0) {
  292. /* max 8 byte in one urb (endpoint size) */
  293. length = min(todo, port->interrupt_out_size);
  294. /* copy data to transfer buffer */
  295. memcpy(port->interrupt_out_buffer,
  296. priv->buf + priv->cur_pos, length);
  297. port->interrupt_out_urb->transfer_buffer_length = length;
  298. priv->cur_pos = priv->cur_pos + length;
  299. result = usb_submit_urb(port->interrupt_out_urb,
  300. GFP_ATOMIC);
  301. dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result);
  302. todo = priv->filled - priv->cur_pos;
  303. if (todo > 0)
  304. msleep(24);
  305. }
  306. priv->filled = 0;
  307. priv->cur_pos = 0;
  308. /* start reading (except TWIN and KAAN SIM) */
  309. if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
  310. priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
  311. result = usb_submit_urb(port->interrupt_in_urb,
  312. GFP_ATOMIC);
  313. dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
  314. }
  315. }
  316. return count;
  317. }
  318. static int kobil_write_room(struct tty_struct *tty)
  319. {
  320. /* FIXME */
  321. return 8;
  322. }
  323. static int kobil_tiocmget(struct tty_struct *tty)
  324. {
  325. struct usb_serial_port *port = tty->driver_data;
  326. struct kobil_private *priv;
  327. int result;
  328. unsigned char *transfer_buffer;
  329. int transfer_buffer_length = 8;
  330. priv = usb_get_serial_port_data(port);
  331. if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID
  332. || priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
  333. /* This device doesn't support ioctl calls */
  334. return -EINVAL;
  335. }
  336. /* allocate memory for transfer buffer */
  337. transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
  338. if (!transfer_buffer)
  339. return -ENOMEM;
  340. result = usb_control_msg(port->serial->dev,
  341. usb_rcvctrlpipe(port->serial->dev, 0),
  342. SUSBCRequest_GetStatusLineState,
  343. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN,
  344. 0,
  345. 0,
  346. transfer_buffer,
  347. transfer_buffer_length,
  348. KOBIL_TIMEOUT);
  349. dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n",
  350. result);
  351. if (result < 1) {
  352. if (result >= 0)
  353. result = -EIO;
  354. goto out_free;
  355. }
  356. dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]);
  357. result = 0;
  358. if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
  359. result = TIOCM_DSR;
  360. out_free:
  361. kfree(transfer_buffer);
  362. return result;
  363. }
  364. static int kobil_tiocmset(struct tty_struct *tty,
  365. unsigned int set, unsigned int clear)
  366. {
  367. struct usb_serial_port *port = tty->driver_data;
  368. struct device *dev = &port->dev;
  369. struct kobil_private *priv;
  370. int result;
  371. int dtr = 0;
  372. int rts = 0;
  373. /* FIXME: locking ? */
  374. priv = usb_get_serial_port_data(port);
  375. if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID
  376. || priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
  377. /* This device doesn't support ioctl calls */
  378. return -EINVAL;
  379. }
  380. if (set & TIOCM_RTS)
  381. rts = 1;
  382. if (set & TIOCM_DTR)
  383. dtr = 1;
  384. if (clear & TIOCM_RTS)
  385. rts = 0;
  386. if (clear & TIOCM_DTR)
  387. dtr = 0;
  388. if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) {
  389. if (dtr != 0)
  390. dev_dbg(dev, "%s - Setting DTR\n", __func__);
  391. else
  392. dev_dbg(dev, "%s - Clearing DTR\n", __func__);
  393. result = usb_control_msg(port->serial->dev,
  394. usb_sndctrlpipe(port->serial->dev, 0),
  395. SUSBCRequest_SetStatusLinesOrQueues,
  396. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
  397. ((dtr != 0) ? SUSBCR_SSL_SETDTR : SUSBCR_SSL_CLRDTR),
  398. 0,
  399. NULL,
  400. 0,
  401. KOBIL_TIMEOUT);
  402. } else {
  403. if (rts != 0)
  404. dev_dbg(dev, "%s - Setting RTS\n", __func__);
  405. else
  406. dev_dbg(dev, "%s - Clearing RTS\n", __func__);
  407. result = usb_control_msg(port->serial->dev,
  408. usb_sndctrlpipe(port->serial->dev, 0),
  409. SUSBCRequest_SetStatusLinesOrQueues,
  410. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
  411. ((rts != 0) ? SUSBCR_SSL_SETRTS : SUSBCR_SSL_CLRRTS),
  412. 0,
  413. NULL,
  414. 0,
  415. KOBIL_TIMEOUT);
  416. }
  417. dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result);
  418. return (result < 0) ? result : 0;
  419. }
  420. static void kobil_set_termios(struct tty_struct *tty,
  421. struct usb_serial_port *port, struct ktermios *old)
  422. {
  423. struct kobil_private *priv;
  424. int result;
  425. unsigned short urb_val = 0;
  426. int c_cflag = tty->termios.c_cflag;
  427. speed_t speed;
  428. priv = usb_get_serial_port_data(port);
  429. if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
  430. priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
  431. /* This device doesn't support ioctl calls */
  432. tty_termios_copy_hw(&tty->termios, old);
  433. return;
  434. }
  435. speed = tty_get_baud_rate(tty);
  436. switch (speed) {
  437. case 1200:
  438. urb_val = SUSBCR_SBR_1200;
  439. break;
  440. default:
  441. speed = 9600;
  442. case 9600:
  443. urb_val = SUSBCR_SBR_9600;
  444. break;
  445. }
  446. urb_val |= (c_cflag & CSTOPB) ? SUSBCR_SPASB_2StopBits :
  447. SUSBCR_SPASB_1StopBit;
  448. if (c_cflag & PARENB) {
  449. if (c_cflag & PARODD)
  450. urb_val |= SUSBCR_SPASB_OddParity;
  451. else
  452. urb_val |= SUSBCR_SPASB_EvenParity;
  453. } else
  454. urb_val |= SUSBCR_SPASB_NoParity;
  455. tty->termios.c_cflag &= ~CMSPAR;
  456. tty_encode_baud_rate(tty, speed, speed);
  457. result = usb_control_msg(port->serial->dev,
  458. usb_sndctrlpipe(port->serial->dev, 0),
  459. SUSBCRequest_SetBaudRateParityAndStopBits,
  460. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
  461. urb_val,
  462. 0,
  463. NULL,
  464. 0,
  465. KOBIL_TIMEOUT
  466. );
  467. }
  468. static int kobil_ioctl(struct tty_struct *tty,
  469. unsigned int cmd, unsigned long arg)
  470. {
  471. struct usb_serial_port *port = tty->driver_data;
  472. struct kobil_private *priv = usb_get_serial_port_data(port);
  473. int result;
  474. if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
  475. priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)
  476. /* This device doesn't support ioctl calls */
  477. return -ENOIOCTLCMD;
  478. switch (cmd) {
  479. case TCFLSH:
  480. result = usb_control_msg(port->serial->dev,
  481. usb_sndctrlpipe(port->serial->dev, 0),
  482. SUSBCRequest_Misc,
  483. USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT,
  484. SUSBCR_MSC_ResetAllQueues,
  485. 0,
  486. NULL,
  487. 0,
  488. KOBIL_TIMEOUT
  489. );
  490. dev_dbg(&port->dev,
  491. "%s - Send reset_all_queues (FLUSH) URB returns: %i\n",
  492. __func__, result);
  493. return (result < 0) ? -EIO: 0;
  494. default:
  495. return -ENOIOCTLCMD;
  496. }
  497. }
  498. module_usb_serial_driver(serial_drivers, id_table);
  499. MODULE_AUTHOR(DRIVER_AUTHOR);
  500. MODULE_DESCRIPTION(DRIVER_DESC);
  501. MODULE_LICENSE("GPL");