[WIP] Support MX Master with DPI adjustment support (#208)

It's not known whether the DPI ranges can be queried, so let's set
hard-code some values for now. Step size is 200. Does this need to
be changed?

TODO: need a capture of whether this is really a read function.
This commit is contained in:
Peter Wu 2015-05-31 11:01:46 +02:00
parent a515cc3860
commit 5ba816dd38
2 changed files with 27 additions and 1 deletions

View File

@ -90,6 +90,7 @@ def _D(name, codename=None, kind=None, wpid=None, protocol=None, registers=None,
#
_PERFORMANCE_MX_DPIS = _NamedInts.range(0x81, 0x8F, lambda x: str((x - 0x80) * 100))
_MX_MASTER_DPIS = _NamedInts.range(400, 1600, step=200)
#
#
@ -266,6 +267,12 @@ _D('Performance Mouse MX', codename='Performance MX', protocol=1.0, wpid='101A',
],
)
_D('Wireless Mouse MX Master', codename='MX Master', protocol=4.5, wpid='4041',
settings=[
_FS.dpi(choices=_MX_MASTER_DPIS),
],
)
_D('G7 Cordless Laser Mouse', codename='G7', protocol=1.0, wpid='1002',
registers=(_R.battery_status, ),
)

View File

@ -70,6 +70,16 @@ def feature_toggle(name, feature,
rw = _FeatureRW(feature, read_function_id, write_function_id)
return _Setting(name, rw, validator, label=label, description=description, device_kind=device_kind)
def feature_choices(name, feature, choices,
read_function_id=_FeatureRW.default_read_fnid,
write_function_id=_FeatureRW.default_write_fnid,
kind=_KIND.choice,
label=None, description=None, device_kind=None):
assert choices
validator = _ChoicesV(choices)
rw = _FeatureRW(feature, read_function_id, write_function_id)
return _Setting(name, rw, validator, kind=kind, label=label, description=description, device_kind=device_kind)
#
# common strings for settings
#
@ -135,6 +145,15 @@ def _feature_smooth_scroll():
label=_SMOOTH_SCROLL[1], description=_SMOOTH_SCROLL[2],
device_kind=_DK.mouse)
def _feature_adjustable_dpi(register=_R.mouse_dpi, choices=None):
"""Pointer Speed feature"""
return feature_choices(_DPI[0], _F.ADJUSTABLE_DPI, choices,
# TODO: is this really the read function?
read_function_id=0x20,
write_function_id=0x30,
label=_DPI[1], description=_DPI[2],
device_kind=_DK.mouse)
#
#
#
@ -165,7 +184,7 @@ FeatureSettings = _SETTINGS_LIST(
new_fn_swap=_feature_new_fn_swap,
smooth_scroll=_feature_smooth_scroll,
side_scroll=None,
dpi=None,
dpi=_feature_adjustable_dpi,
hand_detection=None,
typing_illumination=None,
)