Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[linux-2.6-block.git] / include / uapi / linux / uhid.h
CommitLineData
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>
4522643a 24#include <linux/hid.h>
ace3d861
DH
25
26enum uhid_event_type {
d365c6cf
DH
27 UHID_CREATE,
28 UHID_DESTROY,
ec4b7dea
DH
29 UHID_START,
30 UHID_STOP,
e7191474
DH
31 UHID_OPEN,
32 UHID_CLOSE,
3b3baa82 33 UHID_OUTPUT,
bdb829e1 34 UHID_OUTPUT_EV, /* obsolete! */
5e87a36a 35 UHID_INPUT,
fcfcf0de
DH
36 UHID_FEATURE,
37 UHID_FEATURE_ANSWER,
4522643a
PG
38 UHID_CREATE2,
39 UHID_INPUT2,
ace3d861
DH
40};
41
d365c6cf
DH
42struct uhid_create_req {
43 __u8 name[128];
44 __u8 phys[64];
45 __u8 uniq[64];
46 __u8 __user *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
4522643a
PG
56struct 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
5e87a36a
DH
69#define UHID_DATA_MAX 4096
70
3b3baa82
DH
71enum uhid_report_type {
72 UHID_FEATURE_REPORT,
73 UHID_OUTPUT_REPORT,
74 UHID_INPUT_REPORT,
75};
76
5e87a36a
DH
77struct uhid_input_req {
78 __u8 data[UHID_DATA_MAX];
79 __u16 size;
80} __attribute__((__packed__));
81
4522643a
PG
82struct uhid_input2_req {
83 __u16 size;
84 __u8 data[UHID_DATA_MAX];
85} __attribute__((__packed__));
86
3b3baa82
DH
87struct uhid_output_req {
88 __u8 data[UHID_DATA_MAX];
89 __u16 size;
90 __u8 rtype;
91} __attribute__((__packed__));
92
bdb829e1
DH
93/* Obsolete! Newer kernels will no longer send these events but instead convert
94 * it into raw output reports via UHID_OUTPUT. */
f80e1360
DH
95struct uhid_output_ev_req {
96 __u16 type;
97 __u16 code;
98 __s32 value;
99} __attribute__((__packed__));
100
fcfcf0de
DH
101struct uhid_feature_req {
102 __u32 id;
103 __u8 rnum;
104 __u8 rtype;
105} __attribute__((__packed__));
106
107struct uhid_feature_answer_req {
108 __u32 id;
109 __u16 err;
110 __u16 size;
111 __u8 data[UHID_DATA_MAX];
fee5dfec 112} __attribute__((__packed__));
fcfcf0de 113
ace3d861
DH
114struct uhid_event {
115 __u32 type;
d365c6cf
DH
116
117 union {
118 struct uhid_create_req create;
5e87a36a 119 struct uhid_input_req input;
3b3baa82 120 struct uhid_output_req output;
f80e1360 121 struct uhid_output_ev_req output_ev;
fcfcf0de
DH
122 struct uhid_feature_req feature;
123 struct uhid_feature_answer_req feature_answer;
4522643a
PG
124 struct uhid_create2_req create2;
125 struct uhid_input2_req input2;
d365c6cf 126 } u;
ace3d861
DH
127} __attribute__((__packed__));
128
129#endif /* __UHID_H_ */