Mauro Carvalho Chehab | a48c65b | 2008-10-14 22:41:43 +0200 | [diff] [blame] | 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 | /* |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the Free |
| 12 | * Software Foundation; either version 2 of the License, or (at your option) |
| 13 | * any later version. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/device.h> |
| 17 | #include <linux/hid.h> |
| 18 | #include <linux/module.h> |
| 19 | |
| 20 | #include "hid-ids.h" |
| 21 | |
| 22 | static int bright_probe(struct hid_device *hdev, const struct hid_device_id *id) |
| 23 | { |
| 24 | int ret; |
| 25 | |
| 26 | ret = hid_parse(hdev); |
| 27 | if (ret) { |
| 28 | dev_err(&hdev->dev, "parse failed\n"); |
| 29 | goto err_free; |
| 30 | } |
| 31 | |
| 32 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
| 33 | if (ret) { |
| 34 | dev_err(&hdev->dev, "hw start failed\n"); |
| 35 | goto err_free; |
| 36 | } |
| 37 | |
| 38 | usbhid_set_leds(hdev); |
| 39 | |
| 40 | return 0; |
| 41 | err_free: |
| 42 | return ret; |
| 43 | } |
| 44 | |
| 45 | static const struct hid_device_id bright_devices[] = { |
| 46 | { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) }, |
| 47 | { } |
| 48 | }; |
| 49 | MODULE_DEVICE_TABLE(hid, bright_devices); |
| 50 | |
| 51 | static struct hid_driver bright_driver = { |
| 52 | .name = "bright", |
| 53 | .id_table = bright_devices, |
| 54 | .probe = bright_probe, |
| 55 | }; |
| 56 | |
| 57 | static int bright_init(void) |
| 58 | { |
| 59 | return hid_register_driver(&bright_driver); |
| 60 | } |
| 61 | |
| 62 | static void bright_exit(void) |
| 63 | { |
| 64 | hid_unregister_driver(&bright_driver); |
| 65 | } |
| 66 | |
| 67 | module_init(bright_init); |
| 68 | module_exit(bright_exit); |
| 69 | MODULE_LICENSE("GPL"); |
| 70 | |
| 71 | HID_COMPAT_LOAD_DRIVER(bright); |