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