Home | History | Annotate | Download | only in linux
      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/uinput.h>
      6 
      7 resource fd_uinput[fd]
      8 
      9 openat$uinput(fd const[AT_FDCWD], file ptr[in, string["/dev/uinput"]], flags flags[uinput_open_flags], mode const[0]) fd_uinput
     10 write$uinput_user_dev(fd fd_uinput, data ptr[in, uinput_user_dev], len len[data])
     11 write$input_event(fd fd_uinput, data ptr[in, input_event], len len[data])
     12 ioctl$UI_GET_VERSION(fd fd_uinput, cmd const[UI_GET_VERSION], arg ptr[out, int32])
     13 ioctl$UI_DEV_CREATE(fd fd_uinput, cmd const[UI_DEV_CREATE])
     14 ioctl$UI_DEV_DESTROY(fd fd_uinput, cmd const[UI_DEV_DESTROY])
     15 ioctl$UI_DEV_SETUP(fd fd_uinput, cmd const[UI_DEV_SETUP], arg ptr[in, uinput_setup])
     16 ioctl$UI_SET_EVBIT(fd fd_uinput, cmd const[UI_SET_EVBIT], arg intptr[0:EV_MAX])
     17 ioctl$UI_SET_KEYBIT(fd fd_uinput, cmd const[UI_SET_KEYBIT], arg intptr[0:KEY_MAX])
     18 ioctl$UI_SET_RELBIT(fd fd_uinput, cmd const[UI_SET_RELBIT], arg intptr[0:REL_MAX])
     19 ioctl$UI_SET_MSCBIT(fd fd_uinput, cmd const[UI_SET_MSCBIT], arg intptr[0:ABS_MAX])
     20 ioctl$UI_SET_ABSBIT(fd fd_uinput, cmd const[UI_SET_ABSBIT], arg intptr[0:MSC_MAX])
     21 ioctl$UI_SET_LEDBIT(fd fd_uinput, cmd const[UI_SET_LEDBIT], arg intptr[0:LED_MAX])
     22 ioctl$UI_SET_SNDBIT(fd fd_uinput, cmd const[UI_SET_SNDBIT], arg intptr[0:SND_MAX])
     23 ioctl$UI_SET_FFBIT(fd fd_uinput, cmd const[UI_SET_FFBIT], arg intptr[0:FF_MAX])
     24 ioctl$UI_SET_SWBIT(fd fd_uinput, cmd const[UI_SET_SWBIT], arg intptr[0:SW_MAX])
     25 ioctl$UI_SET_PROPBIT(fd fd_uinput, cmd const[UI_SET_PROPBIT], arg intptr[0:INPUT_PROP_MAX])
     26 ioctl$UI_SET_PHYS(fd fd_uinput, cmd const[UI_SET_PHYS], arg ptr[in, string[uinput_names]])
     27 ioctl$UI_BEGIN_FF_UPLOAD(fd fd_uinput, cmd const[UI_BEGIN_FF_UPLOAD], arg ptr[in, uinput_ff_upload])
     28 ioctl$UI_BEGIN_FF_ERASE(fd fd_uinput, cmd const[UI_BEGIN_FF_ERASE], arg ptr[in, uinput_ff_erase])
     29 ioctl$UI_END_FF_UPLOAD(fd fd_uinput, cmd const[UI_END_FF_UPLOAD], arg ptr[in, uinput_ff_upload])
     30 ioctl$UI_END_FF_ERASE(fd fd_uinput, cmd const[UI_END_FF_ERASE], arg ptr[in, uinput_ff_erase])
     31 ioctl$UI_GET_SYSNAME(fd fd_uinput, cmd const[UI_GET_SYSNAME_64], arg ptr[out, array[int8, 64]])
     32 ioctl$UI_ABS_SETUP(fd fd_uinput, cmd const[UI_ABS_SETUP], arg ptr[in, uinput_abs_setup])
     33 
     34 input_id {
     35 	bustype	int16
     36 	vendor	int16
     37 	product	int16
     38 	version	int16
     39 }
     40 
     41 uinput_user_dev {
     42 	name		string[uinput_names, UINPUT_MAX_NAME_SIZE]
     43 	id		input_id
     44 	ff_effects_max	int32[1:FF_EFFECT_MAX]
     45 	absmax		array[int32, ABS_CNT]
     46 	absmin		array[int32, ABS_CNT]
     47 	absfuzz		array[int32, ABS_CNT]
     48 	absflat		array[int32, ABS_CNT]
     49 }
     50 
     51 uinput_setup {
     52 	id		input_id
     53 	name		string[uinput_names, UINPUT_MAX_NAME_SIZE]
     54 	ff_effects_max	int32[1:FF_EFFECT_MAX]
     55 }
     56 
     57 uinput_ff_upload {
     58 	request_id	int32[0:16]
     59 	retval		int32
     60 	effect		ff_effect
     61 	old		ff_effect
     62 }
     63 
     64 uinput_ff_erase {
     65 	request_id	int32[0:16]
     66 	retval		int32
     67 	effect_id	int32
     68 }
     69 
     70 uinput_abs_setup {
     71 	code	int16
     72 	absinfo	input_absinfo
     73 }
     74 
     75 uinput_names = "syz0", "syz1"
     76 uinput_open_flags = O_RDWR, O_RDWR_NONBLOCK
     77 
     78 define UI_GET_SYSNAME_64	UI_GET_SYSNAME(64)
     79