1655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng/****************************************************************************
2655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ****************************************************************************
3655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***
4655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   This header was automatically generated from a Linux kernel header
5655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   of the same name, to make information necessary for userspace to
6655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   call into the kernel available to libc.  It contains only constants,
7655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   structures, and macros generated from the original header, and thus,
8655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   contains no copyrightable information.
9655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***
10655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   To edit the content of this header, modify the corresponding
11655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   source file (e.g. under external/kernel-headers/original/) then
12655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   run bionic/libc/kernel/tools/update_all.py
13655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***
14655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   Any manual change here will be lost the next time this script will
15655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***   be run. You've been warned!
16655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ***
17655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ****************************************************************************
18655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng ****************************************************************************/
19655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#ifndef __UHID_H_
20655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define __UHID_H_
21655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#include <linux/input.h>
22655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#include <linux/types.h>
23ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#include <linux/hid.h>
24655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Chengenum uhid_event_type {
25d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __UHID_LEGACY_CREATE,
26d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_DESTROY,
27d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_START,
28d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_STOP,
29d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_OPEN,
30d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_CLOSE,
31d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_OUTPUT,
32d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __UHID_LEGACY_OUTPUT_EV,
33d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __UHID_LEGACY_INPUT,
34d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_GET_REPORT,
35d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_GET_REPORT_REPLY,
36d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_CREATE2,
37d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_INPUT2,
38d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_SET_REPORT,
39d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_SET_REPORT_REPLY,
4082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
41ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferrisstruct uhid_create2_req {
42d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 name[128];
43d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 phys[64];
44d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 uniq[64];
45d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 rd_size;
46d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 bus;
47d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 vendor;
48d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 product;
49d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 version;
50d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 country;
51d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
52655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
5382d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisenum uhid_dev_flag {
54d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0),
55d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1),
56d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2),
5782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
5882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_start_req {
59d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u64 dev_flags;
6082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
61655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng#define UHID_DATA_MAX 4096
62655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Chengenum uhid_report_type {
63d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_FEATURE_REPORT,
64d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_OUTPUT_REPORT,
65d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_INPUT_REPORT,
66655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng};
6782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_input2_req {
68d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 size;
69d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 data[UHID_DATA_MAX];
7082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __attribute__((__packed__));
7182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_output_req {
72d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 data[UHID_DATA_MAX];
73d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 size;
74d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rtype;
75655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
7682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_get_report_req {
77d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 id;
78d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rnum;
79d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rtype;
8082d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __attribute__((__packed__));
8182d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_get_report_reply_req {
82d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 id;
83d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 err;
84d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 size;
85d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 data[UHID_DATA_MAX];
8682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __attribute__((__packed__));
8782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_set_report_req {
88d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 id;
89d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rnum;
90d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rtype;
91d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 size;
92d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 data[UHID_DATA_MAX];
93ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris} __attribute__((__packed__));
9482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_set_report_reply_req {
95d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 id;
96d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 err;
9782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __attribute__((__packed__));
9882d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisenum uhid_legacy_event_type {
99d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_CREATE = __UHID_LEGACY_CREATE,
100d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV,
101d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_INPUT = __UHID_LEGACY_INPUT,
102d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_FEATURE = UHID_GET_REPORT,
103d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY,
10482d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris};
10582d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_create_req {
106d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 name[128];
107d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 phys[64];
108d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 uniq[64];
109d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 __user * rd_data;
110d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 rd_size;
111d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 bus;
112d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 vendor;
113d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 product;
114d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 version;
115d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 country;
11682d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferris} __attribute__((__packed__));
11782d7504cd7d5c8d2175fb3b1a4ee3518cad6aa0fChristopher Ferrisstruct uhid_input_req {
118d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 data[UHID_DATA_MAX];
119d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 size;
120655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
121655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Chengstruct uhid_output_ev_req {
122d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 type;
123d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 code;
124d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __s32 value;
125655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
126655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Chengstruct uhid_feature_req {
127d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 id;
128d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rnum;
129d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 rtype;
130655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
131655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Chengstruct uhid_feature_answer_req {
132d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 id;
133d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 err;
134d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u16 size;
135d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u8 data[UHID_DATA_MAX];
136655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
137655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Chengstruct uhid_event {
138d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  __u32 type;
139d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  union {
140d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_create_req create;
141d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_input_req input;
142d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_output_req output;
143d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_output_ev_req output_ev;
144d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_feature_req feature;
145d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_get_report_req get_report;
146d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_feature_answer_req feature_answer;
147d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_get_report_reply_req get_report_reply;
148d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_create2_req create2;
149d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_input2_req input2;
150d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_set_report_req set_report;
151d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_set_report_reply_req set_report_reply;
152d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao    struct uhid_start_req start;
153d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  } u;
154655a7c081f83b8351ed5f11a6c6accd9458293a8Ben Cheng} __attribute__((__packed__));
155ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#endif
156