+ fprintf(stdout, "\nConnected units:\n");
+
+ for (int i = 0; i < iUnit; i++)
+ fprintf(stdout, "\t%d. SN: %s\n", i+1, units[i].serial_number);
+
+ if (iUnit > 1) {
+ while (iSelection < 1 || iSelection > iUnit) {
+ fprintf(stdout, "Which unit do you want to connect to? ");
+ fscanf(stdin, "%d", &iSelection);
+ }
+ }
+ else
+ iSelection = 1;
+ iSelection --;
+
+ for (int i = 0; i < iUnit; i++) {
+ if (iSelection == i) continue;
+ usb_close(units[i].handle);
+ units[i].handle = NULL;