Permalink
Browse files

gimx-loader: improve adapter adapter detection #590

  • Loading branch information...
matlo committed Aug 30, 2018
1 parent c8fbf92 commit a4dd0f212912964ccd1575e506da12060264ca3a
Showing with 9 additions and 6 deletions.
  1. +9 −6 loader/gimx-loader.cpp
View
@@ -222,24 +222,27 @@ void loaderFrame::OnButtonLoadClick(wxCommandEvent& event __attribute__((unused)
wxWindowDisabler disableAll;
wxBusyInfo wait(_("Unplug/replug the USB cable from/to computer USB port."));
for (count = 0; count < 40; ++count) {
for (count = 0; count < 1000; ++count) {
for (i = 0; i < MAX_PORT_NB; ++i) {
if (ports[i] == 0) {
if (check_port(i) != -1) {
break;
int found = check_port(i);
if (found != -1) {
if (ports[i] == 0) {
break; // found
}
} else {
ports[i] = 0; // removed
}
}
if (i < MAX_PORT_NB) {
break;
}
usleep(250000);
usleep(10000); // we need to be aggressive to detect removal
wxTheApp->Yield();
}
}
if (count == 40) {
if (count == 1000) {
wxMessageBox(_("No new device found within 10 seconds."), _("Error"), wxICON_ERROR);
ButtonLoad->Enable(true);
return;

0 comments on commit a4dd0f2

Please sign in to comment.