blob: 12e75bdb049784141162a9c60ea97f83b4e471f0 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef __UHID_H_
8#define __UHID_H_
9#include <linux/input.h>
10#include <linux/types.h>
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070011#include <linux/hid.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070012enum uhid_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080013 __UHID_LEGACY_CREATE,
14 UHID_DESTROY,
Tao Baod7db5942015-01-28 10:07:51 -080015 UHID_START,
16 UHID_STOP,
17 UHID_OPEN,
18 UHID_CLOSE,
Tao Baod7db5942015-01-28 10:07:51 -080019 UHID_OUTPUT,
20 __UHID_LEGACY_OUTPUT_EV,
21 __UHID_LEGACY_INPUT,
22 UHID_GET_REPORT,
Tao Baod7db5942015-01-28 10:07:51 -080023 UHID_GET_REPORT_REPLY,
24 UHID_CREATE2,
25 UHID_INPUT2,
26 UHID_SET_REPORT,
Tao Baod7db5942015-01-28 10:07:51 -080027 UHID_SET_REPORT_REPLY,
Ben Cheng655a7c02013-10-16 16:09:24 -070028};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070029struct uhid_create2_req {
Tao Baod7db5942015-01-28 10:07:51 -080030 __u8 name[128];
Tao Baod7db5942015-01-28 10:07:51 -080031 __u8 phys[64];
32 __u8 uniq[64];
33 __u16 rd_size;
34 __u16 bus;
Tao Baod7db5942015-01-28 10:07:51 -080035 __u32 vendor;
36 __u32 product;
37 __u32 version;
38 __u32 country;
Tao Baod7db5942015-01-28 10:07:51 -080039 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
Christopher Ferris82d75042015-01-26 10:57:07 -080040} __attribute__((__packed__));
41enum uhid_dev_flag {
Tao Baod7db5942015-01-28 10:07:51 -080042 UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0),
Tao Baod7db5942015-01-28 10:07:51 -080043 UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1),
44 UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2),
Christopher Ferris82d75042015-01-26 10:57:07 -080045};
46struct uhid_start_req {
Tao Baod7db5942015-01-28 10:07:51 -080047 __u64 dev_flags;
Christopher Ferris82d75042015-01-26 10:57:07 -080048};
49#define UHID_DATA_MAX 4096
50enum uhid_report_type {
Tao Baod7db5942015-01-28 10:07:51 -080051 UHID_FEATURE_REPORT,
52 UHID_OUTPUT_REPORT,
53 UHID_INPUT_REPORT,
Christopher Ferris82d75042015-01-26 10:57:07 -080054};
Christopher Ferris82d75042015-01-26 10:57:07 -080055struct uhid_input2_req {
Tao Baod7db5942015-01-28 10:07:51 -080056 __u16 size;
57 __u8 data[UHID_DATA_MAX];
Christopher Ferris82d75042015-01-26 10:57:07 -080058} __attribute__((__packed__));
Christopher Ferris82d75042015-01-26 10:57:07 -080059struct uhid_output_req {
Tao Baod7db5942015-01-28 10:07:51 -080060 __u8 data[UHID_DATA_MAX];
61 __u16 size;
62 __u8 rtype;
Christopher Ferris82d75042015-01-26 10:57:07 -080063} __attribute__((__packed__));
64struct uhid_get_report_req {
Tao Baod7db5942015-01-28 10:07:51 -080065 __u32 id;
66 __u8 rnum;
Tao Baod7db5942015-01-28 10:07:51 -080067 __u8 rtype;
Christopher Ferris82d75042015-01-26 10:57:07 -080068} __attribute__((__packed__));
69struct uhid_get_report_reply_req {
Tao Baod7db5942015-01-28 10:07:51 -080070 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080071 __u16 err;
72 __u16 size;
73 __u8 data[UHID_DATA_MAX];
Christopher Ferris82d75042015-01-26 10:57:07 -080074} __attribute__((__packed__));
Christopher Ferris82d75042015-01-26 10:57:07 -080075struct uhid_set_report_req {
Tao Baod7db5942015-01-28 10:07:51 -080076 __u32 id;
77 __u8 rnum;
78 __u8 rtype;
Tao Baod7db5942015-01-28 10:07:51 -080079 __u16 size;
80 __u8 data[UHID_DATA_MAX];
Christopher Ferris82d75042015-01-26 10:57:07 -080081} __attribute__((__packed__));
82struct uhid_set_report_reply_req {
Tao Baod7db5942015-01-28 10:07:51 -080083 __u32 id;
84 __u16 err;
Christopher Ferris82d75042015-01-26 10:57:07 -080085} __attribute__((__packed__));
86enum uhid_legacy_event_type {
Tao Baod7db5942015-01-28 10:07:51 -080087 UHID_CREATE = __UHID_LEGACY_CREATE,
88 UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV,
89 UHID_INPUT = __UHID_LEGACY_INPUT,
90 UHID_FEATURE = UHID_GET_REPORT,
Tao Baod7db5942015-01-28 10:07:51 -080091 UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY,
Christopher Ferris82d75042015-01-26 10:57:07 -080092};
93struct uhid_create_req {
Tao Baod7db5942015-01-28 10:07:51 -080094 __u8 name[128];
Tao Baod7db5942015-01-28 10:07:51 -080095 __u8 phys[64];
96 __u8 uniq[64];
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070097 __u8 * rd_data;
Tao Baod7db5942015-01-28 10:07:51 -080098 __u16 rd_size;
Tao Baod7db5942015-01-28 10:07:51 -080099 __u16 bus;
100 __u32 vendor;
101 __u32 product;
102 __u32 version;
Tao Baod7db5942015-01-28 10:07:51 -0800103 __u32 country;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700104} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700105struct uhid_input_req {
Tao Baod7db5942015-01-28 10:07:51 -0800106 __u8 data[UHID_DATA_MAX];
Tao Baod7db5942015-01-28 10:07:51 -0800107 __u16 size;
Ben Cheng655a7c02013-10-16 16:09:24 -0700108} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700109struct uhid_output_ev_req {
Tao Baod7db5942015-01-28 10:07:51 -0800110 __u16 type;
Tao Baod7db5942015-01-28 10:07:51 -0800111 __u16 code;
112 __s32 value;
Ben Cheng655a7c02013-10-16 16:09:24 -0700113} __attribute__((__packed__));
114struct uhid_feature_req {
Tao Baod7db5942015-01-28 10:07:51 -0800115 __u32 id;
116 __u8 rnum;
117 __u8 rtype;
Ben Cheng655a7c02013-10-16 16:09:24 -0700118} __attribute__((__packed__));
119struct uhid_feature_answer_req {
Tao Baod7db5942015-01-28 10:07:51 -0800120 __u32 id;
121 __u16 err;
122 __u16 size;
Tao Baod7db5942015-01-28 10:07:51 -0800123 __u8 data[UHID_DATA_MAX];
Ben Cheng655a7c02013-10-16 16:09:24 -0700124} __attribute__((__packed__));
Ben Cheng655a7c02013-10-16 16:09:24 -0700125struct uhid_event {
Tao Baod7db5942015-01-28 10:07:51 -0800126 __u32 type;
Tao Baod7db5942015-01-28 10:07:51 -0800127 union {
128 struct uhid_create_req create;
129 struct uhid_input_req input;
130 struct uhid_output_req output;
Tao Baod7db5942015-01-28 10:07:51 -0800131 struct uhid_output_ev_req output_ev;
132 struct uhid_feature_req feature;
133 struct uhid_get_report_req get_report;
134 struct uhid_feature_answer_req feature_answer;
Tao Baod7db5942015-01-28 10:07:51 -0800135 struct uhid_get_report_reply_req get_report_reply;
136 struct uhid_create2_req create2;
137 struct uhid_input2_req input2;
138 struct uhid_set_report_req set_report;
Tao Baod7db5942015-01-28 10:07:51 -0800139 struct uhid_set_report_reply_req set_report_reply;
140 struct uhid_start_req start;
141 } u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700142} __attribute__((__packed__));
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700143#endif