| # Copyright 2017 syzkaller project authors. All rights reserved. |
| # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. |
| |
| include <linux/types.h> |
| include <linux/byteorder/generic.h> |
| |
| include <uapi/linux/usb/ch9.h> |
| include <uapi/linux/usb/ch11.h> |
| include <uapi/linux/hid.h> |
| include <linux/hid.h> |
| include <uapi/linux/usb/cdc.h> |
| |
| resource fd_usb[fd] |
| |
| syz_usb_connect(speed flags[usb_device_speed], length len[dev], dev ptr[in, usb_device_descriptor], dev_id ptr[in, usb_device_id], desc_responses ptr[in, usbfuzz_responses_desc], req_responses ptr[in, usbfuzz_responses_req], gen_responses ptr[in, usbfuzz_responses_gen]) fd_usb |
| |
| syz_usb_disconnect(fd fd_usb) |
| |
| usb_device_speed = USB_SPEED_UNKNOWN, USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_WIRELESS, USB_SPEED_SUPER, USB_SPEED_SUPER_PLUS |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| |
| usb_device_descriptor { |
| bLength const[USB_DT_DEVICE_SIZE, int8] |
| bDescriptorType const[USB_DT_DEVICE, int8] |
| |
| bcdUSB int16 |
| bDeviceClass_p flags[usb_classes, int8] |
| bDeviceSubClass_p int8 |
| bDeviceProtocol_p int8 |
| bMaxPacketSize0 int8 |
| idVendor_p int16 |
| idProduct_p int16 |
| bcdDevice_p int16 |
| iManufacturer int8 |
| iProduct int8 |
| iSerialNumber int8 |
| bNumConfigurations int8 |
| |
| configs array[usb_config_descriptor, 1] |
| } [packed] |
| |
| usb_classes = USB_CLASS_PER_INTERFACE, USB_CLASS_AUDIO, USB_CLASS_COMM, USB_CLASS_HID, USB_CLASS_PHYSICAL, USB_CLASS_STILL_IMAGE, USB_CLASS_PRINTER, USB_CLASS_MASS_STORAGE, USB_CLASS_HUB, USB_CLASS_CDC_DATA, USB_CLASS_CSCID, USB_CLASS_CONTENT_SEC, USB_CLASS_VIDEO, USB_CLASS_WIRELESS_CONTROLLER, USB_CLASS_MISC, USB_CLASS_APP_SPEC, USB_CLASS_VENDOR_SPEC |
| |
| usb_config_descriptor { |
| bLength const[USB_DT_CONFIG_SIZE, int8] |
| bDescriptorType const[USB_DT_CONFIG, int8] |
| |
| wTotalLength len[parent, int16] |
| bNumInterfaces int8 |
| bConfigurationValue int8 |
| iConfiguration int8 |
| bmAttributes flags[usb_config_attributes, int8] |
| bMaxPower int8 |
| |
| interface array[usb_interface_descriptor, 1] |
| } [packed] |
| |
| usb_config_attributes = USB_CONFIG_ATT_ONE, USB_CONFIG_ATT_SELFPOWER, USB_CONFIG_ATT_WAKEUP, USB_CONFIG_ATT_BATTERY |
| |
| usb_interface_descriptor { |
| bLength const[USB_DT_INTERFACE_SIZE, int8] |
| bDescriptorType const[USB_DT_INTERFACE, int8] |
| |
| bInterfaceNumber_p int8 |
| bAlternateSetting int8 |
| bNumEndpoints len[endpoints, int8] |
| bInterfaceClass_p flags[usb_classes, int8] |
| bInterfaceSubClass_p int8 |
| bInterfaceProtocol_p int8 |
| iInterface int8 |
| |
| extra1 array[usb_extra_descriptor, 0:2] |
| endpoints array[usb_endpoint_descriptor, 0:16] |
| extra2 array[usb_extra_descriptor, 0:2] |
| } [packed] |
| |
| usb_endpoint_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_ENDPOINT, int8] |
| |
| bEndpointAddress int8 |
| bmAttributes flags[usb_endpoint_attributes, int8] |
| wMaxPacketSize int16 |
| bInterval int8 |
| bRefresh int8 |
| bSynchAddress int8 |
| } [packed] |
| |
| usb_endpoint_attributes = USB_ENDPOINT_XFER_CONTROL, USB_ENDPOINT_XFER_ISOC, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_INT, USB_ENDPOINT_INTR_PERIODIC, USB_ENDPOINT_INTR_NOTIFICATION, USB_ENDPOINT_SYNC_NONE, USB_ENDPOINT_SYNC_ASYNC, USB_ENDPOINT_SYNC_ADAPTIVE, USB_ENDPOINT_SYNC_SYNC, USB_ENDPOINT_USAGE_DATA, USB_ENDPOINT_USAGE_FEEDBACK, USB_ENDPOINT_USAGE_FEEDBACK |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| |
| usb_extra_descriptor [ |
| generic usb_generic_descriptor |
| hid_hid hid_descriptor_hid |
| usb_cdc usb_cdc_header |
| ] [varlen] |
| |
| usb_generic_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType flags[usb_descriptor_types, int8] |
| |
| data array[int8, 0:64] |
| } [packed] |
| |
| usb_descriptor_types = USB_DT_DEVICE, USB_DT_CONFIG, USB_DT_STRING, USB_DT_INTERFACE, USB_DT_ENDPOINT, USB_DT_DEVICE_QUALIFIER, USB_DT_OTHER_SPEED_CONFIG, USB_DT_INTERFACE_POWER, USB_DT_OTG, USB_DT_DEBUG, USB_DT_INTERFACE_ASSOCIATION, USB_DT_SECURITY, USB_DT_KEY, USB_DT_ENCRYPTION_TYPE, USB_DT_BOS, USB_DT_DEVICE_CAPABILITY, USB_DT_WIRELESS_ENDPOINT_COMP, USB_DT_WIRE_ADAPTER, USB_DT_RPIPE, USB_DT_CS_RADIO_CONTROL, USB_DT_PIPE_USAGE, USB_DT_SS_ENDPOINT_COMP, USB_DT_SSP_ISOC_ENDPOINT_COMP, HID_DT_HID, HID_DT_REPORT, HID_DT_PHYSICAL |
| |
| hid_descriptor_hid { |
| bLength len[parent, int8] |
| bDescriptorType const[HID_DT_HID, int8] |
| |
| bcdHID int16 |
| bCountryCode int8 |
| bNumDescriptors len[class_desc, int8] |
| |
| class_desc array[hid_class_descriptor, 0:6] |
| } [packed] |
| |
| hid_class_descriptor { |
| bDescriptorType flags[hid_descriptor_types, int8] |
| wDescriptorLength int16[0:HID_MAX_DESCRIPTOR_SIZE] |
| } [packed] |
| |
| hid_descriptor_types = HID_DT_HID, HID_DT_REPORT, HID_DT_PHYSICAL |
| |
| usb_cdc_header { |
| items array[usb_cdc_header_item, 0:16] |
| } [packed] |
| |
| usb_cdc_header_item [ |
| generic usb_cdc_generic |
| header usb_cdc_header_desc |
| call_mgmt usb_cdc_call_mgmt_descriptor |
| acm usb_cdc_acm_descriptor |
| union usb_cdc_union_desc |
| country_functional usb_cdc_country_functional_desc |
| network_terminal usb_cdc_network_terminal_desc |
| ether usb_cdc_ether_desc |
| dmm usb_cdc_dmm_desc |
| mdlm usb_cdc_mdlm_desc |
| mdlm_detail usb_cdc_mdlm_detail_desc |
| obex usb_cdc_obex_desc |
| ncm usb_cdc_ncm_desc |
| mbim usb_cdc_mbim_desc |
| mbim_extended usb_cdc_mbim_extended_desc |
| ] [varlen] |
| |
| usb_cdc_generic { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType int8 |
| |
| data array[int8, 0:64] |
| } [packed] |
| |
| usb_cdc_types = USB_CDC_HEADER_TYPE, USB_CDC_CALL_MANAGEMENT_TYPE, USB_CDC_ACM_TYPE, USB_CDC_UNION_TYPE, USB_CDC_COUNTRY_TYPE, USB_CDC_NETWORK_TERMINAL_TYPE, USB_CDC_ETHERNET_TYPE, USB_CDC_WHCM_TYPE, USB_CDC_MDLM_TYPE, USB_CDC_MDLM_DETAIL_TYPE, USB_CDC_DMM_TYPE, USB_CDC_OBEX_TYPE, USB_CDC_NCM_TYPE, USB_CDC_MBIM_TYPE, USB_CDC_MBIM_EXTENDED_TYPE |
| |
| usb_cdc_header_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_HEADER_TYPE, int8] |
| |
| bcdCDC int16 |
| } [packed] |
| |
| usb_cdc_call_mgmt_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_CALL_MANAGEMENT_TYPE, int8] |
| |
| bmCapabilities flags[usb_cdc_call_mgmt_caps, int8] |
| } [packed] |
| |
| usb_cdc_call_mgmt_caps = USB_CDC_CALL_MGMT_CAP_CALL_MGMT, USB_CDC_CALL_MGMT_CAP_DATA_INTF |
| |
| usb_cdc_acm_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_ACM_TYPE, int8] |
| |
| bmCapabilities flags[usb_cdc_acm_caps, int8] |
| } [packed] |
| |
| usb_cdc_acm_caps = USB_CDC_COMM_FEATURE, USB_CDC_CAP_LINE, USB_CDC_CAP_BRK, USB_CDC_CAP_NOTIFY |
| |
| usb_cdc_union_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_UNION_TYPE, int8] |
| |
| bMasterInterface0 int8 |
| bSlaveInterface0 int8 |
| slave_interfaces array[int8, 0:6] |
| } [packed] |
| |
| usb_cdc_country_functional_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_COUNTRY_TYPE, int8] |
| |
| iCountryCodeRelDate int8 |
| wCountyCode0 int16 |
| country_codes array[int16, 0:6] |
| } [packed] |
| |
| usb_cdc_network_terminal_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_NETWORK_TERMINAL_TYPE, int8] |
| |
| bEntityId int8 |
| iName int8 |
| bChannelIndex int8 |
| bPhysicalInterface int8 |
| } [packed] |
| |
| usb_cdc_ether_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_ETHERNET_TYPE, int8] |
| |
| iMACAddress int8 |
| bmEthernetStatistics int32 |
| wMaxSegmentSize int16 |
| wNumberMCFilters int16 |
| bNumberPowerFilters int8 |
| } [packed] |
| |
| usb_cdc_dmm_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_DMM_TYPE, int8] |
| |
| bcdVersion int16 |
| wMaxCommand int16 |
| } [packed] |
| |
| usb_cdc_mdlm_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_MDLM_TYPE, int8] |
| |
| bcdVersion int16 |
| bGUID array[int8, 16] |
| } [packed] |
| |
| usb_cdc_mdlm_detail_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_MDLM_DETAIL_TYPE, int8] |
| |
| bGuidDescriptorType int8 |
| bDetailData array[int8, 0:64] |
| } [packed] |
| |
| usb_cdc_obex_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_OBEX_TYPE, int8] |
| |
| bcdVersion int16 |
| } [packed] |
| |
| usb_cdc_ncm_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_NCM_TYPE, int8] |
| |
| bcdNcmVersion int16 |
| bmNetworkCapabilities int8 |
| } [packed] |
| |
| usb_cdc_mbim_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_MBIM_TYPE, int8] |
| |
| bcdMBIMVersion int16 |
| wMaxControlMessage int16 |
| bNumberFilters int8 |
| bMaxFilterSize int8 |
| wMaxSegmentSize int16 |
| bmNetworkCapabilities int8 |
| } [packed] |
| |
| usb_cdc_mbim_extended_desc { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_CS_INTERFACE, int8] |
| bDescriptorSubType const[USB_CDC_MBIM_EXTENDED_TYPE, int8] |
| |
| bcdMBIMExtendedVersion int16 |
| bMaxOutstandingCommandMessages int8 |
| wMTU int16 |
| } [packed] |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| |
| usb_bos_descriptor { |
| bLength const[USB_DT_BOS_SIZE, int8] |
| bDescriptorType const[USB_DT_BOS, int8] |
| |
| wTotalLength len[parent, int16] |
| bNumDeviceCaps len[caps, int8] |
| |
| caps array[usb_dev_cap, 0:6] |
| } [packed] |
| |
| usb_dev_cap [ |
| data array[int8, 0:64] |
| wireless usb_wireless_cap_descriptor |
| ext_cap usb_ext_cap_descriptor |
| ss_cap usb_ss_cap_descriptor |
| ss_container_id usb_ss_container_id_descriptor |
| ssp_cap usb_ssp_cap_descriptor |
| ] [varlen] |
| |
| usb_wireless_cap_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8] |
| bDevCapabilityType const[USB_CAP_TYPE_WIRELESS_USB, int8] |
| |
| bmAttributes flags[usb_wireless_cap_attributes, int8] |
| wPHYRates flags[usb_wireless_cap_phyrates, int16] |
| bmTFITXPowerInfo int8 |
| bmFFITXPowerInfo int8 |
| bmBandGroup int16 |
| bReserved int8 |
| } [packed] |
| |
| usb_wireless_cap_attributes = USB_WIRELESS_P2P_DRD, USB_WIRELESS_BEACON_MASK, USB_WIRELESS_BEACON_SELF, USB_WIRELESS_BEACON_DIRECTED, USB_WIRELESS_BEACON_NONE |
| |
| usb_wireless_cap_phyrates = USB_WIRELESS_PHY_53, USB_WIRELESS_PHY_80, USB_WIRELESS_PHY_107, USB_WIRELESS_PHY_160, USB_WIRELESS_PHY_200, USB_WIRELESS_PHY_320, USB_WIRELESS_PHY_400, USB_WIRELESS_PHY_480 |
| |
| usb_ext_cap_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8] |
| bDevCapabilityType const[USB_CAP_TYPE_EXT, int8] |
| |
| bmAttributes flags[usb_ext_cap_attributes, int32] |
| } [packed] |
| |
| usb_ext_cap_attributes = USB_LPM_SUPPORT, USB_BESL_SUPPORT, USB_BESL_BASELINE_VALID, USB_BESL_DEEP_VALID |
| |
| usb_ss_cap_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8] |
| bDevCapabilityType const[USB_SS_CAP_TYPE, int8] |
| |
| bmAttributes flags[usb_ss_cap_attributes, int8] |
| wSpeedSupported flags[usb_ss_cap_speed, int16] |
| bFunctionalitySupport int8 |
| bU1devExitLat int8 |
| bU2DevExitLat int16 |
| } [packed] |
| |
| usb_ss_cap_attributes = USB_LTM_SUPPORT |
| |
| usb_ss_cap_speed = USB_LOW_SPEED_OPERATION, USB_FULL_SPEED_OPERATION, USB_HIGH_SPEED_OPERATION, USB_5GBPS_OPERATION |
| |
| usb_ss_container_id_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8] |
| bDevCapabilityType const[CONTAINER_ID_TYPE, int8] |
| |
| bReserved int8 |
| ContainerID array[int8, 16] |
| } [packed] |
| |
| usb_ssp_cap_descriptor { |
| bLength len[parent, int8] |
| bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8] |
| bDevCapabilityType const[USB_SSP_CAP_TYPE, int8] |
| |
| bReserved int8 |
| bmAttributesSublinkSpeeds len[bmSublinkSpeedAttr, int32:5] |
| bmAttributesSpeedIDs int32:27 |
| wFunctionalitySupport flags[usb_ssp_cap_funcs, int16] |
| wReserved int16 |
| bmSublinkSpeedAttr array[flags[usb_ssp_cap_sublink_speeds, int32], 0:6] |
| } [packed] |
| |
| usb_ssp_cap_funcs = USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID, USB_SSP_MIN_RX_LANE_COUNT, USB_SSP_MIN_TX_LANE_COUNT |
| |
| usb_ssp_cap_sublink_speeds = USB_SSP_SUBLINK_SPEED_SSID, USB_SSP_SUBLINK_SPEED_LSE, USB_SSP_SUBLINK_SPEED_ST, USB_SSP_SUBLINK_SPEED_RSVD, USB_SSP_SUBLINK_SPEED_LP, USB_SSP_SUBLINK_SPEED_LSM |
| |
| # TODO: use structures |
| hid_descriptor_report { |
| items array[hid_report_item, 0:64] |
| } [packed] |
| |
| hid_report_item_short_012 { |
| bSize len[data, int8:2] |
| bType flags[hid_report_item_types, int8:2] |
| bTag flags[hid_report_item_tags, int8:4] |
| data array[int8, 0:2] |
| } [packed] |
| |
| hid_report_item_short_4 { |
| bSize const[3, int8:2] |
| bType flags[hid_report_item_types, int8:2] |
| bTag flags[hid_report_item_tags, int8:4] |
| data array[int8, 4] |
| } [packed] |
| |
| hid_report_item_short [ |
| item_012 hid_report_item_short_012 |
| item_4 hid_report_item_short_4 |
| ] [varlen] |
| |
| hid_report_item_long { |
| bSize int8:2 |
| bType int8:2 |
| bTag const[HID_ITEM_TAG_LONG, int8:4] |
| bDataSize len[data, int8] |
| bLongItemTag flags[hid_report_item_tags, int8] |
| data array[int8, 0:255] |
| } [packed] |
| |
| hid_report_item [ |
| short hid_report_item_short |
| long hid_report_item_long |
| ] [varlen] |
| |
| hid_report_item_types = HID_ITEM_TYPE_MAIN, HID_ITEM_TYPE_GLOBAL, HID_ITEM_TYPE_LOCAL, HID_ITEM_TYPE_RESERVED |
| |
| hid_report_item_tags = HID_ITEM_TAG_LONG, HID_MAIN_ITEM_TAG_INPUT, HID_MAIN_ITEM_TAG_OUTPUT, HID_MAIN_ITEM_TAG_FEATURE, HID_MAIN_ITEM_TAG_BEGIN_COLLECTION, HID_MAIN_ITEM_TAG_END_COLLECTION, HID_GLOBAL_ITEM_TAG_USAGE_PAGE, HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM, HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM, HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM, HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM, HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT, HID_GLOBAL_ITEM_TAG_UNIT, HID_GLOBAL_ITEM_TAG_REPORT_SIZE, HID_GLOBAL_ITEM_TAG_REPORT_ID, HID_GLOBAL_ITEM_TAG_REPORT_COUNT, HID_GLOBAL_ITEM_TAG_PUSH, HID_GLOBAL_ITEM_TAG_POP, HID_LOCAL_ITEM_TAG_USAGE, HID_LOCAL_ITEM_TAG_USAGE_MINIMUM, HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM, HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX, HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM, HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM, HID_LOCAL_ITEM_TAG_STRING_INDEX, HID_LOCAL_ITEM_TAG_STRING_MINIMUM, HID_LOCAL_ITEM_TAG_STRING_MAXIMUM, HID_LOCAL_ITEM_TAG_DELIMITER |
| |
| usb_hub_descriptor [ |
| hs usb_hub_descriptor_hs |
| ss usb_hub_descriptor_ss |
| ] [varlen] |
| |
| usb_hub_descriptor_hs { |
| bDescLength len[parent, int8] |
| bDescriptorType const[USB_DT_HUB, int8] |
| |
| bNbrPorts int8 |
| wHubCharacteristics flags[usb_hub_characteristics, int16] |
| bPwrOn2PwrGood int8 |
| bHubContrCurrent int8 |
| |
| DeviceRemovable array[int8, USB_HUB_PORTS_BITS] |
| PortPwrCtrlMask array[int8, USB_HUB_PORTS_BITS] |
| } [packed] |
| |
| usb_hub_descriptor_ss { |
| bDescLength len[parent, int8] |
| bDescriptorType const[USB_DT_SS_HUB, int8] |
| |
| bNbrPorts int8 |
| wHubCharacteristics flags[usb_hub_characteristics, int16] |
| bPwrOn2PwrGood int8 |
| bHubContrCurrent int8 |
| |
| bHubHdrDecLat int8 |
| wHubDelay int16 |
| DeviceRemovable int16 |
| } [packed] |
| |
| define USB_HUB_PORTS_BITS ((USB_MAXCHILDREN + 1 + 7) / 8) |
| |
| usb_hub_characteristics = HUB_CHAR_LPSM, HUB_CHAR_COMMON_LPSM, HUB_CHAR_INDV_PORT_LPSM, HUB_CHAR_NO_LPSM, HUB_CHAR_COMPOUND, HUB_CHAR_OCPM, HUB_CHAR_COMMON_OCPM, HUB_CHAR_INDV_PORT_OCPM, HUB_CHAR_NO_OCPM, HUB_CHAR_TTTT, HUB_CHAR_PORTIND |
| |
| usb_port_status { |
| wPortStatus flags[usb_port_status_flags, int16] |
| wPortChange flags[usb_port_change_flags, int16] |
| dwExtPortStatus array[flags[usb_ext_port_status_flags, int32], 0:1] |
| } [packed] |
| |
| usb_port_status_flags = USB_PORT_STAT_CONNECTION, USB_PORT_STAT_ENABLE, USB_PORT_STAT_SUSPEND, USB_PORT_STAT_OVERCURRENT, USB_PORT_STAT_RESET, USB_PORT_STAT_L1, USB_PORT_STAT_POWER, USB_PORT_STAT_LOW_SPEED, USB_PORT_STAT_HIGH_SPEED, USB_PORT_STAT_TEST, USB_PORT_STAT_INDICATOR, USB_PORT_STAT_LINK_STATE, USB_SS_PORT_STAT_POWER, USB_SS_PORT_STAT_SPEED, USB_PORT_STAT_SPEED_5GBPS, USB_SS_PORT_LS_U0, USB_SS_PORT_LS_U1, USB_SS_PORT_LS_U2, USB_SS_PORT_LS_U3, USB_SS_PORT_LS_SS_DISABLED, USB_SS_PORT_LS_RX_DETECT, USB_SS_PORT_LS_SS_INACTIVE, USB_SS_PORT_LS_POLLING, USB_SS_PORT_LS_RECOVERY, USB_SS_PORT_LS_HOT_RESET, USB_SS_PORT_LS_COMP_MOD, USB_SS_PORT_LS_LOOPBACK |
| |
| usb_port_change_flags = USB_PORT_STAT_C_CONNECTION, USB_PORT_STAT_C_ENABLE, USB_PORT_STAT_C_SUSPEND, USB_PORT_STAT_C_OVERCURRENT, USB_PORT_STAT_C_RESET, USB_PORT_STAT_C_L1, USB_PORT_STAT_C_BH_RESET, USB_PORT_STAT_C_LINK_STATE, USB_PORT_STAT_C_CONFIG_ERROR |
| |
| usb_ext_port_status_flags = USB_EXT_PORT_STAT_RX_SPEED_ID, USB_EXT_PORT_STAT_TX_SPEED_ID, USB_EXT_PORT_STAT_RX_LANES, USB_EXT_PORT_STAT_TX_LANES |
| |
| usb_hub_status { |
| wHubStatus flags[usb_hub_status_flags, int16] |
| wHubChange flags[usb_hub_change_flags, int16] |
| } [packed] |
| |
| usb_hub_status_flags = HUB_STATUS_LOCAL_POWER, HUB_STATUS_OVERCURRENT |
| |
| usb_hub_change_flags = HUB_CHANGE_LOCAL_POWER, HUB_CHANGE_OVERCURRENT |
| |
| usb_cdc_ncm_ntb_parameters { |
| wLength int16 |
| bmNtbFormatsSupported int16 |
| dwNtbInMaxSize int32 |
| wNdpInDivisor int16 |
| wNdpInPayloadRemainder int16 |
| wNdpInAlignment int16 |
| wPadding1 int16 |
| dwNtbOutMaxSize int32 |
| wNdpOutDivisor int16 |
| wNdpOutPayloadRemainder int16 |
| wNdpOutAlignment int16 |
| wNtbOutMaxDatagrams int16 |
| } [packed] |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| |
| usbfuzz_responses_desc { |
| length bytesize[responses, int64] |
| responses array[usbfuzz_response_desc_packed, 0:8] |
| } [packed] |
| |
| usbfuzz_response_desc_packed { |
| length bytesize[desc, int64] |
| repeat int8[0:1] |
| desc usbfuzz_response_desc |
| } [packed] |
| |
| usbfuzz_response_desc [ |
| generic usbfuzz_response_desc_generic |
| random usbfuzz_response_desc_random |
| hid_report usbfuzz_response_desc_hid_report |
| bos usbfuzz_response_desc_bos |
| hub_hs usb_hub_descriptor_hs |
| hub_ss usb_hub_descriptor_ss |
| ] [varlen] |
| |
| usbfuzz_response_desc_generic { |
| type flags[usb_descriptor_types, int8] |
| desc usb_generic_descriptor |
| } [packed] |
| |
| usbfuzz_response_desc_random { |
| type flags[usb_descriptor_types, int8] |
| desc array[int8, 0:64] |
| } [packed] |
| |
| usbfuzz_response_desc_hid_report { |
| type const[HID_DT_REPORT, int8] |
| desc hid_descriptor_report |
| } [packed] |
| |
| usbfuzz_response_desc_bos { |
| type const[USB_DT_BOS, int8] |
| desc usb_bos_descriptor |
| } [packed] |
| |
| usbfuzz_response_desc_hub_hs { |
| type const[USB_DT_HUB, int8] |
| desc usb_hub_descriptor_hs |
| } [packed] |
| |
| usbfuzz_response_desc_hub_ss { |
| type const[USB_DT_SS_HUB, int8] |
| desc usb_hub_descriptor_ss |
| } [packed] |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| |
| usbfuzz_responses_req { |
| length bytesize[responses, int64] |
| responses array[usbfuzz_response_req_packed, 0:8] |
| } [packed] |
| |
| usbfuzz_response_req_packed { |
| length bytesize[desc, int64] |
| repeat int8[0:1] |
| desc usbfuzz_response_req |
| } [packed] |
| |
| usbfuzz_response_req [ |
| random usbfuzz_response_req_random |
| hub_status usbfuzz_response_req_get_status_hub |
| port_status usbfuzz_response_req_get_status_port |
| aiptek_get_report usbfuzz_response_req_aiptek_get_report |
| aiptek_set_report usbfuzz_response_req_aiptek_set_report |
| cdc_ncm_ntb_parameters usbfuzz_response_req_cdc_get_ntb_parameters |
| ] [varlen] |
| |
| usbfuzz_response_req_random { |
| type flags[usb_request_types, int8] |
| resp array[int8, 0:64] |
| } [packed] |
| |
| usb_request_types = USB_REQ_GET_STATUS, USB_REQ_CLEAR_FEATURE, USB_REQ_SET_FEATURE, USB_REQ_SET_ADDRESS, USB_REQ_GET_DESCRIPTOR, USB_REQ_SET_DESCRIPTOR, USB_REQ_GET_CONFIGURATION, USB_REQ_SET_CONFIGURATION, USB_REQ_GET_INTERFACE, USB_REQ_SET_INTERFACE, USB_REQ_SYNCH_FRAME, USB_REQ_SET_SEL, USB_REQ_SET_ISOCH_DELAY, USB_REQ_SET_ENCRYPTION, USB_REQ_GET_ENCRYPTION, USB_REQ_RPIPE_ABORT, USB_REQ_SET_HANDSHAKE, USB_REQ_RPIPE_RESET, USB_REQ_GET_HANDSHAKE, USB_REQ_SET_CONNECTION, USB_REQ_SET_SECURITY_DATA, USB_REQ_GET_SECURITY_DATA, USB_REQ_SET_WUSB_DATA, USB_REQ_LOOPBACK_DATA_WRITE, USB_REQ_LOOPBACK_DATA_READ, USB_REQ_SET_INTERFACE_DS, USB_REQ_GET_PARTNER_PDO, USB_REQ_GET_BATTERY_STATUS, USB_REQ_SET_PDO, USB_REQ_GET_VDM, USB_REQ_SEND_VDM |
| |
| usbfuzz_response_req_get_status_hub { |
| type const[USB_REQ_GET_STATUS, int8] |
| resp usb_hub_status |
| } [packed] |
| |
| usbfuzz_response_req_get_status_port { |
| type const[USB_REQ_GET_STATUS, int8] |
| resp usb_port_status |
| } [packed] |
| |
| usbfuzz_response_req_aiptek_get_report { |
| type const[0x1, int8] |
| resp array[int8, 3] |
| } [packed] |
| |
| usbfuzz_response_req_aiptek_set_report { |
| type const[0x9, int8] |
| resp array[int8, 3] |
| } [packed] |
| |
| usbfuzz_response_req_cdc_get_ntb_parameters { |
| type const[USB_CDC_GET_NTB_PARAMETERS, int8] |
| resp usb_cdc_ncm_ntb_parameters |
| } [packed] |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| |
| usbfuzz_responses_gen { |
| length bytesize[responses, int64] |
| responses array[usbfuzz_response_gen_packed, 0:8] |
| } [packed] |
| |
| usbfuzz_response_gen_packed { |
| length bytesize[resp, int64] |
| repeat int8[0:1] |
| resp usbfuzz_response_gen |
| } [packed] |
| |
| usbfuzz_response_gen { |
| random usbfuzz_response_gen_random |
| } [packed] |
| |
| usbfuzz_response_gen_random { |
| type const[0, int8] |
| resp array[int8, 0:64] |
| } [packed] |
| |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |