add webusb support

This commit is contained in:
sakimisu
2023-01-29 16:15:28 +08:00
parent 68c9779898
commit 201b3ebb2c
4 changed files with 91 additions and 0 deletions

View File

@@ -821,6 +821,19 @@ static int usbd_vendor_request_handler(struct usb_setup_packet *setup, uint8_t *
return -1;
}
}
} else if (usbd_core_cfg.descriptors->webusb_url_descriptor) {
if (setup->bRequest == usbd_core_cfg.descriptors->webusb_url_descriptor->vendor_code) {
switch (setup->wIndex) {
case WINUSB_REQUEST_GET_DESCRIPTOR_SET:
USB_LOG_INFO("GET Webusb url Descriptor\r\n");
*data = (uint8_t *)usbd_core_cfg.descriptors->webusb_url_descriptor->string;
*len = usbd_core_cfg.descriptors->webusb_url_descriptor->string_len;
return 0;
default:
USB_LOG_ERR("unknown vendor code\r\n");
return -1;
}
}
}
#else
if (msosv1_desc) {

View File

@@ -72,6 +72,7 @@ struct usb_descriptor {
const char **string_descriptor;
struct usb_msosv1_descriptor *msosv1_descriptor;
struct usb_msosv2_descriptor *msosv2_descriptor;
struct usb_webusb_url_ex_descriptor *webusb_url_descriptor;
struct usb_bos_descriptor *bos_descriptor;
};