Last active
January 24, 2021 15:09
-
-
Save xxxzc/032bf9eef2f217bc7d60f087e25555e1 to your computer and use it in GitHub Desktop.
Modify laptop 4k display EDID for Big Sur (run at 48Hz)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modify laptop 4k panel edid for big sur | |
# This will make panel running at 48Hz | |
# Created by xxxzc | |
# Reference: http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1866466&highlight=edid | |
from subprocess import check_output | |
from base64 import b64encode | |
from textwrap import wrap | |
edid = '' | |
try: | |
edid = check_output('ioreg -lw0 | grep -i "IODisplayEDID"', | |
shell=True, encoding='utf-8') | |
edid = edid.split('<')[1].split('>')[0] | |
except Exception: | |
edid = input('No edid found, please input it manually: ') | |
edid = wrap(''.join(filter(str.isalnum, edid)), 2) # convert to 128 bytes | |
print('Default EDID:', ''.join(edid)) | |
# set refresh rate to 48Hz | |
if len(edid) == 128: | |
edid[54] = edid[55] = 'a6' # Descriptor 1 | |
elif len(edid) == 256: | |
edid[54] = edid[55] = 'a6' # Descriptor 1 | |
edid[72] = edid[73] = 'a6' # Descriptor 2 | |
data = list(int(x, 16) for x in edid) | |
csb = 127 # checksum byte | |
checksum = 256 - sum(data[:csb]) % 256 | |
edid[csb] = hex(checksum)[2:] | |
print('Patched EDID:', ''.join(edid)) | |
data[csb] = checksum | |
data = b64encode(bytes(data)).decode('utf-8') | |
print() | |
print('You should add following to PciRoot(0x0)/Pci(0x2,0x0):') | |
print('<key>AAPL00,override-no-connect</key>') | |
print(f'<data>{data}</data>') |
New WEG version fixed this problem
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's all your repo copy pasted, just changed override to first one from @xxxzc post