• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4include <uapi/linux/fcntl.h>
5include <uapi/linux/uhid.h>
6
7resource fd_uhid[fd]
8
9openat$uhid(fd const[AT_FDCWD], file ptr[in, string["/dev/uhid"]], flags flags[uhid_open_flags], mode const[0]) fd_uhid
10write$UHID_CREATE(fd fd_uhid, data ptr[in, uhid_create_req], len len[data])
11write$UHID_CREATE2(fd fd_uhid, data ptr[in, uhid_create2_req], len len[data])
12write$UHID_DESTROY(fd fd_uhid, data ptr[in, uhid_destroy_req], len len[data])
13write$UHID_INPUT(fd fd_uhid, data ptr[in, uhid_input_req], len len[data])
14write$UHID_INPUT2(fd fd_uhid, data ptr[in, uhid_input2_req], len len[data])
15write$UHID_GET_REPORT_REPLY(fd fd_uhid, data ptr[in, uhid_get_report_req], len len[data])
16write$UHID_SET_REPORT_REPLY(fd fd_uhid, data ptr[in, uhid_set_report_req], len len[data])
17
18uhid_create_req {
19	type	const[UHID_CREATE, int32]
20	name	string[uhid_names, 128]
21	phys	string[uhid_names, 64]
22	uniq	string[uhid_names, 64]
23	rd_data	ptr[out, array[int8]]
24	rd_size	len[rd_data, int16]
25	bus	int16
26	vendor	int32
27	product	int32
28	version	int32
29	country	int32
30} [packed]
31
32uhid_create2_req {
33	type	const[UHID_CREATE2, int32]
34	name	string[uhid_names, 128]
35	phys	string[uhid_names, 64]
36	uniq	string[uhid_names, 64]
37	rd_size	len[rd_data, int16]
38	bus	int16
39	vendor	int32
40	product	int32
41	version	int32
42	country	int32
43	rd_data	array[int8]
44} [packed]
45
46uhid_destroy_req {
47	type	const[UHID_DESTROY, int32]
48} [packed]
49
50uhid_input_req {
51	type	const[UHID_INPUT, int32]
52	data	array[int8, UHID_DATA_MAX]
53	size	len[data, int16]
54} [packed]
55
56uhid_input2_req {
57	type	const[UHID_INPUT2, int32]
58	size	len[data, int16]
59	data	array[int8]
60} [packed]
61
62uhid_get_report_req {
63	type	const[UHID_GET_REPORT_REPLY, int32]
64	id	int32[0:10]
65	rnum	int8
66	rtype	int8
67} [packed]
68
69uhid_set_report_req {
70	type	const[UHID_SET_REPORT_REPLY, int32]
71	id	int32[0:10]
72	rnum	int8
73	rtype	int8
74	size	len[data, int16]
75	data	array[int8]
76} [packed]
77
78uhid_names = "syz0", "syz1"
79uhid_open_flags = O_RDWR, O_RDWR_NONBLOCK
80
81define O_RDWR_NONBLOCK	O_RDWR | O_NONBLOCK
82