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