@@ -26,26 +26,38 @@ 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 ) {
3443 continue ;
3544 }
3645
3746 /* flag as possibly supported if we see a known vendor */
3847 retval = POSSIBLY_SUPPORTED ;
3948
49+ upsdebugx (4 , "%s: POSSIBLY_SUPPORTED: known vendor ID at least" , __func__ );
4050 if (usbdev -> productID != device -> ProductID ) {
4151 continue ;
4252 }
4353
4454 /* call the specific handler, if it exists */
4555 if (usbdev -> fun != NULL ) {
56+ upsdebugx (4 , "%s: call the custom init handler" , __func__ );
4657 (* usbdev -> fun )(device );
4758 }
4859
60+ upsdebugx (4 , "%s: SUPPORTED: known vendor and product IDs" , __func__ );
4961 return SUPPORTED ;
5062 }
5163
0 commit comments