def _convert_to_dict(caps_str: str) -> dict:
    """
    Parses the VCP capabilities string to a dictionary.
    Non continuous capabilities will include an array of
    all supported values.

    Returns:
        Dict with all capabilities in hex

    Example:
        Expected string "04 14(05 06) 16" is converted to::

            {
                0x04: [],
                0x14: [0x05, 0x06],
                0x16: [],
            }
    """

    if len(caps_str) == 0:
        # Sometimes the keys arent found and the extracting of
        # capabilities returns an empty string.
        return {}

    result_dict = {}
    group = None
    prev_digit = None
    for chunk in caps_str.replace("(", " ( ").replace(")", " ) ").split(" "):
        if chunk == "":
            continue
        elif chunk == "(":
            group = prev_digit
        elif chunk == ")":
            group = None
        else:
            val = int(chunk, 16)
            if group is None:
                result_dict[val] = []
            else:
                result_dict[group].append(val)
            prev_digit = val

    return result_dict