funsoft.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Funsoft Serial USB driver
  3. *
  4. * Copyright (C) 2006 Greg Kroah-Hartman <gregkh@suse.de>
  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. #include <linux/uaccess.h>
  17. static int debug;
  18. static const struct usb_device_id id_table[] = {
  19. { USB_DEVICE(0x1404, 0xcddc) },
  20. { },
  21. };
  22. MODULE_DEVICE_TABLE(usb, id_table);
  23. static struct usb_driver funsoft_driver = {
  24. .name = "funsoft",
  25. .probe = usb_serial_probe,
  26. .disconnect = usb_serial_disconnect,
  27. .id_table = id_table,
  28. .no_dynamic_id = 1,
  29. };
  30. static struct usb_serial_driver funsoft_device = {
  31. .driver = {
  32. .owner = THIS_MODULE,
  33. .name = "funsoft",
  34. },
  35. .id_table = id_table,
  36. .usb_driver = &funsoft_driver,
  37. .num_ports = 1,
  38. };
  39. static int __init funsoft_init(void)
  40. {
  41. int retval;
  42. retval = usb_serial_register(&funsoft_device);
  43. if (retval)
  44. return retval;
  45. retval = usb_register(&funsoft_driver);
  46. if (retval)
  47. usb_serial_deregister(&funsoft_device);
  48. return retval;
  49. }
  50. static void __exit funsoft_exit(void)
  51. {
  52. usb_deregister(&funsoft_driver);
  53. usb_serial_deregister(&funsoft_device);
  54. }
  55. module_init(funsoft_init);
  56. module_exit(funsoft_exit);
  57. MODULE_LICENSE("GPL");
  58. module_param(debug, bool, S_IRUGO | S_IWUSR);
  59. MODULE_PARM_DESC(debug, "Debug enabled or not");