[PATCH edid-decode 1/3] Do the EDID version parsing before anything else

walter harms wharms at bfs.de
Wed Dec 21 01:23:43 PST 2011



Am 20.12.2011 22:17, schrieb Tormod Volden:
> From: Tormod Volden <debian.tormod at gmail.com>
> 
> So that the version conformance flags can be used in other code.
> 
> Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
> ---
>  edid-decode.c |   38 +++++++++++++++++++-------------------
>  1 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/edid-decode.c b/edid-decode.c
> index ab4bde8..c3e556f 100644
> --- a/edid-decode.c
> +++ b/edid-decode.c
> @@ -944,6 +944,25 @@ int main(int argc, char **argv)
>  	// return 1;
>      }
>  
> +    printf("EDID version: %hd.%hd\n", edid[0x12], edid[0x13]);
> +    if (edid[0x12] == 1) {
> +	if (edid[0x13] > 4) {
> +	    printf("Claims > 1.4, assuming 1.4 conformance\n");
> +	    edid[0x13] = 4;
> +	}

I have  learned that changing the original data can lead to
fatal consequences later on. It may not a problem now but could
you store edid[0x13] in revesion_id or so ?
That would improve readability and keep the data in the original state.


> +	switch (edid[0x13]) {
> +	case 4:
> +	    claims_one_point_four = 1;
> +	case 3:
> +	    claims_one_point_three = 1;
> +	case 2:
> +	    claims_one_point_two = 1;
> +	default:
> +	    break;
> +	}
> +	claims_one_point_oh = 1;
> +    }
> +

Is the fall thou intended here ? If yes a small comment would help.
re,
 wh

>      printf("Manufacturer: %s Model %x Serial Number %u\n",
>  	    manufacturer_name(edid + 0x08),
>  	    (unsigned short)(edid[0x0A] + (edid[0x0B] << 8)),
> @@ -967,25 +986,6 @@ int main(int argc, char **argv)
>  	}
>      }
>  
> -    printf("EDID version: %hd.%hd\n", edid[0x12], edid[0x13]);
> -    if (edid[0x12] == 1) {
> -	if (edid[0x13] > 4) {
> -	    printf("Claims > 1.4, assuming 1.4 conformance\n");
> -	    edid[0x13] = 4;
> -	}
> -	switch (edid[0x13]) {
> -	case 4:
> -	    claims_one_point_four = 1;
> -	case 3:
> -	    claims_one_point_three = 1;
> -	case 2:
> -	    claims_one_point_two = 1;
> -	default:
> -	    break;
> -	}
> -	claims_one_point_oh = 1;
> -    }
> -
>      /* display section */
>  
>      if (edid[0x14] & 0x80) {


More information about the xorg-devel mailing list