Fix duplicate scale detection in find_nth_scale

This commit is contained in:
Eric Jiang 2025-05-30 17:13:24 -04:00
parent efccef3334
commit 219c9b4ec2

View File

@ -463,8 +463,8 @@ static libusb_device* find_nth_scale(libusb_device **devs, int index)
uint16_t last_device_address = 0; uint16_t last_device_address = 0;
// //
// Loop through each USB device, and for each device, loop through the // Loop through each USB device and check if it's one of the
// scales list to see if it's one of our listed scales. // supported scales listed in scales.h.
// //
while ((dev = devs[i++]) != NULL) { while ((dev = devs[i++]) != NULL) {
@ -474,8 +474,6 @@ static libusb_device* find_nth_scale(libusb_device **devs, int index)
fprintf(stderr, "failed to get device descriptor"); fprintf(stderr, "failed to get device descriptor");
return NULL; return NULL;
} }
int i;
for (i = 0; i < NSCALES; i++) {
if (is_scale(desc.idVendor, desc.idProduct)) { if (is_scale(desc.idVendor, desc.idProduct)) {
// Skip this device if it's the same as the last one. // Skip this device if it's the same as the last one.
@ -522,7 +520,6 @@ static libusb_device* find_nth_scale(libusb_device **devs, int index)
} }
} }
} }
}
return NULL; return NULL;
} }