From 7c7efa2089e25dbfdada47f450e01ae7eed2c11d Mon Sep 17 00:00:00 2001 From: Shane Fagan Date: Fri, 3 Apr 2026 18:41:48 +0100 Subject: [PATCH] Fix the write_key_value for dpi_extended I was playing with the branch from the MR and I wanted to fix the cli stuff, it now properly sets when I use: solaar config 1 dpi_extended X 400 Should be enough Signed-off-by: Shane Fagan --- lib/logitech_receiver/settings_templates.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index 3a47a961..95694f47 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -20,13 +20,11 @@ import logging import socket import struct import traceback - from time import time from typing import Callable from typing import Protocol from solaar.i18n import _ - from . import base from . import common from . import descriptors @@ -1055,10 +1053,15 @@ class ExtendedAdjustableDpi(settings.Setting): keys = common.NamedInts(X=0, Y=1, LOD=2) def write_key_value(self, key, value, save=True): + # Force a read to populate the full X/Y/LOD dictionary if it's missing (fixes CLI) + if not isinstance(self._value, dict): + self.read() + if isinstance(self._value, dict): self._value[key] = value else: self._value = {key: value} + result = self.write(self._value, save) return result[key] if isinstance(result, dict) else result