Skip to content

Commit

Permalink
ui: handle backlight notification
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Feb 6, 2024
1 parent 0ce3b43 commit 2f8a776
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/logitech_receiver/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,14 @@ def _process_feature_notification(device, status, n, feature):
else:
_log.warn('%s: unknown REPROG_CONTROLS %s', device, n)

elif feature == _F.BACKLIGHT2:
if (n.address == 0x00):
level = _unpack('!B', n.data[1:2])[0]
from solaar.ui.config_panel import record_setting # prevent circular import
setting = next((s for s in device.settings if s.name == _st.Backlight2Level.name), None)
if setting:
record_setting(device, setting, [level])

elif feature == _F.REPROG_CONTROLS_V4:
if n.address == 0x00:
if _log.isEnabledFor(_DEBUG):
Expand Down
3 changes: 3 additions & 0 deletions lib/solaar/ui/config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import traceback

from logging import DEBUG as _DEBUG
from logging import WARNING as _WARNING
from logging import getLogger
from threading import Timer as _Timer
Expand Down Expand Up @@ -724,6 +725,8 @@ def record_setting(device, setting, values):


def _record_setting(device, setting, values):
if _log.isEnabledFor(_DEBUG):
_log.debug('on %s changing setting %s to %s', device, setting, values)
if len(values) > 1:
setting.update_key_value(values[0], values[-1])
value = {values[0]: values[-1]}
Expand Down

0 comments on commit 2f8a776

Please sign in to comment.