diff --git a/lib/logitech/unifying_receiver/hidpp10.py b/lib/logitech/unifying_receiver/hidpp10.py index e5bd4349..f78fcc75 100644 --- a/lib/logitech/unifying_receiver/hidpp10.py +++ b/lib/logitech/unifying_receiver/hidpp10.py @@ -177,7 +177,8 @@ def get_firmware(device): def get_notification_flags(device): - if device.kind: + if device.kind is not None: + # peripherals with protocol >= 2.0 don't support registers p = device.protocol if p is None or p >= 2.0: return @@ -189,7 +190,8 @@ def get_notification_flags(device): def set_notification_flags(device, *flag_bits): - if device.kind: + if device.kind is not None: + # peripherals with protocol >= 2.0 don't support registers p = device.protocol if p is None or p >= 2.0: return diff --git a/lib/logitech/unifying_receiver/listener.py b/lib/logitech/unifying_receiver/listener.py index 37e78db1..647922e2 100644 --- a/lib/logitech/unifying_receiver/listener.py +++ b/lib/logitech/unifying_receiver/listener.py @@ -140,7 +140,7 @@ class EventsListener(_threading.Thread): last_tick = 0 # the first idle read -- delay it a bit, and make sure to stagger # idle reads for multiple receivers - idle_reads = _IDLE_READS * 2 + (ihandle % 3) * 4 + idle_reads = _IDLE_READS * 2 + (ihandle % 5) * 4 while self._active: if self._queued_notifications.empty(): diff --git a/lib/logitech/unifying_receiver/status.py b/lib/logitech/unifying_receiver/status.py index 646c9b48..8186bbeb 100644 --- a/lib/logitech/unifying_receiver/status.py +++ b/lib/logitech/unifying_receiver/status.py @@ -92,7 +92,7 @@ class ReceiverStatus(dict): # make sure to read some stuff that may be read later by the UI r.serial, r.firmware, None - # r.enable_notifications() + # get an update of the notification flags self[KEYS.NOTIFICATION_FLAGS] = _hidpp10.get_notification_flags(r) def process_notification(self, n): diff --git a/lib/solaar/ui/__init__.py b/lib/solaar/ui/__init__.py index 7def7b3a..e3bfcb03 100644 --- a/lib/solaar/ui/__init__.py +++ b/lib/solaar/ui/__init__.py @@ -63,8 +63,7 @@ def destroy(): from logitech.unifying_receiver.status import ALERT def _status_changed(device, alert, reason): assert device is not None - if _log.isEnabledFor(_DEBUG): - _log.debug("status changed: %s, %s, %s", device, alert, reason) + _log.info("status changed: %s, %s, %s", device, alert, reason) tray.update(device) if alert & ALERT.ATTENTION: diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py index e972030f..4394fc61 100644 --- a/lib/solaar/ui/tray.py +++ b/lib/solaar/ui/tray.py @@ -29,11 +29,6 @@ _MENU_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR # # -# for which device to show the battery info in systray, if more than one -_picked_device = None - - - def _create_menu(): menu = Gtk.Menu() @@ -409,6 +404,10 @@ def _update_menu_item(index, device_status): # # +# for which device to show the battery info in systray, if more than one +_picked_device = None + +# cached list of devices and some of their properties _devices_info = [] _menu = None _icon = None diff --git a/lib/solaar/ui/window.py b/lib/solaar/ui/window.py index aa96deba..90f5b869 100644 --- a/lib/solaar/ui/window.py +++ b/lib/solaar/ui/window.py @@ -49,7 +49,7 @@ _UNIFYING_RECEIVER_TEXT = ( '%d paired device(s).\n\nUp to %d devices can be paired to this receiver.', ) _NANO_RECEIVER_TEXT = ( - 'No paired device.\n\n \n ', + 'No paired device.\n\n ', ' \n\nOnly one device can be paired to this receiver.', ) @@ -144,6 +144,7 @@ def _create_details_panel(): p = Gtk.Frame() # p.set_border_width(2) p.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) + p.set_size_request(240, 90) p._text = Gtk.Label() p._text.set_padding(4, 4) @@ -225,7 +226,7 @@ def _create_info_panel(): def _create_tree(model): tree = Gtk.TreeView() - tree.set_size_request(240, 120) + tree.set_size_request(240, 0) tree.set_headers_visible(False) tree.set_show_expanders(False) tree.set_level_indentation(16) @@ -437,6 +438,7 @@ def _update_details(button): if device.kind is None: yield ('Path', device.path) else: + # yield ('Codename', device.codename) hid = device.protocol yield ('Protocol', 'HID++ %1.1f' % hid if hid else 'unknown') if device.polling_rate: @@ -451,11 +453,11 @@ def _update_details(button): flag_bits = device.status.get(_K.NOTIFICATION_FLAGS) if flag_bits is not None: flag_names = ('(none)',) if flag_bits == 0 else _hidpp10.NOTIFICATION_FLAG.flag_names(flag_bits) - yield ('Notifications', ('\n%16s' % ' ').join(flag_names)) + yield ('Notifications', ('\n%15s' % ' ').join(flag_names)) items = _details_items(device) - markup_text = '' + '\n'.join('%-14s: %s' % i for i in items if i) + '' - _details._text.set_markup(markup_text) + text = '\n'.join('%-13s: %s' % i for i in items if i) + _details._text.set_markup('' + text + '') _details.set_visible(visible) @@ -469,7 +471,7 @@ def _update_receiver_panel(receiver, panel, buttons, full=False): panel._count.set_markup(_UNIFYING_RECEIVER_TEXT[1] % (devices_count, receiver.max_devices)) else: if devices_count == 0: - panel._count.set_text(_NANO_RECEIVER_TEXT[0]) + panel._count.set_markup(_NANO_RECEIVER_TEXT[0]) else: panel._count.set_markup(_NANO_RECEIVER_TEXT[1])