| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style id="stndz-style"></style> |
| 3 |
|
| 4 |
|
| 5 |
<link rel="icon" type="image/x-icon" href="./edid-decode.ico"> |
| 6 |
|
| 7 |
<title>EDID Decode</title> |
| 8 |
<style> |
| 9 |
body { |
| 10 |
font-family: arial; |
| 11 |
margin: 0; |
| 12 |
padding: none; |
| 13 |
} |
| 14 |
|
| 15 |
textarea { |
| 16 |
margin-top: 10px; |
| 17 |
border: 0; |
| 18 |
display: block; |
| 19 |
background-color: black; |
| 20 |
color: white; |
| 21 |
font-family: 'Lucida Console', Monaco, monospace; |
| 22 |
outline: none; |
| 23 |
} |
| 24 |
|
| 25 |
input { |
| 26 |
margin-top: 10px; |
| 27 |
border: 0; |
| 28 |
display: block; |
| 29 |
background-color: black; |
| 30 |
color: white; |
| 31 |
font-family: 'Lucida Console', Monaco, monospace; |
| 32 |
outline: none; |
| 33 |
} |
| 34 |
|
| 35 |
#error { |
| 36 |
background-color: white; |
| 37 |
color: red; |
| 38 |
} |
| 39 |
|
| 40 |
button { |
| 41 |
margin: 10px; |
| 42 |
} |
| 43 |
|
| 44 |
h3 { margin: 0px; } |
| 45 |
</style> |
| 46 |
</head> |
| 47 |
<body> |
| 48 |
<div style="display:flex"> |
| 49 |
<div style="margin:10px"> |
| 50 |
<h3 style="float:left">EDID</h3> |
| 51 |
<input type="file" id="upload" style="float:left; margin-left: 10px;"> |
| 52 |
<div style="clear:both"></div> |
| 53 |
<textarea id="input" style="width:40vw; height: 300px;" placeholder="Paste EDID hex here"></textarea> |
| 54 |
<div style="clear:both"></div> |
| 55 |
<input type="number" id="diagonal" min="10" max="2559" step="0.1" style="width:40vw; height: 14px;" placeholder="Diagonal of the display in inches (optional)"></input> |
| 56 |
<button id="process">Process</button> |
| 57 |
<div><a href="https://git.linuxtv.org/v4l-utils.git/">v4l-utils.git</a></div> |
| 58 |
<br> |
| 59 |
Credits: copied from Ilia Mirkin's website https://people.freedesktop.org/~imirkin/edid-decode/ |
| 60 |
<textarea readonly="" id="error" style="width: 40vw; height: 100px; resize: none;"></textarea> |
| 61 |
</div> |
| 62 |
<div style="margin:10px"> |
| 63 |
<h3>Parsed</h3> |
| 64 |
<textarea readonly="" id="output" rows="8" style="width:55vw; height: calc(100vh - 80px)"></textarea> |
| 65 |
</div> |
| 66 |
|
| 67 |
<script type="text/javascript"> |
| 68 |
|
| 69 |
document.getElementById("upload").addEventListener("change", function(e) { |
| 70 |
if (typeof WebAssembly === 'undefined') return; |
| 71 |
document.getElementById("output").value = ""; |
| 72 |
document.getElementById("error").value = ""; |
| 73 |
|
| 74 |
var input = e.target; |
| 75 |
var file = input.files[0]; |
| 76 |
if (!file) return; |
| 77 |
var fr = new FileReader(); |
| 78 |
fr.onload = function(e) { |
| 79 |
process(new Uint8Array(e.target.result), document.getElementById("diagonal").value); |
| 80 |
} |
| 81 |
fr.readAsArrayBuffer(file); |
| 82 |
}); |
| 83 |
|
| 84 |
document.getElementById("process").addEventListener("click", function(e) { |
| 85 |
if (typeof WebAssembly === 'undefined') return; |
| 86 |
document.getElementById("output").value = ""; |
| 87 |
document.getElementById("error").value = ""; |
| 88 |
process(document.getElementById("input").value, document.getElementById("diagonal").value); |
| 89 |
}); |
| 90 |
|
| 91 |
function process(input, diag) { |
| 92 |
FS.writeFile("input-file", input); |
| 93 |
Module.ccall('parse_edid', 'number', ['string', 'number'], ['input-file', diag]); |
| 94 |
/* |
| 95 |
// Look for the hex in the EDID output |
| 96 |
var output = document.getElementById("output").value; |
| 97 |
var m = output.match(/^edid-decode \(hex\):\n([0-9a-f \n]*)\n/ms); |
| 98 |
if (m) { |
| 99 |
var hex = m[1].replace(/\s/g, ''); |
| 100 |
console.log(hex); |
| 101 |
} |
| 102 |
*/ |
| 103 |
} |
| 104 |
|
| 105 |
var Module = { |
| 106 |
noInitialRun: true, |
| 107 |
preRun: [ |
| 108 |
], |
| 109 |
postRun: [], |
| 110 |
print: (function() { |
| 111 |
var element = document.getElementById('output'); |
| 112 |
if (element) element.value = ''; // clear browser cache |
| 113 |
return function(text) { |
| 114 |
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 115 |
// These replacements are necessary if you render to raw HTML |
| 116 |
//text = text.replace(/&/g, "&"); |
| 117 |
//text = text.replace(/</g, "<"); |
| 118 |
//text = text.replace(/>/g, ">"); |
| 119 |
//text = text.replace('\n', '<br>', 'g'); |
| 120 |
console.log(text); |
| 121 |
if (element) { |
| 122 |
element.value += text + "\n"; |
| 123 |
element.scrollTop = element.scrollHeight; // focus on bottom |
| 124 |
} |
| 125 |
}; |
| 126 |
})(), |
| 127 |
printErr: (function() { |
| 128 |
var element = document.getElementById('error'); |
| 129 |
if (element) element.value = ''; // clear browser cache |
| 130 |
return function(text) { |
| 131 |
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 132 |
console.error(text); |
| 133 |
if (element) { |
| 134 |
element.value += text + "\n"; |
| 135 |
element.scrollTop = element.scrollHeight; |
| 136 |
} |
| 137 |
}; |
| 138 |
})(), |
| 139 |
setStatus: function(text) { |
| 140 |
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; |
| 141 |
if (text === Module.setStatus.last.text) return; |
| 142 |
console.log(text); |
| 143 |
}, |
| 144 |
totalDependencies: 0, |
| 145 |
monitorRunDependencies: function(left) { |
| 146 |
this.totalDependencies = Math.max(this.totalDependencies, left); |
| 147 |
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); |
| 148 |
} |
| 149 |
}; |
| 150 |
Module.setStatus('Downloading...'); |
| 151 |
window.onerror = function(event) { |
| 152 |
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus |
| 153 |
Module.setStatus('Exception thrown, see JavaScript console'); |
| 154 |
Module.setStatus = function(text) { |
| 155 |
if (text) Module.printErr('[post-exception status] ' + text); |
| 156 |
}; |
| 157 |
}; |
| 158 |
</script> |
| 159 |
<script async="" type="text/javascript" src="./edid-decode.js"></script> |
| 160 |
|
| 161 |
|
| 162 |
</div></body></html> |