diff mbox series

[2/5] edid-decode: Change horizontal frequency to kHz

Message ID 20191205073414.53672-2-joevt@shaw.ca (mailing list archive)
State New, archived
Headers show
Series [1/5] edid-decode: DisplayID additions | expand

Commit Message

joevt Dec. 5, 2019, 7:34 a.m. UTC
Change Monitor Ranges error message to use kHz for horizontal frequency.

Signed-off-by: Joe van Tunen <joevt@shaw.ca>
---
 edid-decode.cpp | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/edid-decode.cpp b/edid-decode.cpp
index eac47c5..0c6c237 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -735,26 +735,22 @@  int edid_state::parse_edid()
 		 * EDID 1.4 states (in an Errata) that explicitly defined
 		 * timings supersede the monitor range definition.
 		 */
+		char buf[512];
+		snprintf(buf, sizeof(buf),
+			"One or more of the timings is out of range of the Monitor Ranges:\n"
+			"    Vertical Freq: %u - %u Hz (Monitor: %u - %u Hz)\n"
+			"    Horizontal Freq: %.3f - %.3f kHz (Monitor: %.3f - %.3f kHz)\n"
+			"    Maximum Clock: %.3f MHz (Monitor: %.3f MHz)\n",
+			min_vert_freq_hz, max_vert_freq_hz,
+			min_display_vert_freq_hz, max_display_vert_freq_hz,
+			min_hor_freq_hz / 1000.0, max_hor_freq_hz / 1000.0,
+			min_display_hor_freq_hz / 1000.0, max_display_hor_freq_hz / 1000.0,
+			max_pixclk_khz / 1000.0, max_display_pixclk_khz / 1000.0);
+		
 		if (edid_minor < 4) {
-			fail("One or more of the timings is out of range of the Monitor Ranges:\n"
-			     "    Vertical Freq: %u - %u Hz (Monitor: %u - %u Hz)\n"
-			     "    Horizontal Freq: %u - %u Hz (Monitor: %u - %u Hz)\n"
-			     "    Maximum Clock: %.3f MHz (Monitor: %.3f MHz)\n",
-			     min_vert_freq_hz, max_vert_freq_hz,
-			     min_display_vert_freq_hz, max_display_vert_freq_hz,
-			     min_hor_freq_hz, max_hor_freq_hz,
-			     min_display_hor_freq_hz, max_display_hor_freq_hz,
-			     max_pixclk_khz / 1000.0, max_display_pixclk_khz / 1000.0);
+			fail("%s", buf);
 		} else {
-			warn("One or more of the timings is out of range of the Monitor Ranges:\n"
-			     "    Vertical Freq: %u - %u Hz (Monitor: %u - %u Hz)\n"
-			     "    Horizontal Freq: %u - %u Hz (Monitor: %u - %u Hz)\n"
-			     "    Maximum Clock: %.3f MHz (Monitor: %.3f MHz)\n",
-			     min_vert_freq_hz, max_vert_freq_hz,
-			     min_display_vert_freq_hz, max_display_vert_freq_hz,
-			     min_hor_freq_hz, max_hor_freq_hz,
-			     min_display_hor_freq_hz, max_display_hor_freq_hz,
-			     max_pixclk_khz / 1000.0, max_display_pixclk_khz / 1000.0);
+			warn("%s", buf);
 		}
 	}