blob: 228ee5039821d21b3dff249512b6135b00c158fe [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef __UHID_H_
20#define __UHID_H_
21#include <linux/input.h>
22#include <linux/types.h>
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070023#include <linux/hid.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070024enum uhid_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080025 __UHID_LEGACY_CREATE,
26 UHID_DESTROY,
Tao Baod7db5942015-01-28 10:07:51 -080027 UHID_START,
28 UHID_STOP,
29 UHID_OPEN,
30 UHID_CLOSE,
Tao Baod7db5942015-01-28 10:07:51 -080031 UHID_OUTPUT,
32 __UHID_LEGACY_OUTPUT_EV,
33 __UHID_LEGACY_INPUT,
34 UHID_GET_REPORT,
Tao Baod7db5942015-01-28 10:07:51 -080035 UHID_GET_REPORT_REPLY,
36 UHID_CREATE2,
37 UHID_INPUT2,
38 UHID_SET_REPORT,
Tao Baod7db5942015-01-28 10:07:51 -080039 UHID_SET_REPORT_REPLY,
Ben Cheng655a7c02013-10-16 16:09:24 -070040};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070041struct uhid_create2_req {
Tao Baod7db5942015-01-28 10:07:51 -080042 __u8 name[128];
Tao Baod7db5942015-01-28 10:07:51 -080043 __u8 phys[64];
44 __u8 uniq[64];
45 __u16 rd_size;
46 __u16 bus;
Tao Baod7db5942015-01-28 10:07:51 -080047 __u32 vendor;
48 __u32 product;
49 __u32 version;
50 __u32 country;
Tao Baod7db5942015-01-28 10:07:51 -080051 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
Christopher Ferris82d75042015-01-26 10:57:07 -080052} __attribute__((__packed__));
53enum uhid_dev_flag {
Tao Baod7db5942015-01-28 10:07:51 -080054 UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0),
Tao Baod7db5942015-01-28 10:07:51 -080055 UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1),
56 UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2),
Christopher Ferris82d75042015-01-26 10:57:07 -080057};
58struct uhid_start_req {
Tao Baod7db5942015-01-28 10:07:51 -080059 __u64 dev_flags;
Christopher Ferris82d75042015-01-26 10:57:07 -080060};
61#define UHID_DATA_MAX 4096
62enum uhid_report_type {
Tao Baod7db5942015-01-28 10:07:51 -080063 UHID_FEATURE_REPORT,
64 UHID_OUTPUT_REPORT,
65 UHID_INPUT_REPORT,
Christopher Ferris82d75042015-01-26 10:57:07 -080066};
Christopher Ferris82d75042015-01-26 10:57:07 -080067struct uhid_input2_req {
Tao Baod7db5942015-01-28 10:07:51 -080068 __u16 size;
69 __u8 data[UHID_DATA_MAX];
Christopher Ferris82d75042015-01-26 10:57:07 -080070} __attribute__((__packed__));
Christopher Ferris82d75042015-01-26 10:57:07 -080071struct uhid_output_req {
Tao Baod7db5942015-01-28 10:07:51 -080072 __u8 data[UHID_DATA_MAX];
73 __u16 size;
74 __u8 rtype;
Christopher Ferris82d75042015-01-26 10:57:07 -080075} __attribute__((__packed__));
76struct uhid_get_report_req {
Tao Baod7db5942015-01-28 10:07:51 -080077 __u32 id;
78 __u8 rnum;
Tao Baod7db5942015-01-28 10:07:51 -080079 __u8 rtype;
Christopher Ferris82d75042015-01-26 10:57:07 -080080} __attribute__((__packed__));
81struct uhid_get_report_reply_req {
Tao Baod7db5942015-01-28 10:07:51 -080082 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080083 __u16 err;
84 __u16 size;
85 __u8 data[UHID_DATA_MAX];
Christopher Ferris82d75042015-01-26 10:57:07 -080086} __attribute__((__packed__));
Christopher Ferris82d75042015-01-26 10:57:07 -080087struct uhid_set_report_req {
Tao Baod7db5942015-01-28 10:07:51 -080088 __u32 id;
89 __u8 rnum;
90 __u8 rtype;
Tao Baod7db5942015-01-28 10:07:51 -080091 __u16 size;
92 __u8 data[UHID_DATA_MAX];
Christopher Ferris82d75042015-01-26 10:57:07 -080093} __attribute__((__packed__));
94struct uhid_set_report_reply_req {
Tao Baod7db5942015-01-28 10:07:51 -080095 __u32 id;
96 __u16 err;
Christopher Ferris82d75042015-01-26 10:57:07 -080097} __attribute__((__packed__));
98enum uhid_legacy_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080099 UHID_CREATE = __UHID_LEGACY_CREATE,
100 UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV,
101 UHID_INPUT = __UHID_LEGACY_INPUT,
102 UHID_FEATURE = UHID_GET_REPORT,
Tao Baod7db5942015-01-28 10:07:51 -0800103 UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY,
Christopher Ferris82d75042015-01-26 10:57:07 -0800104};
105struct uhid_create_req {
Tao Baod7db5942015-01-28 10:07:51 -0800106 __u8 name[128];
Tao Baod7db5942015-01-28 10:07:51 -0800107 __u8 phys[64];
108 __u8 uniq[64];
109 __u8 __user * rd_data;
110 __u16 rd_size;
Tao Baod7db5942015-01-28 10:07:51 -0800111 __u16 bus;
112 __u32 vendor;
113 __u32 product;
114 __u32 version;
Tao Baod7db5942015-01-28 10:07:51 -0800115 __u32 country;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700116} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700117struct uhid_input_req {
Tao Baod7db5942015-01-28 10:07:51 -0800118 __u8 data[UHID_DATA_MAX];
Tao Baod7db5942015-01-28 10:07:51 -0800119 __u16 size;
Ben Cheng655a7c02013-10-16 16:09:24 -0700120} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700121struct uhid_output_ev_req {
Tao Baod7db5942015-01-28 10:07:51 -0800122 __u16 type;
Tao Baod7db5942015-01-28 10:07:51 -0800123 __u16 code;
124 __s32 value;
Ben Cheng655a7c02013-10-16 16:09:24 -0700125} __attribute__((__packed__));
126struct uhid_feature_req {
Tao Baod7db5942015-01-28 10:07:51 -0800127 __u32 id;
128 __u8 rnum;
129 __u8 rtype;
Ben Cheng655a7c02013-10-16 16:09:24 -0700130} __attribute__((__packed__));
131struct uhid_feature_answer_req {
Tao Baod7db5942015-01-28 10:07:51 -0800132 __u32 id;
133 __u16 err;
134 __u16 size;
Tao Baod7db5942015-01-28 10:07:51 -0800135 __u8 data[UHID_DATA_MAX];
Ben Cheng655a7c02013-10-16 16:09:24 -0700136} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700137struct uhid_event {
Tao Baod7db5942015-01-28 10:07:51 -0800138 __u32 type;
Tao Baod7db5942015-01-28 10:07:51 -0800139 union {
140 struct uhid_create_req create;
141 struct uhid_input_req input;
142 struct uhid_output_req output;
Tao Baod7db5942015-01-28 10:07:51 -0800143 struct uhid_output_ev_req output_ev;
144 struct uhid_feature_req feature;
145 struct uhid_get_report_req get_report;
146 struct uhid_feature_answer_req feature_answer;
Tao Baod7db5942015-01-28 10:07:51 -0800147 struct uhid_get_report_reply_req get_report_reply;
148 struct uhid_create2_req create2;
149 struct uhid_input2_req input2;
150 struct uhid_set_report_req set_report;
Tao Baod7db5942015-01-28 10:07:51 -0800151 struct uhid_set_report_reply_req set_report_reply;
152 struct uhid_start_req start;
153 } u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700154} __attribute__((__packed__));
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700155#endif