phidgetkit.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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 = kmalloc(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. memset(buffer, 0, 4);
  88. for (n=0; n<8; n++) {
  89. if (kit->outputs[n]) {
  90. buffer[0] |= 1 << n;
  91. }
  92. }
  93. dev_dbg(&kit->udev->dev, "sending data: %02x\n", buffer[0]);
  94. retval = usb_control_msg(kit->udev,
  95. usb_sndctrlpipe(kit->udev, 0),
  96. 0x09, 0x21, 0x0200, 0x0000, buffer, 4, 2000);
  97. if (retval != 4)
  98. dev_err(&kit->udev->dev, "usb_control_msg returned %d\n",
  99. retval);
  100. kfree(buffer);
  101. return retval < 0 ? retval : 0;
  102. }
  103. static int change_string(struct phidget_interfacekit *kit, const char *display, unsigned char row)
  104. {
  105. unsigned char *buffer;
  106. unsigned char *form_buffer;
  107. int retval = -ENOMEM;
  108. int i,j, len, buf_ptr;
  109. buffer = kmalloc(8, GFP_KERNEL);
  110. form_buffer = kmalloc(30, GFP_KERNEL);
  111. if ((!buffer) || (!form_buffer)) {
  112. dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__);
  113. goto exit;
  114. }
  115. len = strlen(display);
  116. if (len > 20)
  117. len = 20;
  118. dev_dbg(&kit->udev->dev, "Setting LCD line %d to %s\n", row, display);
  119. form_buffer[0] = row * 0x40 + 0x80;
  120. form_buffer[1] = 0x02;
  121. buf_ptr = 2;
  122. for (i = 0; i<len; i++)
  123. form_buffer[buf_ptr++] = display[i];
  124. for (i = 0; i < (20 - len); i++)
  125. form_buffer[buf_ptr++] = 0x20;
  126. form_buffer[buf_ptr++] = 0x01;
  127. form_buffer[buf_ptr++] = row * 0x40 + 0x80 + strlen(display);
  128. for (i = 0; i < buf_ptr; i += 7) {
  129. if ((buf_ptr - i) > 7)
  130. len = 7;
  131. else
  132. len = (buf_ptr - i);
  133. for (j = 0; j < len; j++)
  134. buffer[j] = form_buffer[i + j];
  135. buffer[7] = len;
  136. retval = usb_control_msg(kit->udev,
  137. usb_sndctrlpipe(kit->udev, 0),
  138. 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2000);
  139. if (retval < 0)
  140. goto exit;
  141. }
  142. retval = 0;
  143. exit:
  144. kfree(buffer);
  145. kfree(form_buffer);
  146. return retval;
  147. }
  148. #define set_lcd_line(number) \
  149. static ssize_t lcd_line_##number(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
  150. { \
  151. struct usb_interface *intf = to_usb_interface(dev); \
  152. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  153. change_string(kit, buf, number - 1); \
  154. return count; \
  155. } \
  156. static DEVICE_ATTR(lcd_line_##number, S_IWUGO, NULL, lcd_line_##number);
  157. set_lcd_line(1);
  158. set_lcd_line(2);
  159. static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
  160. {
  161. struct usb_interface *intf = to_usb_interface(dev);
  162. struct phidget_interfacekit *kit = usb_get_intfdata(intf);
  163. int enabled;
  164. unsigned char *buffer;
  165. int retval = -ENOMEM;
  166. buffer = kmalloc(8, GFP_KERNEL);
  167. if (!buffer) {
  168. dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__);
  169. goto exit;
  170. }
  171. if (sscanf(buf, "%d", &enabled) < 1) {
  172. retval = -EINVAL;
  173. goto exit;
  174. }
  175. memset(buffer, 0x00, 8);
  176. if (enabled)
  177. buffer[0] = 0x01;
  178. buffer[7] = 0x11;
  179. dev_dbg(&kit->udev->dev, "Setting backlight to %s\n", enabled ? "on" : "off");
  180. retval = usb_control_msg(kit->udev,
  181. usb_sndctrlpipe(kit->udev, 0),
  182. 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2000);
  183. if (retval < 0)
  184. goto exit;
  185. retval = count;
  186. exit:
  187. kfree(buffer);
  188. return retval;
  189. }
  190. static DEVICE_ATTR(backlight, S_IWUGO, NULL, set_backlight);
  191. static void remove_lcd_files(struct phidget_interfacekit *kit)
  192. {
  193. if (kit->lcd_files_on) {
  194. dev_dbg(&kit->udev->dev, "Removing lcd files\n");
  195. device_remove_file(&kit->intf->dev, &dev_attr_lcd_line_1);
  196. device_remove_file(&kit->intf->dev, &dev_attr_lcd_line_2);
  197. device_remove_file(&kit->intf->dev, &dev_attr_backlight);
  198. }
  199. }
  200. static ssize_t enable_lcd_files(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
  201. {
  202. struct usb_interface *intf = to_usb_interface(dev);
  203. struct phidget_interfacekit *kit = usb_get_intfdata(intf);
  204. int enable;
  205. if (kit->ifkit->has_lcd == 0)
  206. return -ENODEV;
  207. if (sscanf(buf, "%d", &enable) < 1)
  208. return -EINVAL;
  209. if (enable) {
  210. if (!kit->lcd_files_on) {
  211. dev_dbg(&kit->udev->dev, "Adding lcd files\n");
  212. device_create_file(&kit->intf->dev, &dev_attr_lcd_line_1);
  213. device_create_file(&kit->intf->dev, &dev_attr_lcd_line_2);
  214. device_create_file(&kit->intf->dev, &dev_attr_backlight);
  215. kit->lcd_files_on = 1;
  216. }
  217. } else {
  218. if (kit->lcd_files_on) {
  219. remove_lcd_files(kit);
  220. kit->lcd_files_on = 0;
  221. }
  222. }
  223. return count;
  224. }
  225. static DEVICE_ATTR(lcd, S_IWUGO, NULL, enable_lcd_files);
  226. static void interfacekit_irq(struct urb *urb, struct pt_regs *regs)
  227. {
  228. struct phidget_interfacekit *kit = urb->context;
  229. unsigned char *buffer = kit->data;
  230. int status;
  231. int n;
  232. switch (urb->status) {
  233. case 0: /* success */
  234. break;
  235. case -ECONNRESET: /* unlink */
  236. case -ENOENT:
  237. case -ESHUTDOWN:
  238. return;
  239. /* -EPIPE: should clear the halt */
  240. default: /* error */
  241. goto resubmit;
  242. }
  243. for (n=0; n<8; n++) {
  244. kit->inputs[n] = buffer[1] & (1 << n) ? 1 : 0;
  245. }
  246. if (buffer[0] & 1) {
  247. kit->sensors[4] = buffer[2] + (buffer[3] & 0x0f) * 256;
  248. kit->sensors[5] = buffer[4] + (buffer[3] & 0xf0) * 16;
  249. kit->sensors[6] = buffer[5] + (buffer[6] & 0x0f) * 256;
  250. kit->sensors[7] = buffer[7] + (buffer[6] & 0xf0) * 16;
  251. } else {
  252. kit->sensors[0] = buffer[2] + (buffer[3] & 0x0f) * 256;
  253. kit->sensors[1] = buffer[4] + (buffer[3] & 0xf0) * 16;
  254. kit->sensors[2] = buffer[5] + (buffer[6] & 0x0f) * 256;
  255. kit->sensors[3] = buffer[7] + (buffer[6] & 0xf0) * 16;
  256. }
  257. resubmit:
  258. status = usb_submit_urb(urb, SLAB_ATOMIC);
  259. if (status)
  260. err("can't resubmit intr, %s-%s/interfacekit0, status %d",
  261. kit->udev->bus->bus_name,
  262. kit->udev->devpath, status);
  263. }
  264. #define show_set_output(value) \
  265. static ssize_t set_output##value(struct device *dev, struct device_attribute *attr, const char *buf, \
  266. size_t count) \
  267. { \
  268. struct usb_interface *intf = to_usb_interface(dev); \
  269. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  270. int enabled; \
  271. int retval; \
  272. \
  273. if (sscanf(buf, "%d", &enabled) < 1) { \
  274. return -EINVAL; \
  275. } \
  276. \
  277. retval = change_outputs(kit, value - 1, enabled ? 1 : 0); \
  278. \
  279. return retval ? retval : count; \
  280. } \
  281. \
  282. static ssize_t show_output##value(struct device *dev, struct device_attribute *attr, char *buf) \
  283. { \
  284. struct usb_interface *intf = to_usb_interface(dev); \
  285. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  286. \
  287. return sprintf(buf, "%d\n", kit->outputs[value - 1]); \
  288. } \
  289. static DEVICE_ATTR(output##value, S_IWUGO | S_IRUGO, \
  290. show_output##value, set_output##value);
  291. show_set_output(1);
  292. show_set_output(2);
  293. show_set_output(3);
  294. show_set_output(4);
  295. show_set_output(5);
  296. show_set_output(6);
  297. show_set_output(7);
  298. show_set_output(8); /* should be MAX_INTERFACES - 1 */
  299. #define show_input(value) \
  300. static ssize_t show_input##value(struct device *dev, struct device_attribute *attr, char *buf) \
  301. { \
  302. struct usb_interface *intf = to_usb_interface(dev); \
  303. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  304. \
  305. return sprintf(buf, "%d\n", kit->inputs[value - 1]); \
  306. } \
  307. static DEVICE_ATTR(input##value, S_IRUGO, show_input##value, NULL);
  308. show_input(1);
  309. show_input(2);
  310. show_input(3);
  311. show_input(4);
  312. show_input(5);
  313. show_input(6);
  314. show_input(7);
  315. show_input(8); /* should be MAX_INTERFACES - 1 */
  316. #define show_sensor(value) \
  317. static ssize_t show_sensor##value(struct device *dev, struct device_attribute *attr, char *buf) \
  318. { \
  319. struct usb_interface *intf = to_usb_interface(dev); \
  320. struct phidget_interfacekit *kit = usb_get_intfdata(intf); \
  321. \
  322. return sprintf(buf, "%d\n", kit->sensors[value - 1]); \
  323. } \
  324. static DEVICE_ATTR(sensor##value, S_IRUGO, show_sensor##value, NULL);
  325. show_sensor(1);
  326. show_sensor(2);
  327. show_sensor(3);
  328. show_sensor(4);
  329. show_sensor(5);
  330. show_sensor(6);
  331. show_sensor(7);
  332. show_sensor(8); /* should be MAX_INTERFACES - 1 */
  333. static int interfacekit_probe(struct usb_interface *intf, const struct usb_device_id *id)
  334. {
  335. struct usb_device *dev = interface_to_usbdev(intf);
  336. struct usb_host_interface *interface;
  337. struct usb_endpoint_descriptor *endpoint;
  338. struct phidget_interfacekit *kit;
  339. struct driver_interfacekit *ifkit;
  340. int pipe, maxp;
  341. ifkit = (struct driver_interfacekit *)id->driver_info;
  342. if (!ifkit)
  343. return -ENODEV;
  344. interface = intf->cur_altsetting;
  345. if (interface->desc.bNumEndpoints != 1)
  346. return -ENODEV;
  347. endpoint = &interface->endpoint[0].desc;
  348. if (!(endpoint->bEndpointAddress & 0x80))
  349. return -ENODEV;
  350. /*
  351. * bmAttributes
  352. */
  353. pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
  354. maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
  355. kit = kmalloc(sizeof(*kit), GFP_KERNEL);
  356. if (kit == NULL) {
  357. dev_err(&intf->dev, "%s - out of memory\n", __FUNCTION__);
  358. return -ENOMEM;
  359. }
  360. memset(kit, 0, sizeof(*kit));
  361. kit->ifkit = ifkit;
  362. kit->data = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &kit->data_dma);
  363. if (!kit->data) {
  364. kfree(kit);
  365. return -ENOMEM;
  366. }
  367. kit->irq = usb_alloc_urb(0, GFP_KERNEL);
  368. if (!kit->irq) {
  369. usb_buffer_free(dev, 8, kit->data, kit->data_dma);
  370. kfree(kit);
  371. return -ENOMEM;
  372. }
  373. kit->udev = usb_get_dev(dev);
  374. kit->intf = intf;
  375. usb_fill_int_urb(kit->irq, kit->udev, pipe, kit->data,
  376. (maxp > 8 ? 8 : maxp),
  377. interfacekit_irq, kit, endpoint->bInterval);
  378. kit->irq->transfer_dma = kit->data_dma;
  379. kit->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
  380. usb_set_intfdata(intf, kit);
  381. if (usb_submit_urb(kit->irq, GFP_KERNEL)) {
  382. return -EIO;
  383. }
  384. if (ifkit->outputs >= 4) {
  385. device_create_file(&intf->dev, &dev_attr_output1);
  386. device_create_file(&intf->dev, &dev_attr_output2);
  387. device_create_file(&intf->dev, &dev_attr_output3);
  388. device_create_file(&intf->dev, &dev_attr_output4);
  389. }
  390. if (ifkit->outputs == 8) {
  391. device_create_file(&intf->dev, &dev_attr_output5);
  392. device_create_file(&intf->dev, &dev_attr_output6);
  393. device_create_file(&intf->dev, &dev_attr_output7);
  394. device_create_file(&intf->dev, &dev_attr_output8);
  395. }
  396. if (ifkit->inputs >= 4) {
  397. device_create_file(&intf->dev, &dev_attr_input1);
  398. device_create_file(&intf->dev, &dev_attr_input2);
  399. device_create_file(&intf->dev, &dev_attr_input3);
  400. device_create_file(&intf->dev, &dev_attr_input4);
  401. }
  402. if (ifkit->inputs == 8) {
  403. device_create_file(&intf->dev, &dev_attr_input5);
  404. device_create_file(&intf->dev, &dev_attr_input6);
  405. device_create_file(&intf->dev, &dev_attr_input7);
  406. device_create_file(&intf->dev, &dev_attr_input8);
  407. }
  408. if (ifkit->sensors >= 4) {
  409. device_create_file(&intf->dev, &dev_attr_sensor1);
  410. device_create_file(&intf->dev, &dev_attr_sensor2);
  411. device_create_file(&intf->dev, &dev_attr_sensor3);
  412. device_create_file(&intf->dev, &dev_attr_sensor4);
  413. }
  414. if (ifkit->sensors >= 7) {
  415. device_create_file(&intf->dev, &dev_attr_sensor5);
  416. device_create_file(&intf->dev, &dev_attr_sensor6);
  417. device_create_file(&intf->dev, &dev_attr_sensor7);
  418. }
  419. if (ifkit->sensors == 8) {
  420. device_create_file(&intf->dev, &dev_attr_sensor8);
  421. }
  422. if (ifkit->has_lcd)
  423. device_create_file(&intf->dev, &dev_attr_lcd);
  424. dev_info(&intf->dev, "USB PhidgetInterfaceKit %d/%d/%d attached\n",
  425. ifkit->sensors, ifkit->inputs, ifkit->outputs);
  426. return 0;
  427. }
  428. static void interfacekit_disconnect(struct usb_interface *interface)
  429. {
  430. struct phidget_interfacekit *kit;
  431. kit = usb_get_intfdata(interface);
  432. usb_set_intfdata(interface, NULL);
  433. if (!kit)
  434. return;
  435. if (kit->ifkit->outputs >= 4) {
  436. device_remove_file(&interface->dev, &dev_attr_output1);
  437. device_remove_file(&interface->dev, &dev_attr_output2);
  438. device_remove_file(&interface->dev, &dev_attr_output3);
  439. device_remove_file(&interface->dev, &dev_attr_output4);
  440. }
  441. if (kit->ifkit->outputs == 8) {
  442. device_remove_file(&interface->dev, &dev_attr_output5);
  443. device_remove_file(&interface->dev, &dev_attr_output6);
  444. device_remove_file(&interface->dev, &dev_attr_output7);
  445. device_remove_file(&interface->dev, &dev_attr_output8);
  446. }
  447. if (kit->ifkit->inputs >= 4) {
  448. device_remove_file(&interface->dev, &dev_attr_input1);
  449. device_remove_file(&interface->dev, &dev_attr_input2);
  450. device_remove_file(&interface->dev, &dev_attr_input3);
  451. device_remove_file(&interface->dev, &dev_attr_input4);
  452. }
  453. if (kit->ifkit->inputs == 8) {
  454. device_remove_file(&interface->dev, &dev_attr_input5);
  455. device_remove_file(&interface->dev, &dev_attr_input6);
  456. device_remove_file(&interface->dev, &dev_attr_input7);
  457. device_remove_file(&interface->dev, &dev_attr_input8);
  458. }
  459. if (kit->ifkit->sensors >= 4) {
  460. device_remove_file(&interface->dev, &dev_attr_sensor1);
  461. device_remove_file(&interface->dev, &dev_attr_sensor2);
  462. device_remove_file(&interface->dev, &dev_attr_sensor3);
  463. device_remove_file(&interface->dev, &dev_attr_sensor4);
  464. }
  465. if (kit->ifkit->sensors >= 7) {
  466. device_remove_file(&interface->dev, &dev_attr_sensor5);
  467. device_remove_file(&interface->dev, &dev_attr_sensor6);
  468. device_remove_file(&interface->dev, &dev_attr_sensor7);
  469. }
  470. if (kit->ifkit->sensors == 8) {
  471. device_remove_file(&interface->dev, &dev_attr_sensor8);
  472. }
  473. if (kit->ifkit->has_lcd)
  474. device_remove_file(&interface->dev, &dev_attr_lcd);
  475. dev_info(&interface->dev, "USB PhidgetInterfaceKit %d/%d/%d detached\n",
  476. kit->ifkit->sensors, kit->ifkit->inputs, kit->ifkit->outputs);
  477. usb_kill_urb(kit->irq);
  478. usb_free_urb(kit->irq);
  479. usb_buffer_free(kit->udev, 8, kit->data, kit->data_dma);
  480. usb_put_dev(kit->udev);
  481. kfree(kit);
  482. }
  483. static struct usb_driver interfacekit_driver = {
  484. .owner = THIS_MODULE,
  485. .name = "phidgetkit",
  486. .probe = interfacekit_probe,
  487. .disconnect = interfacekit_disconnect,
  488. .id_table = id_table
  489. };
  490. static int __init interfacekit_init(void)
  491. {
  492. int retval = 0;
  493. retval = usb_register(&interfacekit_driver);
  494. if (retval)
  495. err("usb_register failed. Error number %d", retval);
  496. return retval;
  497. }
  498. static void __exit interfacekit_exit(void)
  499. {
  500. usb_deregister(&interfacekit_driver);
  501. }
  502. module_init(interfacekit_init);
  503. module_exit(interfacekit_exit);
  504. MODULE_AUTHOR(DRIVER_AUTHOR);
  505. MODULE_DESCRIPTION(DRIVER_DESC);
  506. MODULE_LICENSE("GPL");