1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <linux/device.h>
20#include <linux/hid.h>
21#include <linux/module.h>
22
23#include "hid-ids.h"
24
25static int px_raw_event(struct hid_device *hid, struct hid_report *report,
26 u8 *data, int size)
27{
28 int idx = size;
29
30 switch (report->id) {
31 case 0:
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 while (--idx > 1) {
50 if (data[idx] < 0xE0 || data[idx] > 0xE7)
51 continue;
52 data[0] |= (1 << (data[idx] - 0xE0));
53 data[idx] = 0;
54 }
55 hid_report_raw_event(hid, HID_INPUT_REPORT, data, size, 0);
56 return 1;
57
58 default:
59
60 hid_info(hid, "unknown report type %d\n", report->id);
61 break;
62 }
63
64 return 0;
65}
66
67static const struct hid_device_id px_devices[] = {
68 { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
69 { }
70};
71MODULE_DEVICE_TABLE(hid, px_devices);
72
73static struct hid_driver px_driver = {
74 .name = "primax",
75 .id_table = px_devices,
76 .raw_event = px_raw_event,
77};
78
79static int __init px_init(void)
80{
81 return hid_register_driver(&px_driver);
82}
83
84static void __exit px_exit(void)
85{
86 hid_unregister_driver(&px_driver);
87}
88
89module_init(px_init);
90module_exit(px_exit);
91MODULE_AUTHOR("Terry Lambert <tlambert@google.com>");
92MODULE_LICENSE("GPL");
93