hidapi: upgrade debugging in udev

This commit is contained in:
Peter F. Patel-Schneider 2024-02-19 09:14:53 -05:00
parent ad110498a6
commit 50ddb54466
1 changed files with 7 additions and 1 deletions

View File

@ -99,6 +99,8 @@ def exit():
# It is given the bus id, vendor id, and product id and returns a dictionary # 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. # with the required hid_driver and usb_interface and whether this is a receiver or device.
def _match(action, device, filterfn): def _match(action, device, filterfn):
if logger.isEnabledFor(logging.DEBUG):
logger.debug(f'Dbus event {action} {device}')
hid_device = device.find_parent('hid') hid_device = device.find_parent('hid')
if not hid_device: # only HID devices are of interest to Solaar if not hid_device: # only HID devices are of interest to Solaar
return return
@ -125,7 +127,7 @@ def _match(action, device, filterfn):
return return
except Exception as e: # if can't process report descriptor fall back to old scheme except Exception as e: # if can't process report descriptor fall back to old scheme
hidpp_short = hidpp_long = None 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 '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) GLib.io_add_watch(m, GLib.IO_IN, _process_udev_event, callback, filterfn)
# print ("did io_add_watch") # print ("did io_add_watch")
if logger.isEnabledFor(logging.DEBUG):
logger.debug('Starting dbus monitoring')
m.start() m.start()
@ -293,6 +297,8 @@ def enumerate(filterfn):
:returns: a list of matching ``DeviceInfo`` tuples. :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'): for dev in _Context().list_devices(subsystem='hidraw'):
dev_info = _match('add', dev, filterfn) dev_info = _match('add', dev, filterfn)
if dev_info: if dev_info: