hp4x.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * HP4x Calculators Serial USB driver
  3. *
  4. * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net)
  5. * Copyright (C) 2001-2005 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. * See Documentation/usb/usb-serial.txt for more information on using this driver
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/tty.h>
  17. #include <linux/module.h>
  18. #include <linux/usb.h>
  19. #include <linux/usb/serial.h>
  20. /*
  21. * Version Information
  22. */
  23. #define DRIVER_VERSION "v1.00"
  24. #define DRIVER_DESC "HP4x (48/49) Generic Serial driver"
  25. #define HP_VENDOR_ID 0x03f0
  26. #define HP49GP_PRODUCT_ID 0x0121
  27. static struct usb_device_id id_table [] = {
  28. { USB_DEVICE(HP_VENDOR_ID, HP49GP_PRODUCT_ID) },
  29. { } /* Terminating entry */
  30. };
  31. MODULE_DEVICE_TABLE(usb, id_table);
  32. static struct usb_driver hp49gp_driver = {
  33. .name = "hp4X",
  34. .probe = usb_serial_probe,
  35. .disconnect = usb_serial_disconnect,
  36. .id_table = id_table,
  37. .no_dynamic_id = 1,
  38. };
  39. static struct usb_serial_driver hp49gp_device = {
  40. .driver = {
  41. .owner = THIS_MODULE,
  42. .name = "hp4X",
  43. },
  44. .id_table = id_table,
  45. .num_interrupt_in = NUM_DONT_CARE,
  46. .num_bulk_in = NUM_DONT_CARE,
  47. .num_bulk_out = NUM_DONT_CARE,
  48. .num_ports = 1,
  49. };
  50. static int __init hp49gp_init(void)
  51. {
  52. int retval;
  53. retval = usb_serial_register(&hp49gp_device);
  54. if (retval)
  55. goto failed_usb_serial_register;
  56. retval = usb_register(&hp49gp_driver);
  57. if (retval)
  58. goto failed_usb_register;
  59. info(DRIVER_DESC " " DRIVER_VERSION);
  60. return 0;
  61. failed_usb_register:
  62. usb_serial_deregister(&hp49gp_device);
  63. failed_usb_serial_register:
  64. return retval;
  65. }
  66. static void __exit hp49gp_exit(void)
  67. {
  68. usb_deregister(&hp49gp_driver);
  69. usb_serial_deregister(&hp49gp_device);
  70. }
  71. module_init(hp49gp_init);
  72. module_exit(hp49gp_exit);
  73. MODULE_DESCRIPTION(DRIVER_DESC);
  74. MODULE_VERSION(DRIVER_VERSION);
  75. MODULE_LICENSE("GPL");