From 867d83c21536ed7e13f32f2a3a152302e784b742 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Thu, 20 Oct 2022 12:27:59 +0200 Subject: [PATCH] Print error message if no HID device is connected when using hidapi --- src/usb_hidapi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/usb_hidapi.c b/src/usb_hidapi.c index 4ad372b1..4ddb80e3 100644 --- a/src/usb_hidapi.c +++ b/src/usb_hidapi.c @@ -93,8 +93,10 @@ static int usbhid_open(const char *port, union pinfo pinfo, union filedescriptor */ struct hid_device_info *list, *walk; list = hid_enumerate(pinfo.usbinfo.vid, pinfo.usbinfo.pid); - if (list == NULL) - return -1; + if (list == NULL) { + pmsg_error("No USB HID devices found\n"); + return -1; + } walk = list; while (walk)