Skip to content

Commit

Permalink
Add small delay before enabling accessory usb gadget
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargjhaveri committed Mar 23, 2024
1 parent 5051975 commit 6e6a1da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aa_wireless_dongle/package/aawg/src/usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void UsbManager::disableGadget(std::string gadgetName) {

void UsbManager::switchToAccessoryGadget() {
disableGadget(defaultGadgetName);
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // 0.1 second, keep the gadget disabled for a short time to let the host recognize the change
enableGadget(accessoryGadgetName);

Logger::instance()->info("USB Manager: Switched to accessory gadget from default\n");
Expand Down Expand Up @@ -107,7 +108,6 @@ bool UsbManager::enableDefaultAndWaitForAccessory(std::chrono::milliseconds time
return true;
});

disableGadget(accessoryGadgetName);
enableGadget(defaultGadgetName);

Logger::instance()->info("USB Manager: Enabled default gadget\n");
Expand Down

0 comments on commit 6e6a1da

Please sign in to comment.