From 4a0fac8c390ddb1da3a942cb077ca7b2d608a0d0 Mon Sep 17 00:00:00 2001 From: Diego Rondini Date: Tue, 20 Sep 2022 10:20:42 +0200 Subject: [PATCH 1/4] Fix "EDID length 127 is not a multiple of 128" Fix issue EDID bin length issue that apperead on recent versions of gcc or objcopy (see gh-21). The fix has been originally suggested by marwanramadan. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 693bdbd..8c4d039 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ clean: cc -c -DCRC="0x00" -o $@ $^ %.bin.nocrc: %.o - objcopy -Obinary $^ $@ + objcopy -j .data -Obinary $^ $@ %.crc: %.bin.nocrc cat $^ | edid-decode \ @@ -26,7 +26,7 @@ clean: cc -c -DCRC="$$(cat $*.crc)" -o $@ $*.S %.bin: %.p - objcopy -Obinary $^ $@ + objcopy -j .data -Obinary $^ $@ %.bin.ihex: %.p objcopy -Oihex $^ $@ From b681133934da5ecdd869267af0486b5de902051d Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski Date: Tue, 17 Oct 2023 17:20:08 +0200 Subject: [PATCH 2/4] match all *.S files except edid.S --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8c4d039..7c8588d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -SOURCES := $(wildcard [0-9]*x[0-9]*.S) +SOURCES := $(filter-out edid.S, $(wildcard *.S)) BIN := $(patsubst %.S, %.bin, $(SOURCES)) From cdef9e92c7c101f6b81a06810ebe43cc82367175 Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski Date: Tue, 17 Oct 2023 17:27:15 +0200 Subject: [PATCH 3/4] limit name length to 12 characters found at https://github.com/akatrevorjay/edid-generator/issues/21#issuecomment-1025054600 --- modeline2edid | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modeline2edid b/modeline2edid index 56c5e4b..65142fd 100755 --- a/modeline2edid +++ b/modeline2edid @@ -32,6 +32,7 @@ template-S() { local name="${1//\"}" [[ -z "$name" ]] && echo "Could not parse modeline: $@" >&2 && return 1 + [[ "${#name}" -gt 12 ]] && echo "Name cannot be longer than 12 characters: $name is ${#name} characters long" >&2 && return 1 local fn="${name}.S" local -F pixel_clock_mhz=$2 @@ -60,7 +61,7 @@ template-S() { case $ratio in compute) ratio=$(find-supported-ratio $hdisp $vdisp 'UNKNOWN') - printf 'Computed ratio: %s' $ratio + printf 'Computed ratio: %s\n' $ratio [[ $ratio != 'UNKNOWN' ]] || return 1 ;; esac From f7fd645fbd106db508954f1a3e01b6a38e95d65b Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski Date: Tue, 17 Oct 2023 19:23:14 +0200 Subject: [PATCH 4/4] fix [-+][hv]sync handling --- modeline2edid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modeline2edid b/modeline2edid index 65142fd..da623e3 100755 --- a/modeline2edid +++ b/modeline2edid @@ -48,8 +48,8 @@ template-S() { local arg for arg in "$@"; do case "${(L)arg}" in - [-+]hsync) [[ "${arg:1:1}" == "-" ]] || hsync_polarity=1 ;; - [-+]vsync) [[ "${arg:1:1}" == "-" ]] || vsync_polarity=1 ;; + [-+]hsync) [[ "${arg:0:1}" == "-" ]] || hsync_polarity=1 ;; + [-+]vsync) [[ "${arg:0:1}" == "-" ]] || vsync_polarity=1 ;; ratio=*|xy_ratio=*) ratio="${arg#*=}" ;; dpi=*) dpi="${arg#*=}" ;; edid_version=*) edid_version="${arg#*=}" ;;