]>
Commit | Line | Data |
---|---|---|
ace3d861 DH |
1 | #ifndef __UHID_H_ |
2 | #define __UHID_H_ | |
3 | ||
4 | /* | |
5 | * User-space I/O driver support for HID subsystem | |
6 | * Copyright (c) 2012 David Herrmann | |
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 | /* | |
17 | * Public header for user-space communication. We try to keep every structure | |
18 | * aligned but to be safe we also use __attribute__((__packed__)). Therefore, | |
19 | * the communication should be ABI compatible even between architectures. | |
20 | */ | |
21 | ||
22 | #include <linux/input.h> | |
23 | #include <linux/types.h> | |
24 | ||
25 | enum uhid_event_type { | |
d365c6cf DH |
26 | UHID_CREATE, |
27 | UHID_DESTROY, | |
ec4b7dea DH |
28 | UHID_START, |
29 | UHID_STOP, | |
e7191474 DH |
30 | UHID_OPEN, |
31 | UHID_CLOSE, | |
3b3baa82 | 32 | UHID_OUTPUT, |
f80e1360 | 33 | UHID_OUTPUT_EV, |
5e87a36a | 34 | UHID_INPUT, |
fcfcf0de DH |
35 | UHID_FEATURE, |
36 | UHID_FEATURE_ANSWER, | |
ace3d861 DH |
37 | }; |
38 | ||
d365c6cf DH |
39 | struct uhid_create_req { |
40 | __u8 name[128]; | |
41 | __u8 phys[64]; | |
42 | __u8 uniq[64]; | |
43 | __u8 __user *rd_data; | |
44 | __u16 rd_size; | |
45 | ||
46 | __u16 bus; | |
47 | __u32 vendor; | |
48 | __u32 product; | |
49 | __u32 version; | |
50 | __u32 country; | |
51 | } __attribute__((__packed__)); | |
52 | ||
5e87a36a DH |
53 | #define UHID_DATA_MAX 4096 |
54 | ||
3b3baa82 DH |
55 | enum uhid_report_type { |
56 | UHID_FEATURE_REPORT, | |
57 | UHID_OUTPUT_REPORT, | |
58 | UHID_INPUT_REPORT, | |
59 | }; | |
60 | ||
5e87a36a DH |
61 | struct uhid_input_req { |
62 | __u8 data[UHID_DATA_MAX]; | |
63 | __u16 size; | |
64 | } __attribute__((__packed__)); | |
65 | ||
3b3baa82 DH |
66 | struct uhid_output_req { |
67 | __u8 data[UHID_DATA_MAX]; | |
68 | __u16 size; | |
69 | __u8 rtype; | |
70 | } __attribute__((__packed__)); | |
71 | ||
f80e1360 DH |
72 | struct uhid_output_ev_req { |
73 | __u16 type; | |
74 | __u16 code; | |
75 | __s32 value; | |
76 | } __attribute__((__packed__)); | |
77 | ||
fcfcf0de DH |
78 | struct uhid_feature_req { |
79 | __u32 id; | |
80 | __u8 rnum; | |
81 | __u8 rtype; | |
82 | } __attribute__((__packed__)); | |
83 | ||
84 | struct uhid_feature_answer_req { | |
85 | __u32 id; | |
86 | __u16 err; | |
87 | __u16 size; | |
88 | __u8 data[UHID_DATA_MAX]; | |
89 | }; | |
90 | ||
ace3d861 DH |
91 | struct uhid_event { |
92 | __u32 type; | |
d365c6cf DH |
93 | |
94 | union { | |
95 | struct uhid_create_req create; | |
5e87a36a | 96 | struct uhid_input_req input; |
3b3baa82 | 97 | struct uhid_output_req output; |
f80e1360 | 98 | struct uhid_output_ev_req output_ev; |
fcfcf0de DH |
99 | struct uhid_feature_req feature; |
100 | struct uhid_feature_answer_req feature_answer; | |
d365c6cf | 101 | } u; |
ace3d861 DH |
102 | } __attribute__((__packed__)); |
103 | ||
104 | #endif /* __UHID_H_ */ |