12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include <linux/kernel.h>
- #include <linux/platform_device.h>
- #include <linux/leds.h>
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/hid.h>
- #include <linux/hidraw.h>
- #define USB_VENDOR_ID_MICROCHIP 0x04d8
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("encrypt");
- MODULE_DESCRIPTION("Dummy led");
- static int usbio_probe(struct hid_device *hdev, const struct hid_device_id *id)
- {
- u8 buf[5] = {0x80, 0x80 };
- hid_hw_start(hdev, HID_CONNECT_HIDRAW);
- hid_hw_raw_request(hdev, buf[0], buf, 2, HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
- return 0;
- }
- static void usbio_remove(struct hid_device *hdev)
- {
- hid_hw_stop(hdev);
- }
- static const struct hid_device_id usbio_table[] = {
- { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, 0x0003) },
- {}
- };
- MODULE_DEVICE_TABLE(hid, usbio_table);
- static struct hid_driver usbio_driver = {
- .name = "usbio",
- .probe = usbio_probe,
- .remove = usbio_remove,
- .id_table = usbio_table
- };
- module_hid_driver(usbio_driver);
|