diff --git a/lib/logitech_receiver/settings.py b/lib/logitech_receiver/settings.py index 3bea5dfc..d6de4ed0 100644 --- a/lib/logitech_receiver/settings.py +++ b/lib/logitech_receiver/settings.py @@ -1118,7 +1118,19 @@ class MultipleRangeValidator(Validator): return w + b'\xFF' def acceptable(self, args, current): - pass # not implemented yet + # just one item, with at least one sub-item + if not isinstance(args, list) or len(args) != 2 or not isinstance(args[1], dict): + return None + item = next((p for p in self.items if p.id == args[0] or str(p) == args[0]), None) + if not item: + return None + for sub_key, value in args[1].items(): + sub_item = next((it for it in self.sub_items[item] if it.id == sub_key), None) + if not sub_item: + return None + if not isinstance(value, int) or not (sub_item.minimum <= value <= sub_item.maximum): + return None + return [str(int(item)), {**args[1]}] class ActionSettingRW: diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index 65fa2700..40450345 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -947,7 +947,10 @@ class Gesture2Params(_LongSettings): description = _('Change numerical parameters of a mouse/touchpad.') feature = _F.GESTURE_2 rw_options = {'read_fnid': 0x70, 'write_fnid': 0x80} - choices_universe = None + choices_universe = _hidpp20.PARAM + sub_items_universe = _hidpp20.SUB_PARAM + # item (NamedInt) -> list/tuple of objects that have the following attributes + # .id (sub-item text), .length (in bytes), .minimum and .maximum _labels = _GESTURE2_PARAMS_LABELS _labels_sub = _GESTURE2_PARAMS_LABELS_SUB