From 8b600043624be978c2f83d257864cf1c956cd812 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Mon, 11 Sep 2023 18:54:50 +0200 Subject: [PATCH] parse: do not ask to run as root if not needed On macOS it is expected to get the error: idVendor: 0x0B05 Can't get iManufacturer string: LIBUSB_ERROR_INVALID_PARAM idProduct: 0x1825 Can't get iProduct string: LIBUSB_ERROR_INVALID_PARAM Running as root does not solve the problem. So need to fail and ask to re-run as root in that case. --- src/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse.c b/src/parse.c index 0879901c..77c6dc1c 100644 --- a/src/parse.c +++ b/src/parse.c @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) { (void)fprintf(stderr, " Can't get iManufacturer string: %s\n", libusb_error_name(r)); - if (getuid()) + if (r != LIBUSB_ERROR_INVALID_PARAM && getuid()) { (void)fprintf(stderr, BRIGHT_RED "Please, restart the command as root\n" NORMAL);