From 50ddb544666c59e09609715a8ff6708bdbea0b3b Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Mon, 19 Feb 2024 09:14:53 -0500 Subject: [PATCH] hidapi: upgrade debugging in udev --- lib/hidapi/udev.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/hidapi/udev.py b/lib/hidapi/udev.py index 23297678..17b8a970 100644 --- a/lib/hidapi/udev.py +++ b/lib/hidapi/udev.py @@ -99,6 +99,8 @@ def exit(): # It is given the bus id, vendor id, and product id and returns a dictionary # with the required hid_driver and usb_interface and whether this is a receiver or device. def _match(action, device, filterfn): + if logger.isEnabledFor(logging.DEBUG): + logger.debug(f'Dbus event {action} {device}') hid_device = device.find_parent('hid') if not hid_device: # only HID devices are of interest to Solaar return @@ -125,7 +127,7 @@ def _match(action, device, filterfn): return except Exception as e: # if can't process report descriptor fall back to old scheme hidpp_short = hidpp_long = None - logger.warning( + logger.info( 'Report Descriptor not processed for DEVICE %s BID %s VID %s PID %s: %s', device.device_node, bid, vid, pid, e ) @@ -281,6 +283,8 @@ def monitor_glib(callback, filterfn): GLib.io_add_watch(m, GLib.IO_IN, _process_udev_event, callback, filterfn) # print ("did io_add_watch") + if logger.isEnabledFor(logging.DEBUG): + logger.debug('Starting dbus monitoring') m.start() @@ -293,6 +297,8 @@ def enumerate(filterfn): :returns: a list of matching ``DeviceInfo`` tuples. """ + if logger.isEnabledFor(logging.DEBUG): + logger.debug('Starting dbus enumeration') for dev in _Context().list_devices(subsystem='hidraw'): dev_info = _match('add', dev, filterfn) if dev_info: