(setting_info, value, selected_preset=None)
return merge_bytes(dpi_count, selected_preset, output_values)
Called by the :class:`rivalcfg.mouse.Mouse` class when processing a
    "range" type setting.

    :param dict setting_info: The information dict of the setting from the
                              device profile.
    :param value: The input value.
    :param int selected_preset: The DPI preset to select (0 is always the
                                first preset).
    :rtype: list[int]
Called by the :class:`rivalcfg.mouse.Mouse` class when processing a
    "range" type setting.
Called by the : class : rivalcfg . mouse . Mouse class when processing a range type setting .
def process_value(setting_info, value, selected_preset=None):
    """Called by the :class:`rivalcfg.mouse.Mouse` class when processing a
    "range" type setting.

    :param dict setting_info: The information dict of the setting from the
                              device profile.
    :param value: The input value.
    :param int selected_preset: The DPI preset to select (0 is always the
                                first preset).
    :rtype: list[int]
    """
    dpis = []

    if type(value) in (int, float):
        dpis = [int(value)]
    elif type(value) in (list, tuple):
        dpis = [int(dpi) for dpi in value]
    else:
        dpis = [int(dpi) for dpi in value.replace(" ", "").split(",")]

    # Selected preset

    if selected_preset is None:
        selected_preset = setting_info["first_preset"]
    else:
        selected_preset += setting_info["first_preset"]

    # checks

    if len(dpis) == 0:
        raise ValueError("you must provide at least one preset")

    if len(dpis) > setting_info["max_preset_count"]:
        raise ValueError(
            "you provided %i preset but the device accepts a maximum of %i presets"
            % (len(dpis), setting_info["max_preset_count"])
        )

    if "first_preset" not in setting_info:
        raise ValueError(
            "Missing 'first_preset' parameter for 'multidpi_range' handler"
        )

    if (
        not setting_info["first_preset"]
        <= selected_preset
        < len(dpis) + setting_info["first_preset"]
    ):
        raise ValueError("the selected preset is out of range")

    if "dpi_length_byte" not in setting_info:
        raise ValueError(
            "Missing 'dpi_length_byte' parameter for 'multidpi_range' handler"
        )

    if "count_mode" not in setting_info:
        raise ValueError("Missing 'count_mode' parameter for 'multidpi_range' handler")

    if setting_info["count_mode"] not in ("number", "flag"):
        raise ValueError(
            "Invalid 'count_mode' parameter '%s'" % setting_info["count_mode"]
        )

    dpi_length = setting_info["dpi_length_byte"]
    count_mode = setting_info["count_mode"]

    # DPIs

    output_values = []

    for dpi in dpis:
        value = process_range(setting_info, dpi)
        value = uint_to_little_endian_bytearray(value, dpi_length)
        output_values = merge_bytes(output_values, value)

    # Count

    dpi_count = len(dpis)

    if count_mode == "flag":
        dpi_count = 0b11111111 >> (8 - dpi_count)

    #

    return merge_bytes(dpi_count, selected_preset, output_values)
def process_value ( setting_info , value , selected_preset = None ) : dpis = [ ] if type ( value ) in ( int , float ) : dpis = [ int ( value ) ] elif type ( value ) in ( list , tuple ) : dpis = [ int ( dpi ) for dpi in value ] else : dpis = [ int ( dpi ) for dpi in value . replace ( " " , "" ) . split ( "," ) ] # Selected preset if selected_preset is None : selected_preset = setting_info [ "first_preset" ] else : selected_preset += setting_info [ "first_preset" ] # checks if len ( dpis ) == 0 : raise ValueError ( "you must provide at least one preset" ) if len ( dpis ) > setting_info [ "max_preset_count" ] : raise ValueError ( "you provided %i preset but the device accepts a maximum of %i presets" % ( len ( dpis ) , setting_info [ "max_preset_count" ] ) ) if "first_preset" not in setting_info : raise ValueError ( "Missing 'first_preset' parameter for 'multidpi_range' handler" ) if ( not setting_info [ "first_preset" ] <= selected_preset < len ( dpis ) + setting_info [ "first_preset" ] ) : raise ValueError ( "the selected preset is out of range" ) if "dpi_length_byte" not in setting_info : raise ValueError ( "Missing 'dpi_length_byte' parameter for 'multidpi_range' handler" ) if "count_mode" not in setting_info : raise ValueError ( "Missing 'count_mode' parameter for 'multidpi_range' handler" ) if setting_info [ "count_mode" ] not in ( "number" , "flag" ) : raise ValueError ( "Invalid 'count_mode' parameter '%s'" % setting_info [ "count_mode" ] ) dpi_length = setting_info [ "dpi_length_byte" ] count_mode = setting_info [ "count_mode" ] # DPIs output_values = [ ] for dpi in dpis : value = process_range ( setting_info , dpi ) value = uint_to_little_endian_bytearray ( value , dpi_length ) output_values = merge_bytes ( output_values , value ) # Count dpi_count = len ( dpis ) if count_mode == "flag" : dpi_count = 0b11111111 >> ( 8 - dpi_count ) # return merge_bytes ( dpi_count , selected_preset , output_values )