hid-bright.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * HID driver for some bright "special" devices
  3. *
  4. * Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@redhat.com>
  5. *
  6. * Based on hid-dell driver
  7. */
  8. /*
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the Free
  11. * Software Foundation; either version 2 of the License, or (at your option)
  12. * any later version.
  13. */
  14. #include <linux/device.h>
  15. #include <linux/hid.h>
  16. #include <linux/module.h>
  17. #include "hid-ids.h"
  18. static int bright_probe(struct hid_device *hdev, const struct hid_device_id *id)
  19. {
  20. int ret;
  21. ret = hid_parse(hdev);
  22. if (ret) {
  23. dev_err(&hdev->dev, "parse failed\n");
  24. goto err_free;
  25. }
  26. ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
  27. if (ret) {
  28. dev_err(&hdev->dev, "hw start failed\n");
  29. goto err_free;
  30. }
  31. usbhid_set_leds(hdev);
  32. return 0;
  33. err_free:
  34. return ret;
  35. }
  36. static const struct hid_device_id bright_devices[] = {
  37. { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
  38. { }
  39. };
  40. MODULE_DEVICE_TABLE(hid, bright_devices);
  41. static struct hid_driver bright_driver = {
  42. .name = "bright",
  43. .id_table = bright_devices,
  44. .probe = bright_probe,
  45. };
  46. static int bright_init(void)
  47. {
  48. return hid_register_driver(&bright_driver);
  49. }
  50. static void bright_exit(void)
  51. {
  52. hid_unregister_driver(&bright_driver);
  53. }
  54. module_init(bright_init);
  55. module_exit(bright_exit);
  56. MODULE_LICENSE("GPL");
  57. HID_COMPAT_LOAD_DRIVER(bright);