xusb: Fix error reporting on interface claim

There was a mixup of "ret" and "r", so use "r" consistently as
in the rest of the function.

Closes #1636

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
This commit is contained in:
Tormod Volden
2025-04-17 00:27:19 +02:00
parent 083f0cbfe4
commit ed09a92b0b
2 changed files with 9 additions and 11 deletions

View File

@@ -982,25 +982,23 @@ static int test_device(uint16_t vid, uint16_t pid)
libusb_set_auto_detach_kernel_driver(handle, 1);
for (iface = 0; iface < nb_ifaces; iface++)
{
int ret;
printf("\nKernel driver attached for interface %d: ", iface);
ret = libusb_kernel_driver_active(handle, iface);
if (ret == 0)
r = libusb_kernel_driver_active(handle, iface);
if (r == 0)
printf("none\n");
else if (ret == 1)
else if (r == 1)
printf("yes\n");
else if (ret == LIBUSB_ERROR_NOT_SUPPORTED)
else if (r == LIBUSB_ERROR_NOT_SUPPORTED)
printf("(not supported)\n");
else
perr("\n Failed (error %d) %s\n", ret,
libusb_strerror((enum libusb_error) ret));
perr("\n Failed (error %d) %s\n", r,
libusb_strerror((enum libusb_error) r));
printf("\nClaiming interface %d...\n", iface);
r = libusb_claim_interface(handle, iface);
if (r != LIBUSB_SUCCESS) {
perr(" Failed (error %d) %s\n", ret,
libusb_strerror((enum libusb_error) ret));
perr(" Failed (error %d) %s\n", r,
libusb_strerror((enum libusb_error) r));
}
}

View File

@@ -1 +1 @@
#define LIBUSB_NANO 11950
#define LIBUSB_NANO 11951