github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_uhid.txt (about)

     1  # Copyright 2018 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <uapi/linux/fcntl.h>
     5  include <uapi/linux/uhid.h>
     6  
     7  resource fd_uhid[fd]
     8  
     9  openat$uhid(fd const[AT_FDCWD], file ptr[in, string["/dev/uhid"]], flags flags[uhid_open_flags], mode const[0]) fd_uhid
    10  write$UHID_CREATE(fd fd_uhid, data ptr[in, uhid_req[UHID_CREATE, uhid_create_req]], len len[data])
    11  write$UHID_CREATE2(fd fd_uhid, data ptr[in, uhid_req[UHID_CREATE2, uhid_create2_req]], len len[data])
    12  write$UHID_DESTROY(fd fd_uhid, data ptr[in, uhid_req[UHID_DESTROY, void]], len len[data])
    13  write$UHID_INPUT(fd fd_uhid, data ptr[in, uhid_req[UHID_INPUT, uhid_input_req]], len len[data])
    14  write$UHID_INPUT2(fd fd_uhid, data ptr[in, uhid_req[UHID_INPUT2, uhid_input2_req]], len len[data])
    15  write$UHID_GET_REPORT_REPLY(fd fd_uhid, data ptr[in, uhid_req[UHID_GET_REPORT_REPLY, uhid_get_report_req]], len len[data])
    16  write$UHID_SET_REPORT_REPLY(fd fd_uhid, data ptr[in, uhid_req[UHID_SET_REPORT_REPLY, uhid_set_report_req]], len len[data])
    17  
    18  type uhid_req[TYP, DATA] {
    19  	type	const[TYP, int32]
    20  	data	DATA
    21  } [packed]
    22  
    23  uhid_create_req {
    24  	name	string[uhid_names, 128]
    25  	phys	string[uhid_names, 64]
    26  	uniq	string[uhid_names, 64]
    27  	rd_data	ptr[out, array[int8]]
    28  	rd_size	len[rd_data, int16]
    29  	bus	int16
    30  	vendor	int32
    31  	product	int32
    32  	version	int32
    33  	country	int32
    34  } [packed]
    35  
    36  uhid_create2_req {
    37  	name	string[uhid_names, 128]
    38  	phys	string[uhid_names, 64]
    39  	uniq	string[uhid_names, 64]
    40  	rd_size	len[rd_data, int16]
    41  	bus	int16
    42  	vendor	int32
    43  	product	int32
    44  	version	int32
    45  	country	int32
    46  	rd_data	array[int8]
    47  } [packed]
    48  
    49  uhid_input_req {
    50  	data	array[int8, UHID_DATA_MAX]
    51  	size	len[data, int16]
    52  } [packed]
    53  
    54  uhid_input2_req {
    55  	size	len[data, int16]
    56  	data	array[int8]
    57  } [packed]
    58  
    59  uhid_get_report_req {
    60  	id	int32[0:10]
    61  	rnum	int8
    62  	rtype	int8
    63  } [packed]
    64  
    65  uhid_set_report_req {
    66  	id	int32[0:10]
    67  	rnum	int8
    68  	rtype	int8
    69  	size	len[data, int16]
    70  	data	array[int8]
    71  } [packed]
    72  
    73  uhid_names = "syz0", "syz1"
    74  uhid_open_flags = O_RDWR, O_RDWR_NONBLOCK
    75  
    76  define O_RDWR_NONBLOCK	O_RDWR | O_NONBLOCK