summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2023-11-13 19:50:45 +0800
committersakumisu <[email protected]>2023-11-13 19:51:53 +0800
commit1c31156a37f0466fa3791a78ce70f081ee141dd5 (patch)
tree70a4913312e83a057ae02a7173d38c41cc9ba341
parente795ab73a03a25b5d0799069cd0de59e146e53b0 (diff)
add ms os request
-rw-r--r--cherryusb_config_template.h3
-rw-r--r--core/usbh_core.c13
2 files changed, 16 insertions, 0 deletions
diff --git a/cherryusb_config_template.h b/cherryusb_config_template.h
index a895fd16..1d1f0556 100644
--- a/cherryusb_config_template.h
+++ b/cherryusb_config_template.h
@@ -115,6 +115,9 @@
//#define CONFIG_USBHOST_GET_STRING_DESC
+// #define CONFIG_USBHOST_MSOS_ENABLE
+#define CONFIG_USBHOST_MSOS_VENDOR_CODE 0x00
+
/* Ep0 max transfer buffer */
#define CONFIG_USBHOST_REQUEST_BUFFER_LEN 512
diff --git a/core/usbh_core.c b/core/usbh_core.c
index abebbd1e..baecb438 100644
--- a/core/usbh_core.c
+++ b/core/usbh_core.c
@@ -629,6 +629,19 @@ int usbh_enumerate(struct usbh_hubport *hport)
goto errout;
}
+#ifdef CONFIG_USBHOST_MSOS_ENABLE
+ setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_VENDOR | USB_REQUEST_RECIPIENT_DEVICE;
+ setup->bRequest = CONFIG_USBHOST_MSOS_VENDOR_CODE;
+ setup->wValue = 0;
+ setup->wIndex = 0x0004;
+ setup->wLength = 16;
+
+ ret = usbh_control_transfer(hport, setup, ep0_request_buffer);
+ if (ret < 0 && (ret != -EPERM)) {
+ USB_LOG_ERR("Failed to get msosv1 compat id,errorcode:%d\r\n", ret);
+ goto errout;
+ }
+#endif
USB_LOG_INFO("Enumeration success, start loading class driver\r\n");
/*search supported class driver*/
for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) {