diff mbox series

edid-decode: Do not print the raw dispaly use case value

Message ID 20240615232253.178102-1-sebastian.wick@redhat.com (mailing list archive)
State New
Headers show
Series edid-decode: Do not print the raw dispaly use case value | expand

Commit Message

Sebastian Wick June 15, 2024, 11:22 p.m. UTC
If it cannot be converted to readable string, a failure is added which
includes the raw value. In libdisplay-info we do not keep around the raw
value which makes it hard to replicate the edid-decode output.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
---
 parse-cta-block.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Hans Verkuil June 16, 2024, 9:12 a.m. UTC | #1
On 16/06/2024 01:22, Sebastian Wick wrote:
> If it cannot be converted to readable string, a failure is added which
> includes the raw value. In libdisplay-info we do not keep around the raw
> value which makes it hard to replicate the edid-decode output.
> 
> Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
> ---
>  parse-cta-block.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git ./parse-cta-block.cpp ../parse-cta-block.cpp
> index 5193b70..3cf4eff 100644
> --- ./parse-cta-block.cpp
> +++ ../parse-cta-block.cpp
> @@ -1613,7 +1613,7 @@ static std::string display_use_case(unsigned char x)
>  	default: break;
>  	}
>  	fail("Unknown Display product primary use case 0x%02x.\n", x);
> -	return std::string("Unknown display use case (") + utohex(x) + ")";
> +	return "Unknown display use case";

Let's just return "Unknown" in this case...

>  }
>  
>  static void cta_microsoft(const unsigned char *x, unsigned length)
> @@ -1626,7 +1626,7 @@ static void cta_microsoft(const unsigned char *x, unsigned length)
>  		printf("    Desktop Usage: %u\n", (x[1] >> 6) & 1);
>  		printf("    Third-Party Usage: %u\n", (x[1] >> 5) & 1);
>  	}
> -	printf("    Display Product Primary Use Case: %u (%s)\n", x[1] & 0x1f,
> +	printf("    Display Product Primary Use Case: %s\n",

...since that makes more sense here. Otherwise you would get:

	Display Product Primary Use Case: Unknown display use case

which looks odd.

Regards,

	Hans

>  	       display_use_case(x[1] & 0x1f).c_str());
>  	printf("    Container ID: %s\n", containerid2s(x + 2).c_str());
>  }
diff mbox series

Patch

diff --git ./parse-cta-block.cpp ../parse-cta-block.cpp
index 5193b70..3cf4eff 100644
--- ./parse-cta-block.cpp
+++ ../parse-cta-block.cpp
@@ -1613,7 +1613,7 @@  static std::string display_use_case(unsigned char x)
 	default: break;
 	}
 	fail("Unknown Display product primary use case 0x%02x.\n", x);
-	return std::string("Unknown display use case (") + utohex(x) + ")";
+	return "Unknown display use case";
 }
 
 static void cta_microsoft(const unsigned char *x, unsigned length)
@@ -1626,7 +1626,7 @@  static void cta_microsoft(const unsigned char *x, unsigned length)
 		printf("    Desktop Usage: %u\n", (x[1] >> 6) & 1);
 		printf("    Third-Party Usage: %u\n", (x[1] >> 5) & 1);
 	}
-	printf("    Display Product Primary Use Case: %u (%s)\n", x[1] & 0x1f,
+	printf("    Display Product Primary Use Case: %s\n",
 	       display_use_case(x[1] & 0x1f).c_str());
 	printf("    Container ID: %s\n", containerid2s(x + 2).c_str());
 }