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

     1  # Copyright 2019 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/asm/ioctl.h>
     5  include <uapi/linux/hiddev.h>
     6  
     7  resource fd_hiddev[fd]
     8  
     9  syz_open_dev$hiddev(dev ptr[in, string["/dev/usb/hiddev#"]], id intptr, flags flags[open_flags]) fd_hiddev (timeout[50])
    10  
    11  read$hiddev(fd fd_hiddev, data buffer[out], len bytesize[data])
    12  
    13  # https://elixir.bootlin.com/linux/v5.1.7/source/include/uapi/linux/hiddev.h#L155
    14  ioctl$HIDIOCGVERSION(fd fd_hiddev, cmd const[HIDIOCGVERSION], arg ptr[out, int32])
    15  ioctl$HIDIOCAPPLICATION(fd fd_hiddev, cmd const[HIDIOCAPPLICATION], arg intptr)
    16  ioctl$HIDIOCGDEVINFO(fd fd_hiddev, cmd const[HIDIOCGDEVINFO], arg buffer[out])
    17  ioctl$HIDIOCGSTRING(fd fd_hiddev, cmd const[HIDIOCGSTRING], arg ptr[inout, hiddev_ioctl_string_arg])
    18  ioctl$HIDIOCINITREPORT(fd fd_hiddev, cmd const[HIDIOCINITREPORT], arg const[0])
    19  ioctl$HIDIOCGNAME(fd fd_hiddev, cmd const[HIDIOCGNAME64], arg ptr[out, array[int8, 64]])
    20  ioctl$HIDIOCGREPORT(fd fd_hiddev, cmd const[HIDIOCGREPORT], arg ptr[in, hiddev_report_info])
    21  ioctl$HIDIOCSREPORT(fd fd_hiddev, cmd const[HIDIOCSREPORT], arg ptr[in, hiddev_report_info])
    22  ioctl$HIDIOCGREPORTINFO(fd fd_hiddev, cmd const[HIDIOCGREPORTINFO], arg ptr[inout, hiddev_report_info])
    23  ioctl$HIDIOCGFIELDINFO(fd fd_hiddev, cmd const[HIDIOCGFIELDINFO], arg ptr[inout, hiddev_field_info])
    24  ioctl$HIDIOCGUSAGE(fd fd_hiddev, cmd const[HIDIOCGUSAGE], arg ptr[inout, hiddev_usage_ref])
    25  ioctl$HIDIOCSUSAGE(fd fd_hiddev, cmd const[HIDIOCSUSAGE], arg ptr[in, hiddev_usage_ref])
    26  ioctl$HIDIOCGUCODE(fd fd_hiddev, cmd const[HIDIOCGUCODE], arg ptr[inout, hiddev_usage_ref])
    27  ioctl$HIDIOCGFLAG(fd fd_hiddev, cmd const[HIDIOCGFLAG], arg ptr[out, int32])
    28  ioctl$HIDIOCSFLAG(fd fd_hiddev, cmd const[HIDIOCSFLAG], arg ptr[in, flags[hiddev_flags, int32]])
    29  ioctl$HIDIOCGCOLLECTIONINDEX(fd fd_hiddev, cmd const[HIDIOCGCOLLECTIONINDEX], arg ptr[in, hiddev_usage_ref])
    30  ioctl$HIDIOCGCOLLECTIONINFO(fd fd_hiddev, cmd const[HIDIOCGCOLLECTIONINFO], arg ptr[inout, hiddev_collection_info])
    31  ioctl$HIDIOCGPHYS(fd fd_hiddev, cmd const[HIDIOCGPHYS64], arg ptr[out, array[int8, 64]])
    32  ioctl$HIDIOCGUSAGES(fd fd_hiddev, cmd const[HIDIOCGUSAGES], arg ptr[inout, hiddev_usage_ref_multi])
    33  ioctl$HIDIOCSUSAGES(fd fd_hiddev, cmd const[HIDIOCSUSAGES], arg ptr[in, hiddev_usage_ref_multi])
    34  
    35  hiddev_ioctl_string_arg {
    36  	idx	len[data, int32]
    37  	data	array[int8]
    38  }
    39  
    40  hiddev_report_info {
    41  	report_type	int32[HID_REPORT_TYPE_MIN:HID_REPORT_TYPE_MAX]
    42  	report_id	flags[hid_report_ids, int32]
    43  	num_fields	int32
    44  }
    45  
    46  hiddev_field_info {
    47  	report_type		int32[HID_REPORT_TYPE_MIN:HID_REPORT_TYPE_MAX]
    48  	report_id		flags[hid_report_ids, int32]
    49  	field_index		int32
    50  	maxusage		int32
    51  	flags			int32
    52  	physical		int32
    53  	logical			int32
    54  	application		int32
    55  	logical_minimum		int32
    56  	logical_maximum		int32
    57  	physical_minimum	int32
    58  	physical_maximum	int32
    59  	unit_exponent		int32
    60  	unit			int32
    61  }
    62  
    63  hiddev_collection_info {
    64  	index	int32
    65  	type	int32
    66  	usage	int32
    67  	level	int32
    68  }
    69  
    70  hiddev_usage_ref {
    71  	report_type	int32[HID_REPORT_TYPE_MIN:HID_REPORT_TYPE_MAX]
    72  	report_id	flags[hid_report_ids, int32]
    73  	field_index	int32
    74  	usage_index	int32
    75  	usage_code	int32
    76  	value		int32
    77  }
    78  
    79  hiddev_usage_ref_multi {
    80  	uref		hiddev_usage_ref
    81  	num_values	int32[0:HID_MAX_MULTI_USAGES]
    82  	values		array[int32, HID_MAX_MULTI_USAGES]
    83  }
    84  
    85  hiddev_flags = HIDDEV_FLAG_UREF, HIDDEV_FLAG_REPORT, HIDDEV_FLAGS
    86  hid_report_ids = 1, 2, 3, HID_REPORT_ID_UNKNOWN, HID_REPORT_ID_FIRST, HID_REPORT_ID_NEXT
    87  
    88  define HIDIOCGNAME64	HIDIOCGNAME(64)
    89  define HIDIOCGPHYS64	HIDIOCGPHYS(64)