Skip to content

Commit

Permalink
WIP rebuild descriptors on USB reset
Browse files Browse the repository at this point in the history
  • Loading branch information
tlyu committed Feb 5, 2023
1 parent b1e1c58 commit 0f3c54e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cores/arduino/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ void handleReset(usb_dev *usbd)
USBCore().nreset++;
USBCore().setupClass(0);
EPBuffers().init();
USBCore().buildDeviceConfigDescriptor();
if (resetHook) {
resetHook();
}
Expand Down Expand Up @@ -769,7 +770,6 @@ void USBCore_::logStatus(const char *status)

void USBCore_::connect()
{
USBCore().buildDeviceConfigDescriptor();
usb_connect();
}

Expand Down
4 changes: 2 additions & 2 deletions cores/arduino/USBCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ class USBCore_
static void transcOutHelper(usb_dev* usbd, uint8_t ep);
static void transcInHelper(usb_dev* usbd, uint8_t ep);

void buildDeviceConfigDescriptor();

/*
* Shadow the global ‘usbd’, which shouldn't be used directly,
* so that all access is mediated by this class, ensuring all
Expand Down Expand Up @@ -230,8 +232,6 @@ class USBCore_
void transcOut(usb_dev* usbd, uint8_t ep);
void transcIn(usb_dev* usbd, uint8_t ep);

void buildDeviceConfigDescriptor();

void sendZLP(usb_dev* usbd, uint8_t ep);
};

Expand Down

0 comments on commit 0f3c54e

Please sign in to comment.