phidgetkit.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. /*
  2. * USB PhidgetInterfaceKit driver 1.0
  3. *
  4. * Copyright (C) 2004 Sean Young <sean@mess.org>
  5. * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This is a driver for the USB PhidgetInterfaceKit.
  13. */
  14. #include <linux/config.h>
  15. #include <linux/kernel.h>
  16. #include <linux/errno.h>
  17. #include <linux/init.h>
  18. #include <linux/slab.h>
  19. #include <linux/module.h>
  20. #include <linux/usb.h>
  21. #define DRIVER_AUTHOR "Sean Young <sean@mess.org>"
  22. #define DRIVER_DESC "USB PhidgetInterfaceKit Driver"
  23. #define USB_VENDOR_ID_GLAB 0x06c2
  24. #define USB_DEVICE_ID_INTERFACEKIT004 0x0040
  25. #define USB_DEVICE_ID_INTERFACEKIT888 0x0045
  26. #define USB_DEVICE_ID_INTERFACEKIT047 0x0051
  27. #define USB_DEVICE_ID_INTERFACEKIT088 0x0053
  28. #define USB_VENDOR_ID_WISEGROUP 0x0925
  29. #define USB_DEVICE_ID_INTERFACEKIT884 0x8201
  30. #define MAX_INTERFACES 8
  31. struct driver_interfacekit {
  32. int sensors;
  33. int inputs;
  34. int outputs;
  35. int has_lcd;
  36. };
  37. #define ifkit(_sensors, _inputs, _outputs, _lcd) \
  38. static struct driver_interfacekit ph_##_sensors##_inputs##_outputs = { \
  39. .sensors = _sensors, \
  40. .inputs = _inputs, \
  41. .outputs = _outputs, \
  42. .has_lcd = _lcd, \
  43. };
  44. ifkit(0, 0, 4, 0);
  45. ifkit(8, 8, 8, 0);
  46. ifkit(0, 4, 7, 1);
  47. ifkit(8, 8, 4, 0);
  48. ifkit(0, 8, 8, 1);
  49. struct phidget_interfacekit {
  50. struct usb_device *udev;
  51. struct usb_interface *intf;
  52. struct driver_interfacekit *ifkit;
  53. int outputs[MAX_INTERFACES];
  54. int inputs[MAX_INTERFACES];
  55. int sensors[MAX_INTERFACES];
  56. u8 lcd_files_on;
  57. struct urb *irq;
  58. unsigned char *data;
  59. dma_addr_t data_dma;
  60. };
  61. static struct usb_device_id id_table[] = {
  62. {USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_INTERFACEKIT004),
  63. .driver_info = (kernel_ulong_t)&ph_004},
  64. {USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_INTERFACEKIT888),
  65. .driver_info = (kernel_ulong_t)&ph_888},
  66. {USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_INTERFACEKIT047),
  67. .driver_info = (kernel_ulong_t)&ph_047},
  68. {USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_INTERFACEKIT088),
  69. .driver_info = (kernel_ulong_t)&ph_088},
  70. {USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_INTERFACEKIT884),
  71. .driver_info = (kernel_ulong_t)&ph_884},
  72. {}
  73. };
  74. MODULE_DEVICE_TABLE(usb, id_table);
  75. static int change_outputs(struct phidget_interfacekit *kit, int output_num, int enable)
  76. {
  77. unsigned char *buffer;
  78. int retval;
  79. int n;
  80. buffer = kzalloc(4, GFP_KERNEL);
  81. if (!buffer) {
  82. dev_err(&kit->udev->dev, "%s - out of memory\n",
  83. __FUNCTION__);
  84. return -ENOMEM;
  85. }
  86. kit->outputs[output_num] = enable;
  87. for (n=0; n<8; n++) {
  88. if (kit->outputs[n]) {
  89. buffer[0] |= 1 << n;
  90. }
  91. }
  92. dev_dbg(&kit->udev->dev, "sending data: %02x\n", buffer[0]);
  93. retval = usb_control_msg(kit->udev,
  94. usb_sndctrlpipe(kit->udev, 0),
  95. 0x09, 0x21, 0x0200, 0x0000, buffer, 4, 2000);
  96. if (retval != 4)
  97. dev_err(&kit->udev->dev, "usb_control_msg returned %d\n",
  98. retval);
  99. kfree(buffer);
  100. return retval < 0 ? retval : 0;
  101. }
  102. static int change_string(struct phidget_interfacekit *kit, const char *display, unsigned char row)
  103. {
  104. unsigned char *buffer;
  105. unsigned char *form_buffer;
  106. int retval = -ENOMEM;
  107. int i,j, len, buf_ptr;
  108. buffer = kmalloc(8, GFP_KERNEL);
  109. form_buffer = kmalloc(30, GFP_KERNEL);
  110. if ((!buffer) || (!form_buffer)) {
  111. dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__);
  112. goto exit;
  113. }
  114. len = strlen(display);
  115. if (len > 20)
  116. len = 20;
  117. dev_dbg(&kit->udev->dev, "Setting LCD line %d to %s\n", row, display);
  118. form_buffer[0] = row * 0x40 + 0x80;
  119. form_buffer[1] = 0x02;
  120. buf_ptr = 2;
  121. for (i = 0; i<len; i++)
  122. form_buffer[buf_ptr++] = display[i];
  123. for (i = 0; i < (20 - len); i++)
  124. form_buffer[buf_ptr++] = 0x20;
  125. form_buffer[buf_ptr++] = 0x01;
  126. form_buffer[buf_ptr++] = row * 0x40 + 0x80 + strlen(display);
  127. for (i = 0; i < buf_ptr; i += 7) {
  128. if ((buf_ptr - i) > 7)
  129. len = 7;
  130. else
  131. len = (buf_ptr - i);
  132. for (j = 0; j < len; j++)
  133. buffer[j] = form_buffer[i + j];
  134. buffer[7] = len;
  135. retval = usb_control_msg(kit->udev,
  136. usb_sndctrlpipe(kit->udev, 0),
  137. 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2000);
  138. if (retval < 0)
  139. goto exit;
  140. }
  141. retval = 0;
  142. exit:
  143. kfree(buffer);
  144. kfree(form_buffer);
  145. return retval;
  146. }
  147. #define set_lcd_line(number) \
  148. static ssize_t lcd_line_##number(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
  149. { \
  150. struct usb_interface *intf = to_usb_interface(dev); \
  151. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  152. change_string(kit, buf, number - 1); \
  153. return count; \
  154. } \
  155. static DEVICE_ATTR(lcd_line_##number, S_IWUGO, NULL, lcd_line_##number);
  156. set_lcd_line(1);
  157. set_lcd_line(2);
  158. static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
  159. {
  160. struct usb_interface *intf = to_usb_interface(dev);
  161. struct phidget_interfacekit *kit = usb_get_intfdata(intf);
  162. int enabled;
  163. unsigned char *buffer;
  164. int retval = -ENOMEM;
  165. buffer = kzalloc(8, GFP_KERNEL);
  166. if (!buffer) {
  167. dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__);
  168. goto exit;
  169. }
  170. if (sscanf(buf, "%d", &enabled) < 1) {
  171. retval = -EINVAL;
  172. goto exit;
  173. }
  174. if (enabled)
  175. buffer[0] = 0x01;
  176. buffer[7] = 0x11;
  177. dev_dbg(&kit->udev->dev, "Setting backlight to %s\n", enabled ? "on" : "off");
  178. retval = usb_control_msg(kit->udev,
  179. usb_sndctrlpipe(kit->udev, 0),
  180. 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2000);
  181. if (retval < 0)
  182. goto exit;
  183. retval = count;
  184. exit:
  185. kfree(buffer);
  186. return retval;
  187. }
  188. static DEVICE_ATTR(backlight, S_IWUGO, NULL, set_backlight);
  189. static void remove_lcd_files(struct phidget_interfacekit *kit)
  190. {
  191. if (kit->lcd_files_on) {
  192. dev_dbg(&kit->udev->dev, "Removing lcd files\n");
  193. device_remove_file(&kit->intf->dev, &dev_attr_lcd_line_1);
  194. device_remove_file(&kit->intf->dev, &dev_attr_lcd_line_2);
  195. device_remove_file(&kit->intf->dev, &dev_attr_backlight);
  196. }
  197. }
  198. static ssize_t enable_lcd_files(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
  199. {
  200. struct usb_interface *intf = to_usb_interface(dev);
  201. struct phidget_interfacekit *kit = usb_get_intfdata(intf);
  202. int enable;
  203. if (kit->ifkit->has_lcd == 0)
  204. return -ENODEV;
  205. if (sscanf(buf, "%d", &enable) < 1)
  206. return -EINVAL;
  207. if (enable) {
  208. if (!kit->lcd_files_on) {
  209. dev_dbg(&kit->udev->dev, "Adding lcd files\n");
  210. device_create_file(&kit->intf->dev, &dev_attr_lcd_line_1);
  211. device_create_file(&kit->intf->dev, &dev_attr_lcd_line_2);
  212. device_create_file(&kit->intf->dev, &dev_attr_backlight);
  213. kit->lcd_files_on = 1;
  214. }
  215. } else {
  216. if (kit->lcd_files_on) {
  217. remove_lcd_files(kit);
  218. kit->lcd_files_on = 0;
  219. }
  220. }
  221. return count;
  222. }
  223. static DEVICE_ATTR(lcd, S_IWUGO, NULL, enable_lcd_files);
  224. static void interfacekit_irq(struct urb *urb, struct pt_regs *regs)
  225. {
  226. struct phidget_interfacekit *kit = urb->context;
  227. unsigned char *buffer = kit->data;
  228. int status;
  229. int n;
  230. switch (urb->status) {
  231. case 0: /* success */
  232. break;
  233. case -ECONNRESET: /* unlink */
  234. case -ENOENT:
  235. case -ESHUTDOWN:
  236. return;
  237. /* -EPIPE: should clear the halt */
  238. default: /* error */
  239. goto resubmit;
  240. }
  241. for (n=0; n<8; n++) {
  242. kit->inputs[n] = buffer[1] & (1 << n) ? 1 : 0;
  243. }
  244. if (buffer[0] & 1) {
  245. kit->sensors[4] = buffer[2] + (buffer[3] & 0x0f) * 256;
  246. kit->sensors[5] = buffer[4] + (buffer[3] & 0xf0) * 16;
  247. kit->sensors[6] = buffer[5] + (buffer[6] & 0x0f) * 256;
  248. kit->sensors[7] = buffer[7] + (buffer[6] & 0xf0) * 16;
  249. } else {
  250. kit->sensors[0] = buffer[2] + (buffer[3] & 0x0f) * 256;
  251. kit->sensors[1] = buffer[4] + (buffer[3] & 0xf0) * 16;
  252. kit->sensors[2] = buffer[5] + (buffer[6] & 0x0f) * 256;
  253. kit->sensors[3] = buffer[7] + (buffer[6] & 0xf0) * 16;
  254. }
  255. resubmit:
  256. status = usb_submit_urb(urb, SLAB_ATOMIC);
  257. if (status)
  258. err("can't resubmit intr, %s-%s/interfacekit0, status %d",
  259. kit->udev->bus->bus_name,
  260. kit->udev->devpath, status);
  261. }
  262. #define show_set_output(value) \
  263. static ssize_t set_output##value(struct device *dev, struct device_attribute *attr, const char *buf, \
  264. size_t count) \
  265. { \
  266. struct usb_interface *intf = to_usb_interface(dev); \
  267. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  268. int enabled; \
  269. int retval; \
  270. \
  271. if (sscanf(buf, "%d", &enabled) < 1) { \
  272. return -EINVAL; \
  273. } \
  274. \
  275. retval = change_outputs(kit, value - 1, enabled ? 1 : 0); \
  276. \
  277. return retval ? retval : count; \
  278. } \
  279. \
  280. static ssize_t show_output##value(struct device *dev, struct device_attribute *attr, char *buf) \
  281. { \
  282. struct usb_interface *intf = to_usb_interface(dev); \
  283. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  284. \
  285. return sprintf(buf, "%d\n", kit->outputs[value - 1]); \
  286. } \
  287. static DEVICE_ATTR(output##value, S_IWUGO | S_IRUGO, \
  288. show_output##value, set_output##value);
  289. show_set_output(1);
  290. show_set_output(2);
  291. show_set_output(3);
  292. show_set_output(4);
  293. show_set_output(5);
  294. show_set_output(6);
  295. show_set_output(7);
  296. show_set_output(8); /* should be MAX_INTERFACES - 1 */
  297. #define show_input(value) \
  298. static ssize_t show_input##value(struct device *dev, struct device_attribute *attr, char *buf) \
  299. { \
  300. struct usb_interface *intf = to_usb_interface(dev); \
  301. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  302. \
  303. return sprintf(buf, "%d\n", kit->inputs[value - 1]); \
  304. } \
  305. static DEVICE_ATTR(input##value, S_IRUGO, show_input##value, NULL);
  306. show_input(1);
  307. show_input(2);
  308. show_input(3);
  309. show_input(4);
  310. show_input(5);
  311. show_input(6);
  312. show_input(7);
  313. show_input(8); /* should be MAX_INTERFACES - 1 */
  314. #define show_sensor(value) \
  315. static ssize_t show_sensor##value(struct device *dev, struct device_attribute *attr, char *buf) \
  316. { \
  317. struct usb_interface *intf = to_usb_interface(dev); \
  318. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  319. \
  320. return sprintf(buf, "%d\n", kit->sensors[value - 1]); \
  321. } \
  322. static DEVICE_ATTR(sensor##value, S_IRUGO, show_sensor##value, NULL);
  323. show_sensor(1);
  324. show_sensor(2);
  325. show_sensor(3);
  326. show_sensor(4);
  327. show_sensor(5);
  328. show_sensor(6);
  329. show_sensor(7);
  330. show_sensor(8); /* should be MAX_INTERFACES - 1 */
  331. static int interfacekit_probe(struct usb_interface *intf, const struct usb_device_id *id)
  332. {
  333. struct usb_device *dev = interface_to_usbdev(intf);
  334. struct usb_host_interface *interface;
  335. struct usb_endpoint_descriptor *endpoint;
  336. struct phidget_interfacekit *kit;
  337. struct driver_interfacekit *ifkit;
  338. int pipe, maxp;
  339. ifkit = (struct driver_interfacekit *)id->driver_info;
  340. if (!ifkit)
  341. return -ENODEV;
  342. interface = intf->cur_altsetting;
  343. if (interface->desc.bNumEndpoints != 1)
  344. return -ENODEV;
  345. endpoint = &interface->endpoint[0].desc;
  346. if (!(endpoint->bEndpointAddress & 0x80))
  347. return -ENODEV;
  348. /*
  349. * bmAttributes
  350. */
  351. pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
  352. maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
  353. kit = kzalloc(sizeof(*kit), GFP_KERNEL);
  354. if (kit == NULL) {
  355. dev_err(&intf->dev, "%s - out of memory\n", __FUNCTION__);
  356. return -ENOMEM;
  357. }
  358. kit->ifkit = ifkit;
  359. kit->data = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &kit->data_dma);
  360. if (!kit->data) {
  361. kfree(kit);
  362. return -ENOMEM;
  363. }
  364. kit->irq = usb_alloc_urb(0, GFP_KERNEL);
  365. if (!kit->irq) {
  366. usb_buffer_free(dev, 8, kit->data, kit->data_dma);
  367. kfree(kit);
  368. return -ENOMEM;
  369. }
  370. kit->udev = usb_get_dev(dev);
  371. kit->intf = intf;
  372. usb_fill_int_urb(kit->irq, kit->udev, pipe, kit->data,
  373. (maxp > 8 ? 8 : maxp),
  374. interfacekit_irq, kit, endpoint->bInterval);
  375. kit->irq->transfer_dma = kit->data_dma;
  376. kit->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
  377. usb_set_intfdata(intf, kit);
  378. if (usb_submit_urb(kit->irq, GFP_KERNEL)) {
  379. return -EIO;
  380. }
  381. if (ifkit->outputs >= 4) {
  382. device_create_file(&intf->dev, &dev_attr_output1);
  383. device_create_file(&intf->dev, &dev_attr_output2);
  384. device_create_file(&intf->dev, &dev_attr_output3);
  385. device_create_file(&intf->dev, &dev_attr_output4);
  386. }
  387. if (ifkit->outputs == 8) {
  388. device_create_file(&intf->dev, &dev_attr_output5);
  389. device_create_file(&intf->dev, &dev_attr_output6);
  390. device_create_file(&intf->dev, &dev_attr_output7);
  391. device_create_file(&intf->dev, &dev_attr_output8);
  392. }
  393. if (ifkit->inputs >= 4) {
  394. device_create_file(&intf->dev, &dev_attr_input1);
  395. device_create_file(&intf->dev, &dev_attr_input2);
  396. device_create_file(&intf->dev, &dev_attr_input3);
  397. device_create_file(&intf->dev, &dev_attr_input4);
  398. }
  399. if (ifkit->inputs == 8) {
  400. device_create_file(&intf->dev, &dev_attr_input5);
  401. device_create_file(&intf->dev, &dev_attr_input6);
  402. device_create_file(&intf->dev, &dev_attr_input7);
  403. device_create_file(&intf->dev, &dev_attr_input8);
  404. }
  405. if (ifkit->sensors >= 4) {
  406. device_create_file(&intf->dev, &dev_attr_sensor1);
  407. device_create_file(&intf->dev, &dev_attr_sensor2);
  408. device_create_file(&intf->dev, &dev_attr_sensor3);
  409. device_create_file(&intf->dev, &dev_attr_sensor4);
  410. }
  411. if (ifkit->sensors >= 7) {
  412. device_create_file(&intf->dev, &dev_attr_sensor5);
  413. device_create_file(&intf->dev, &dev_attr_sensor6);
  414. device_create_file(&intf->dev, &dev_attr_sensor7);
  415. }
  416. if (ifkit->sensors == 8) {
  417. device_create_file(&intf->dev, &dev_attr_sensor8);
  418. }
  419. if (ifkit->has_lcd)
  420. device_create_file(&intf->dev, &dev_attr_lcd);
  421. dev_info(&intf->dev, "USB PhidgetInterfaceKit %d/%d/%d attached\n",
  422. ifkit->sensors, ifkit->inputs, ifkit->outputs);
  423. return 0;
  424. }
  425. static void interfacekit_disconnect(struct usb_interface *interface)
  426. {
  427. struct phidget_interfacekit *kit;
  428. kit = usb_get_intfdata(interface);
  429. usb_set_intfdata(interface, NULL);
  430. if (!kit)
  431. return;
  432. if (kit->ifkit->outputs >= 4) {
  433. device_remove_file(&interface->dev, &dev_attr_output1);
  434. device_remove_file(&interface->dev, &dev_attr_output2);
  435. device_remove_file(&interface->dev, &dev_attr_output3);
  436. device_remove_file(&interface->dev, &dev_attr_output4);
  437. }
  438. if (kit->ifkit->outputs == 8) {
  439. device_remove_file(&interface->dev, &dev_attr_output5);
  440. device_remove_file(&interface->dev, &dev_attr_output6);
  441. device_remove_file(&interface->dev, &dev_attr_output7);
  442. device_remove_file(&interface->dev, &dev_attr_output8);
  443. }
  444. if (kit->ifkit->inputs >= 4) {
  445. device_remove_file(&interface->dev, &dev_attr_input1);
  446. device_remove_file(&interface->dev, &dev_attr_input2);
  447. device_remove_file(&interface->dev, &dev_attr_input3);
  448. device_remove_file(&interface->dev, &dev_attr_input4);
  449. }
  450. if (kit->ifkit->inputs == 8) {
  451. device_remove_file(&interface->dev, &dev_attr_input5);
  452. device_remove_file(&interface->dev, &dev_attr_input6);
  453. device_remove_file(&interface->dev, &dev_attr_input7);
  454. device_remove_file(&interface->dev, &dev_attr_input8);
  455. }
  456. if (kit->ifkit->sensors >= 4) {
  457. device_remove_file(&interface->dev, &dev_attr_sensor1);
  458. device_remove_file(&interface->dev, &dev_attr_sensor2);
  459. device_remove_file(&interface->dev, &dev_attr_sensor3);
  460. device_remove_file(&interface->dev, &dev_attr_sensor4);
  461. }
  462. if (kit->ifkit->sensors >= 7) {
  463. device_remove_file(&interface->dev, &dev_attr_sensor5);
  464. device_remove_file(&interface->dev, &dev_attr_sensor6);
  465. device_remove_file(&interface->dev, &dev_attr_sensor7);
  466. }
  467. if (kit->ifkit->sensors == 8) {
  468. device_remove_file(&interface->dev, &dev_attr_sensor8);
  469. }
  470. if (kit->ifkit->has_lcd)
  471. device_remove_file(&interface->dev, &dev_attr_lcd);
  472. dev_info(&interface->dev, "USB PhidgetInterfaceKit %d/%d/%d detached\n",
  473. kit->ifkit->sensors, kit->ifkit->inputs, kit->ifkit->outputs);
  474. usb_kill_urb(kit->irq);
  475. usb_free_urb(kit->irq);
  476. usb_buffer_free(kit->udev, 8, kit->data, kit->data_dma);
  477. usb_put_dev(kit->udev);
  478. kfree(kit);
  479. }
  480. static struct usb_driver interfacekit_driver = {
  481. .name = "phidgetkit",
  482. .probe = interfacekit_probe,
  483. .disconnect = interfacekit_disconnect,
  484. .id_table = id_table
  485. };
  486. static int __init interfacekit_init(void)
  487. {
  488. int retval = 0;
  489. retval = usb_register(&interfacekit_driver);
  490. if (retval)
  491. err("usb_register failed. Error number %d", retval);
  492. return retval;
  493. }
  494. static void __exit interfacekit_exit(void)
  495. {
  496. usb_deregister(&interfacekit_driver);
  497. }
  498. module_init(interfacekit_init);
  499. module_exit(interfacekit_exit);
  500. MODULE_AUTHOR(DRIVER_AUTHOR);
  501. MODULE_DESCRIPTION(DRIVER_DESC);
  502. MODULE_LICENSE("GPL");