summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-06-01 13:40:18 +0700
committerhathach <[email protected]>2020-06-01 13:40:18 +0700
commite92118635cc8055a5ca599eaf9919d99a55bf584 (patch)
treeae4bcf845d374949fe20fecc465933dc1115caec /src/device
parent710c54f8cbee2134334262cf872f538909b264c5 (diff)
adding speed detect on bus reset
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 275792ab9..eeb5011ec 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -40,7 +40,8 @@
//--------------------------------------------------------------------+
// Device Data
//--------------------------------------------------------------------+
-typedef struct {
+typedef struct
+{
struct TU_ATTR_PACKED
{
volatile uint8_t connected : 1;
@@ -53,6 +54,8 @@ typedef struct {
uint8_t self_powered : 1; // configuration descriptor's attribute
};
+ uint8_t speed;
+
uint8_t itf2drv[16]; // map interface number to driver (0xff is invalid)
uint8_t ep2drv[8][2]; // map endpoint to driver ( 0xff is invalid )
@@ -384,7 +387,7 @@ void tud_task (void)
{
case DCD_EVENT_BUS_RESET:
usbd_reset(event.rhport);
- // TODO DCD should report operational speed (LS/FS/HS)
+ _usbd_dev.speed = event.bus_reset.speed;
break;
case DCD_EVENT_UNPLUGGED: