0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <linux/module.h>
0017 #include <linux/slab.h>
0018 #include <linux/kernel.h>
0019 #include <asm/unaligned.h>
0020 #include <asm/byteorder.h>
0021
0022 #include <linux/hid.h>
0023
0024 static struct hid_driver hid_generic;
0025
0026 static int __check_hid_generic(struct device_driver *drv, void *data)
0027 {
0028 struct hid_driver *hdrv = to_hid_driver(drv);
0029 struct hid_device *hdev = data;
0030
0031 if (hdrv == &hid_generic)
0032 return 0;
0033
0034 return hid_match_device(hdev, hdrv) != NULL;
0035 }
0036
0037 static bool hid_generic_match(struct hid_device *hdev,
0038 bool ignore_special_driver)
0039 {
0040 if (ignore_special_driver)
0041 return true;
0042
0043 if (hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)
0044 return false;
0045
0046
0047
0048
0049
0050 if (bus_for_each_drv(&hid_bus_type, NULL, hdev, __check_hid_generic))
0051 return false;
0052
0053 return true;
0054 }
0055
0056 static int hid_generic_probe(struct hid_device *hdev,
0057 const struct hid_device_id *id)
0058 {
0059 int ret;
0060
0061 hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
0062
0063 ret = hid_parse(hdev);
0064 if (ret)
0065 return ret;
0066
0067 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
0068 }
0069
0070 static const struct hid_device_id hid_table[] = {
0071 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, HID_ANY_ID, HID_ANY_ID) },
0072 { }
0073 };
0074 MODULE_DEVICE_TABLE(hid, hid_table);
0075
0076 static struct hid_driver hid_generic = {
0077 .name = "hid-generic",
0078 .id_table = hid_table,
0079 .match = hid_generic_match,
0080 .probe = hid_generic_probe,
0081 };
0082 module_hid_driver(hid_generic);
0083
0084 MODULE_AUTHOR("Henrik Rydberg");
0085 MODULE_DESCRIPTION("HID generic driver");
0086 MODULE_LICENSE("GPL");