-
-
Save xxxzc/032bf9eef2f217bc7d60f087e25555e1 to your computer and use it in GitHub Desktop.
# 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>') |
Look into my repo and description.
Look into my repo and description.
Doesn't work for XPS 17 for some reason. My EDID is 00ffffffffffff004d10d61400000000051e0104b52517780ad4c6aa5333ba240c50550000000101010101010101010101010101010172e700a0f0604590302036006ee51000001828b900a0f0604590302036006ee510000018000000fe00374a584b38804c513137305231000000000002410332011200000b010a2020018102030f00e3058000e606050160602800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa
, after patch data looks like this AP///////wBNENYUAAAAAAUeAQS1JRd4CtTGqlMzuiQMUFUAAAABAQEBAQEBAQEBAQEBAQEBpqYAoPBgRZAwIDYAbuUQAAAYKLkAoPBgRZAwIDYAbuUQAAAYAAAA/gA3SlhLOIBMUTE3MFIxAAAAAAACQQMyARIAAAsBCiAgAYECAw8A4wWAAOYGBQFgYCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtw==
and if I apply this system won't boot - freezes before desktop should appear.
@khmyznikov I updated my script to support 256 bytes EDID , please try this:
patch descriptor 1 and descriptor 2 to 48Hz:
AP///////wBNENYUAAAAAAUeAQS1JRd4CtTGqlMzuiQMUFUAAAABAQEBAQEBAQEBAQEBAQEBpqYAoPBgRZAwIDYAbuUQAAAYpqYAoPBgRZAwIDYAbuUQAAAYAAAA/gA3SlhLOIBMUTE3MFIxAAAAAAACQQMyARIAAAsBCiAgASMCAw8A4wWAAOYGBQFgYCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqg==
or patch descriptor 2 only
AP///////wBNENYUAAAAAAUeAQS1JRd4CtTGqlMzuiQMUFUAAAABAQEBAQEBAQEBAQEBAQEBcucAoPBgRZAwIDYAbuUQAAAYpqYAoPBgRZAwIDYAbuUQAAAYAAAA/gA3SlhLOIBMUTE3MFIxAAAAAAACQQMyARIAAAsBCiAgARYCAw8A4wWAAOYGBQFgYCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqg==
or patch descriptor 1 only:
AP///////wBNENYUAAAAAAUeAQS1JRd4CtTGqlMzuiQMUFUAAAABAQEBAQEBAQEBAQEBAQEBpqYAoPBgRZAwIDYAbuUQAAAYKLkAoPBgRZAwIDYAbuUQAAAYAAAA/gA3SlhLOIBMUTE3MFIxAAAAAAACQQMyARIAAAsBCiAgAY4CAw8A4wWAAOYGBQFgYCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqg==
can you confirm this is your internal panel's EDID? 256 bytes EDID is normally found on external display.
@xxxzc @thefiredragon yes I confirm - it's 256. So with WEG 1.4.5 and with any of three strings from @xxxzc i got same result - screen recognized as 4k and show image, but very very glitchy like every third row of pixels was stolen and image constantly shake and jump. @thefiredragon I used your config and there is already no enable-dpcd-max-link-rate option, only enable-dpcd-max-link-rate-fix.
please provide on my repo your efi, I could take a look
please provide on my repo your efi, I could take a look
It's all your repo copy pasted, just changed override to first one from @xxxzc post
New WEG version fixed this problem
Can you share your lines? I was generated for myself but boot process stuck.