]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/linux-26-headers/include/linux/uhid.h
update
[l4.git] / l4 / pkg / linux-26-headers / include / linux / uhid.h
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 #include <linux/hid.h>
25
26 enum uhid_event_type {
27         UHID_CREATE,
28         UHID_DESTROY,
29         UHID_START,
30         UHID_STOP,
31         UHID_OPEN,
32         UHID_CLOSE,
33         UHID_OUTPUT,
34         UHID_OUTPUT_EV,                 /* obsolete! */
35         UHID_INPUT,
36         UHID_FEATURE,
37         UHID_FEATURE_ANSWER,
38         UHID_CREATE2,
39         UHID_INPUT2,
40 };
41
42 struct uhid_create_req {
43         __u8 name[128];
44         __u8 phys[64];
45         __u8 uniq[64];
46         __u8 *rd_data;
47         __u16 rd_size;
48
49         __u16 bus;
50         __u32 vendor;
51         __u32 product;
52         __u32 version;
53         __u32 country;
54 } __attribute__((__packed__));
55
56 struct uhid_create2_req {
57         __u8 name[128];
58         __u8 phys[64];
59         __u8 uniq[64];
60         __u16 rd_size;
61         __u16 bus;
62         __u32 vendor;
63         __u32 product;
64         __u32 version;
65         __u32 country;
66         __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
67 } __attribute__((__packed__));
68
69 #define UHID_DATA_MAX 4096
70
71 enum uhid_report_type {
72         UHID_FEATURE_REPORT,
73         UHID_OUTPUT_REPORT,
74         UHID_INPUT_REPORT,
75 };
76
77 struct uhid_input_req {
78         __u8 data[UHID_DATA_MAX];
79         __u16 size;
80 } __attribute__((__packed__));
81
82 struct uhid_input2_req {
83         __u16 size;
84         __u8 data[UHID_DATA_MAX];
85 } __attribute__((__packed__));
86
87 struct uhid_output_req {
88         __u8 data[UHID_DATA_MAX];
89         __u16 size;
90         __u8 rtype;
91 } __attribute__((__packed__));
92
93 /* Obsolete! Newer kernels will no longer send these events but instead convert
94  * it into raw output reports via UHID_OUTPUT. */
95 struct uhid_output_ev_req {
96         __u16 type;
97         __u16 code;
98         __s32 value;
99 } __attribute__((__packed__));
100
101 struct uhid_feature_req {
102         __u32 id;
103         __u8 rnum;
104         __u8 rtype;
105 } __attribute__((__packed__));
106
107 struct uhid_feature_answer_req {
108         __u32 id;
109         __u16 err;
110         __u16 size;
111         __u8 data[UHID_DATA_MAX];
112 } __attribute__((__packed__));
113
114 struct uhid_event {
115         __u32 type;
116
117         union {
118                 struct uhid_create_req create;
119                 struct uhid_input_req input;
120                 struct uhid_output_req output;
121                 struct uhid_output_ev_req output_ev;
122                 struct uhid_feature_req feature;
123                 struct uhid_feature_answer_req feature_answer;
124                 struct uhid_create2_req create2;
125                 struct uhid_input2_req input2;
126         } u;
127 } __attribute__((__packed__));
128
129 #endif /* __UHID_H_ */