0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/device.h>
0012 #include <linux/hid.h>
0013 #include <linux/module.h>
0014
0015 #include "hid-ids.h"
0016
0017 static int px_raw_event(struct hid_device *hid, struct hid_report *report,
0018 u8 *data, int size)
0019 {
0020 int idx = size;
0021
0022 switch (report->id) {
0023 case 0:
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 while (--idx > 1) {
0042 if (data[idx] < 0xE0 || data[idx] > 0xE7)
0043 continue;
0044 data[0] |= (1 << (data[idx] - 0xE0));
0045 data[idx] = 0;
0046 }
0047 hid_report_raw_event(hid, HID_INPUT_REPORT, data, size, 0);
0048 return 1;
0049
0050 default:
0051
0052 hid_info(hid, "unknown report type %d\n", report->id);
0053 break;
0054 }
0055
0056 return 0;
0057 }
0058
0059 static const struct hid_device_id px_devices[] = {
0060 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
0061 { }
0062 };
0063 MODULE_DEVICE_TABLE(hid, px_devices);
0064
0065 static struct hid_driver px_driver = {
0066 .name = "primax",
0067 .id_table = px_devices,
0068 .raw_event = px_raw_event,
0069 };
0070 module_hid_driver(px_driver);
0071
0072 MODULE_AUTHOR("Terry Lambert <tlambert@google.com>");
0073 MODULE_LICENSE("GPL");