Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions teensy_loader_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ int main(int argc, char **argv)
filename, num, (double)num / (double)code_size * 100.0);
}

// if teensy_reboot was called before and this gets called immediately
// after, there's a chance that the teensy is in the middle of rebooting.
// if we attempt teensy_open() at that moment we'll end up with a
// "Resource temporarily unavailable" error which won't go away anymore.
// delaying for 1 s before attempting to connect resolves this problem
// completely as it gives the teensy enough time to reboot and linux to
// connect to it.
delay(1);
// open the USB device
while (1) {
if (teensy_open()) break;
Expand Down