[igt-dev] [PATCH i-g-t] chamelium: Ignore errors when fetching AdapterAllowed

Knop, Ryszard ryszard.knop at intel.com
Wed Jan 4 13:01:58 UTC 2023


On Tue, 2023-01-03 at 15:30 +0200, Petri Latvala wrote:
> Not setting AdapterAllowed in .igtrc should be considered a valid
> configuration. The default value of 'false' from
> g_key_file_get_boolean when the field is missing is exactly what we
> want to use, and storing the missing field error in the 'error'
> variable leads to an error such as
> 
> (kms_chamelium:1713) igt_chamelium-WARNING: Failed to read chamelium port ID for DP-3: Key file does not have key “AdapterAllowed” in group “Chamelium:HDMI-A-2”
> 
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Ryszard Knop <ryszard.knop at intel.com>
> ---
>  lib/igt_chamelium.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> index 79920de1..6506330e 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -2477,7 +2477,7 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium,
>  		}
>  
>  		port->adapter_allowed = g_key_file_get_boolean(igt_key_file, group,
> -		                                               "AdapterAllowed", &error);
> +		                                               "AdapterAllowed", NULL);

Maybe it'd be nicer if it checked if the key is there in the first
place, so that something like "AdapterAllowed=yes" still fails loudly.
Like:

if (g_key_file_has_key(igt_key_file, group, "AdapterAllowed", NULL)) {
    port->adapter_allowed = ...;
}

>  
>  		for (j = 0;
>  		     j < res->count_connectors && !port->connector_id;

Thanks, Ryszard



More information about the igt-dev mailing list