usb_debug.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * USB Debug cable driver
  3. *
  4. * Copyright (C) 2006 Greg Kroah-Hartman <greg@kroah.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License version
  8. * 2 as published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/tty.h>
  13. #include <linux/module.h>
  14. #include <linux/usb.h>
  15. #include <linux/usb/serial.h>
  16. static struct usb_device_id id_table [] = {
  17. { USB_DEVICE(0x0525, 0x127a) },
  18. { },
  19. };
  20. MODULE_DEVICE_TABLE(usb, id_table);
  21. static struct usb_driver debug_driver = {
  22. .name = "debug",
  23. .probe = usb_serial_probe,
  24. .disconnect = usb_serial_disconnect,
  25. .id_table = id_table,
  26. .no_dynamic_id = 1,
  27. };
  28. static struct usb_serial_driver debug_device = {
  29. .driver = {
  30. .owner = THIS_MODULE,
  31. .name = "debug",
  32. },
  33. .id_table = id_table,
  34. .num_ports = 1,
  35. };
  36. static int __init debug_init(void)
  37. {
  38. int retval;
  39. retval = usb_serial_register(&debug_device);
  40. if (retval)
  41. return retval;
  42. retval = usb_register(&debug_driver);
  43. if (retval)
  44. usb_serial_deregister(&debug_device);
  45. return retval;
  46. }
  47. static void __exit debug_exit(void)
  48. {
  49. usb_deregister(&debug_driver);
  50. usb_serial_deregister(&debug_device);
  51. }
  52. module_init(debug_init);
  53. module_exit(debug_exit);
  54. MODULE_LICENSE("GPL");