From 4b4910e375f0f2dc0fcaf4bc50eee0ce9ed60586 Mon Sep 17 00:00:00 2001 From: Jonas Blixt Date: Wed, 6 Dec 2023 22:03:36 +0100 Subject: [PATCH] bugfix: tools: punchboot: libusb_get_string_descriptor_ascii Returns length of the descriptor or a negative number. --- tools/punchboot/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/punchboot/usb.c b/tools/punchboot/usb.c index 2874589f..8715efcf 100644 --- a/tools/punchboot/usb.c +++ b/tools/punchboot/usb.c @@ -83,7 +83,7 @@ static int pb_usb_connect(struct pb_context *ctx) pb_usb_close_handle(priv); - if (rc != 0) + if (rc < 0) continue; if (strcmp((char *)device_serial, priv->device_uuid) != 0) @@ -206,7 +206,7 @@ static int pb_usb_list(struct pb_context *ctx, rc = libusb_get_string_descriptor_ascii( priv->h, desc.iSerialNumber, device_serial, sizeof(device_serial)); - if (rc != 0) + if (rc < 0) continue; pb_usb_close_handle(priv);