Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 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 Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef __UHID_H_ |
| 8 | #define __UHID_H_ |
| 9 | #include <linux/input.h> |
| 10 | #include <linux/types.h> |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 11 | #include <linux/hid.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 12 | enum uhid_event_type { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 13 | __UHID_LEGACY_CREATE, |
| 14 | UHID_DESTROY, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 15 | UHID_START, |
| 16 | UHID_STOP, |
| 17 | UHID_OPEN, |
| 18 | UHID_CLOSE, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 19 | UHID_OUTPUT, |
| 20 | __UHID_LEGACY_OUTPUT_EV, |
| 21 | __UHID_LEGACY_INPUT, |
| 22 | UHID_GET_REPORT, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | UHID_GET_REPORT_REPLY, |
| 24 | UHID_CREATE2, |
| 25 | UHID_INPUT2, |
| 26 | UHID_SET_REPORT, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 27 | UHID_SET_REPORT_REPLY, |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 28 | }; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 29 | struct uhid_create2_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 30 | __u8 name[128]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 31 | __u8 phys[64]; |
| 32 | __u8 uniq[64]; |
| 33 | __u16 rd_size; |
| 34 | __u16 bus; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 35 | __u32 vendor; |
| 36 | __u32 product; |
| 37 | __u32 version; |
| 38 | __u32 country; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 39 | __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE]; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 40 | } __attribute__((__packed__)); |
| 41 | enum uhid_dev_flag { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 42 | UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0), |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 43 | UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1), |
| 44 | UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2), |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 45 | }; |
| 46 | struct uhid_start_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 47 | __u64 dev_flags; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 48 | }; |
| 49 | #define UHID_DATA_MAX 4096 |
| 50 | enum uhid_report_type { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 51 | UHID_FEATURE_REPORT, |
| 52 | UHID_OUTPUT_REPORT, |
| 53 | UHID_INPUT_REPORT, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 54 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 55 | struct uhid_input2_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 56 | __u16 size; |
| 57 | __u8 data[UHID_DATA_MAX]; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 58 | } __attribute__((__packed__)); |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 59 | struct uhid_output_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 60 | __u8 data[UHID_DATA_MAX]; |
| 61 | __u16 size; |
| 62 | __u8 rtype; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 63 | } __attribute__((__packed__)); |
| 64 | struct uhid_get_report_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 65 | __u32 id; |
| 66 | __u8 rnum; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 67 | __u8 rtype; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 68 | } __attribute__((__packed__)); |
| 69 | struct uhid_get_report_reply_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 70 | __u32 id; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 71 | __u16 err; |
| 72 | __u16 size; |
| 73 | __u8 data[UHID_DATA_MAX]; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 74 | } __attribute__((__packed__)); |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 75 | struct uhid_set_report_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 76 | __u32 id; |
| 77 | __u8 rnum; |
| 78 | __u8 rtype; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 79 | __u16 size; |
| 80 | __u8 data[UHID_DATA_MAX]; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 81 | } __attribute__((__packed__)); |
| 82 | struct uhid_set_report_reply_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 83 | __u32 id; |
| 84 | __u16 err; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 85 | } __attribute__((__packed__)); |
| 86 | enum uhid_legacy_event_type { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 87 | 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 Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 91 | UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 92 | }; |
| 93 | struct uhid_create_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 94 | __u8 name[128]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 95 | __u8 phys[64]; |
| 96 | __u8 uniq[64]; |
Elliott Hughes | 0f0c18f | 2023-03-29 15:53:31 -0700 | [diff] [blame] | 97 | __u8 * rd_data; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 98 | __u16 rd_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 99 | __u16 bus; |
| 100 | __u32 vendor; |
| 101 | __u32 product; |
| 102 | __u32 version; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 103 | __u32 country; |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 104 | } __attribute__((__packed__)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 105 | struct uhid_input_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 106 | __u8 data[UHID_DATA_MAX]; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 107 | __u16 size; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 108 | } __attribute__((__packed__)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 109 | struct uhid_output_ev_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 110 | __u16 type; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 111 | __u16 code; |
| 112 | __s32 value; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 113 | } __attribute__((__packed__)); |
| 114 | struct uhid_feature_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 115 | __u32 id; |
| 116 | __u8 rnum; |
| 117 | __u8 rtype; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 118 | } __attribute__((__packed__)); |
| 119 | struct uhid_feature_answer_req { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 120 | __u32 id; |
| 121 | __u16 err; |
| 122 | __u16 size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 123 | __u8 data[UHID_DATA_MAX]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 124 | } __attribute__((__packed__)); |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 125 | struct uhid_event { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 126 | __u32 type; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 127 | union { |
| 128 | struct uhid_create_req create; |
| 129 | struct uhid_input_req input; |
| 130 | struct uhid_output_req output; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 131 | 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 Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 135 | 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 Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 139 | struct uhid_set_report_reply_req set_report_reply; |
| 140 | struct uhid_start_req start; |
| 141 | } u; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 142 | } __attribute__((__packed__)); |
Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 143 | #endif |