summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2024-07-30 17:45:32 +0800
committersakumisu <[email protected]>2024-07-30 17:46:02 +0800
commit564d568732e2ce65b28b64c26864ed3a48db7895 (patch)
tree30d3a5baee18b839a9e51c4462dca9101364423b
parent9394f1f8d638ad8dd2c07328964f568a05ea12ff (diff)
fix(core/usbd_core): fix self powered check
-rw-r--r--core/usbd_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c
index fc2aa6ac..8fdee7bf 100644
--- a/core/usbd_core.c
+++ b/core/usbd_core.c
@@ -181,7 +181,7 @@ static bool usbd_get_descriptor(uint8_t busid, uint16_t type_index, uint8_t **da
}
desc_len = ((desc[CONF_DESC_wTotalLength]) | (desc[CONF_DESC_wTotalLength + 1] << 8));
- g_usbd_core[busid].self_powered = (desc[7] & USB_CONFIG_SELF_POWERED) ? true : false;
+ g_usbd_core[busid].self_powered = (desc[7] & USB_CONFIG_POWERED_MASK) ? true : false;
g_usbd_core[busid].remote_wakeup_support = (desc[7] & USB_CONFIG_REMOTE_WAKEUP) ? true : false;
break;
case USB_DESCRIPTOR_TYPE_STRING:
@@ -346,7 +346,7 @@ static bool usbd_get_descriptor(uint8_t busid, uint16_t type_index, uint8_t **da
*len = (p[CONF_DESC_wTotalLength]) |
(p[CONF_DESC_wTotalLength + 1] << 8);
- g_usbd_core[busid].self_powered = (p[7] & USB_CONFIG_SELF_POWERED) ? true : false;
+ g_usbd_core[busid].self_powered = (p[7] & USB_CONFIG_POWERED_MASK) ? true : false;
g_usbd_core[busid].remote_wakeup_support = (p[7] & USB_CONFIG_REMOTE_WAKEUP) ? true : false;
} else {
/* normally length is at offset 0 */