aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-27 15:34:50 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-27 15:34:50 +0200
commita0ae044573f7a68b8eb40c40719743cb64b11381 (patch)
tree564208aaa3413d6b42ca48d91567c9a8959bc98f
parentb7049c80880f6fcd1552ce9999b468d627a0a8b6 (diff)
edid-decode: fix reporting PNP as a proper PNP
The PNP for a DisplayID 1.2 data block was reported as an OUI due to incorrect logic. Fixed this. Also use big endian for the Product Identification Data Block 0x00. That's a better match with the hex identifier 0x415050 ('APP'). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--Makefile4
-rw-r--r--edid-decode.cpp14
-rw-r--r--oui.h2
-rw-r--r--parse-displayid-block.cpp2
4 files changed, 9 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index b6e51fc..1843700 100644
--- a/Makefile
+++ b/Makefile
@@ -24,10 +24,10 @@ all: edid-decode
sha = -DSHA=$(shell if test -d .git ; then git rev-parse --short=12 HEAD ; fi)
date = -DDATE=$(shell if test -d .git ; then TZ=UTC git show --quiet --date='format-local:"%F %T"' --format='%cd'; fi)
-edid-decode: $(SOURCES) edid-decode.h Makefile
+edid-decode: $(SOURCES) edid-decode.h oui.h Makefile
$(CXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(WARN_FLAGS) -g $(sha) $(date) -o $@ $(SOURCES) -lm
-edid-decode.js: $(SOURCES) edid-decode.h Makefile
+edid-decode.js: $(SOURCES) edid-decode.h oui.h Makefile
$(EMXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(WARN_FLAGS) $(sha) $(date) -s EXPORTED_FUNCTIONS='["_parse_edid"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -o $@ $(SOURCES) -lm
clean:
diff --git a/edid-decode.cpp b/edid-decode.cpp
index fb0cc81..1fc7fce 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -663,9 +663,9 @@ const char *oui_name(unsigned oui, unsigned *ouinum)
if (!ouinum) ouinum = &ouinumscratch;
const char *name;
switch (oui) {
- #define oneoui(c,k,n) case c: *ouinum = kOUI_##k; name = n; break;
- #include "oui.h"
- default: *ouinum = 0; name = NULL;
+ #define oneoui(c,k,n) case c: *ouinum = kOUI_##k; name = n; break;
+ #include "oui.h"
+ default: *ouinum = 0; name = NULL; break;
}
return name;
}
@@ -703,16 +703,12 @@ void edid_state::data_block_oui(std::string block_name, const unsigned char *x,
oui = reversedoui;
buf = ouitohex(oui);
matched_reverse = true;
- }
- else if (do_ascii && valid_ascii)
- {
+ } else if (do_ascii && valid_ascii) {
unsigned asciioui = (x[0] << 24) + (x[1] << 16) + (x[2] << 8);
ouiname = oui_name(asciioui, ouinum);
- if (ouiname) {
- matched_ascii = true;
- }
}
}
+ matched_ascii = do_ascii && valid_ascii && ouiname != NULL;
}
std::string name;
diff --git a/oui.h b/oui.h
index cbda318..77342ac 100644
--- a/oui.h
+++ b/oui.h
@@ -15,6 +15,6 @@ oneoui(0xca125c, Microsoft, "Microsoft" )
oneoui(0x3a0292, VESA, "VESA" )
// https://uefi.org/pnp_id_list
-oneoui(0x505041, asciiApple, "Apple" ) // 'APP\0'
+oneoui(0x415050, asciiApple, "Apple" ) // 'APP\0'
#undef oneoui
diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp
index e512394..d527bf2 100644
--- a/parse-displayid-block.cpp
+++ b/parse-displayid-block.cpp
@@ -1651,7 +1651,7 @@ unsigned edid_state::displayid_block(const unsigned version, const unsigned char
// DisplayID 1.3:
case 0x00:
data_block_oui("Product Identification Data Block (" + utohex(tag) + ")",
- x + 3, len, &ouinum, true, true, false);
+ x + 3, len, &ouinum, true, true, true);
dooutputname = false;
hasoui = true;
break;

Privacy Policy