summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakimisu <[email protected]>2022-11-28 21:56:30 +0800
committersakimisu <[email protected]>2022-11-28 21:56:30 +0800
commit16f55a5a195b1283cdb0a56eb29807a05eeb96b0 (patch)
treeef16e0da873b92515fdf0e01f3accc28bd904576
parentc2d34d10a4838d0d24145dd0f7adc69c0652b90e (diff)
split other_speed with fs and hs
-rw-r--r--core/usbd_core.c20
-rw-r--r--core/usbd_core.h3
2 files changed, 17 insertions, 6 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c
index 6689e1e8..2fc8a363 100644
--- a/core/usbd_core.c
+++ b/core/usbd_core.c
@@ -218,12 +218,22 @@ static bool usbd_get_descriptor(uint16_t type_index, uint8_t **data, uint32_t *l
break;
case USB_DESCRIPTOR_TYPE_OTHER_SPEED:
- if (usbd_core_cfg.descriptors->other_speed_descriptor) {
- *data = (uint8_t *)usbd_core_cfg.descriptors->other_speed_descriptor;
- *len = (usbd_core_cfg.descriptors->other_speed_descriptor[CONF_DESC_wTotalLength] |
- (usbd_core_cfg.descriptors->other_speed_descriptor[CONF_DESC_wTotalLength] << 8));
+ if (usbd_core_cfg.speed == USB_SPEED_HIGH) {
+ if (usbd_core_cfg.descriptors->fs_other_speed_descriptor) {
+ *data = (uint8_t *)usbd_core_cfg.descriptors->fs_other_speed_descriptor;
+ *len = (usbd_core_cfg.descriptors->fs_other_speed_descriptor[CONF_DESC_wTotalLength] |
+ (usbd_core_cfg.descriptors->fs_other_speed_descriptor[CONF_DESC_wTotalLength] << 8));
+ } else {
+ found = false;
+ }
} else {
- found = false;
+ if (usbd_core_cfg.descriptors->hs_other_speed_descriptor) {
+ *data = (uint8_t *)usbd_core_cfg.descriptors->hs_other_speed_descriptor;
+ *len = (usbd_core_cfg.descriptors->hs_other_speed_descriptor[CONF_DESC_wTotalLength] |
+ (usbd_core_cfg.descriptors->hs_other_speed_descriptor[CONF_DESC_wTotalLength] << 8));
+ } else {
+ found = false;
+ }
}
break;
diff --git a/core/usbd_core.h b/core/usbd_core.h
index 61590c82..fd9a177c 100644
--- a/core/usbd_core.h
+++ b/core/usbd_core.h
@@ -67,7 +67,8 @@ struct usb_descriptor {
const uint8_t **fs_config_descriptor;
const uint8_t **hs_config_descriptor;
const uint8_t *device_quality_descriptor;
- const uint8_t *other_speed_descriptor;
+ const uint8_t *fs_other_speed_descriptor;
+ const uint8_t *hs_other_speed_descriptor;
const char **string_descriptor;
struct usb_msosv1_descriptor *msosv1_descriptor;
struct usb_msosv2_descriptor *msosv2_descriptor;