Skip to content

Commit 023906d

Browse files
committed
drivers/usb-common.c: add debug tracing [#2270]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 2af874b commit 023906d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/usb-common.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,39 @@ int is_usb_device_supported(usb_device_id_t *usb_device_id_list, USBDevice_t *de
2626
int retval = NOT_SUPPORTED;
2727
usb_device_id_t *usbdev;
2828

29+
upsdebugx(3, "%s: checking if this driver can support USB device VID:PID 0x%04X:0x%04X",
30+
__func__, (unsigned int)device->VendorID, (unsigned int)device->ProductID);
31+
2932
for (usbdev = usb_device_id_list;
3033
(usbdev->vendorID != 0 || usbdev->productID != 0 || usbdev->fun != NULL);
3134
usbdev++
3235
) {
36+
upsdebugx(4, "%s: checking table entry for VID:PID 0x%04X:0x%04X "
37+
"(custom init handler is%s available)",
38+
__func__, (unsigned int)usbdev->vendorID,
39+
(unsigned int)usbdev->productID,
40+
(usbdev->fun == NULL ? " NOT" : ""));
41+
3342
if (usbdev->vendorID != device->VendorID) {
43+
upsdebugx(4, "%s: NOT_SUPPORTED: vendor ID mismatch", __func__);
3444
continue;
3545
}
3646

3747
/* flag as possibly supported if we see a known vendor */
3848
retval = POSSIBLY_SUPPORTED;
3949

50+
upsdebugx(4, "%s: POSSIBLY_SUPPORTED: known vendor ID at least", __func__);
4051
if (usbdev->productID != device->ProductID) {
4152
continue;
4253
}
4354

4455
/* call the specific handler, if it exists */
4556
if (usbdev->fun != NULL) {
57+
upsdebugx(4, "%s: call the custom init handler", __func__);
4658
(*usbdev->fun)(device);
4759
}
4860

61+
upsdebugx(4, "%s: SUPPORTED: known vendor and product IDs", __func__);
4962
return SUPPORTED;
5063
}
5164

0 commit comments

Comments
 (0)