-
-
Save nevrending/b0677205b53c7d1a040a07bf83913acc to your computer and use it in GitHub Desktop.
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
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten | |
productids=data.scan(/DisplayProductID.*?([0-9]+)/i).flatten | |
displays = [] | |
edids.each_with_index do |edid, i| | |
disp = { "edid_hex"=>edid, "vendorid"=>vendorids[i].to_i, "productid"=>productids[i].to_i } | |
displays.push(disp) | |
end | |
# Process all displays | |
if displays.length > 1 | |
puts "Found %d displays! You should only install the override file for the one which" % displays.length | |
puts "is giving you problems.","\n" | |
elsif displays.length == 0 | |
puts "No display data found! Are any external displays connected?" | |
end | |
displays.each do |disp| | |
# Retrieve monitor model from EDID display descriptor | |
i = disp["edid_hex"].index('000000fc00') | |
if i.nil? | |
monitor_name = "Display" | |
else | |
# The monitor name is stored in (up to) 13 bytes of text following 00 00 00 fc 00. | |
# If the name is shorter than 13 bytes, it is terminated with a newline (0a) and then padded with spaces. | |
monitor_name = [disp["edid_hex"][i + 10, 26].to_s].pack("H*") | |
monitor_name.rstrip! # remove trailing newline/spaces | |
end | |
puts "Found display '#{monitor_name}': vendor ID=#{disp["vendorid"]} (0x%x), product ID=#{disp["productid"]} (0x%x)" % | |
[disp["vendorid"], disp["productid"]] | |
puts "Raw EDID data:\n#{disp["edid_hex"]}" | |
bytes=disp["edid_hex"].scan(/../).map{|x|Integer("0x#{x}")}.flatten | |
puts "Setting color support to RGB 4:4:4 only" | |
bytes[24] &= ~(0b11000) | |
puts "Number of extension blocks: #{bytes[126]}" | |
puts "removing extension block" | |
bytes = bytes[0..127] | |
bytes[126] = 0 | |
bytes[127] = (0x100-(bytes[0..126].reduce(:+) % 256)) % 256 | |
puts | |
puts "Recalculated checksum: 0x%x" % bytes[127] | |
puts "new EDID:\n#{bytes.map{|b|"%02X"%b}.join}" | |
Dir.mkdir("DisplayVendorID-%x" % disp["vendorid"]) rescue nil | |
filename = "DisplayVendorID-%x/DisplayProductID-%x" % [disp["vendorid"], disp["productid"]] | |
puts "Output file: #{Dir.pwd}/#{filename}" | |
f = File.open(filename, 'w') | |
f.write '<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0">' | |
f.write " | |
<dict> | |
<key>DisplayProductName</key> | |
<string>#{monitor_name} - forced RGB mode (EDID override)</string> | |
<key>IODisplayEDID</key> | |
<data>#{Base64.encode64(bytes.pack('C*'))}</data> | |
<key>DisplayVendorID</key> | |
<integer>#{disp["vendorid"]}</integer> | |
<key>DisplayProductID</key> | |
<integer>#{disp["productid"]}</integer> | |
</dict> | |
</plist>" | |
f.close | |
puts "\n" | |
end # displays.each |
Author
nevrending
commented
Dec 14, 2020
EDID report generated by SwitchResX Version 4.10.1 for display AW2521HFL - forced RGB mode (EDID override)
-----------------------------------------------------
------------------- RAW DATA ------------------------
-----------------------------------------------------
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
-----------------------------------------------------
0 | 00 FF FF FF FF FF FF 00 10 AC 7A A1 55 46 4B 30
1 | 1E 1E 01 03 80 36 1E 78 E2 08 75 A6 57 4E A3 26
2 | 0C 50 54 A5 4B 00 71 4F 81 80 A9 C0 D1 C0 01 01
3 | 01 01 01 01 01 01 02 3A 80 18 71 38 2D 40 58 2C
4 | 45 00 20 2F 21 00 00 1E 00 00 00 FF 00 32 56 44
5 | 34 4D 32 33 0A 20 20 20 20 20 00 00 00 FC 00 41
6 | 57 32 35 32 31 48 46 4C 0A 20 20 20 00 00 00 FD
7 | 00 30 F0 1E FF 3C 00 0A 20 20 20 20 20 20 01 38
-----------------------------------------------------
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
-----------------------------------------------------
0 | 02 03 33 C1 4D 90 05 04 03 02 07 16 01 14 1F 12
1 | 13 4C 23 09 07 07 83 01 00 00 67 03 0C 00 10 00
2 | 00 1E 67 D8 5D C4 01 78 80 00 68 1A 00 00 01 01
3 | 30 F0 E6 86 6F 80 A0 70 38 40 40 30 20 35 00 20
4 | 2F 21 00 00 1A 5A 87 80 A0 70 38 4D 40 30 20 35
5 | 00 20 2F 21 00 00 1A A0 DD 80 78 70 38 50 40 1C
6 | 20 98 0C 20 2F 21 00 00 1A 00 00 00 00 00 00 00
7 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6D
-----------------------------------------------------
< 00FFFFFF FFFFFF00 10AC7AA1 55464B30 1E1E0103 80361E78 E20875A6 574EA326 0C5054A5 4B00714F 8180A9C0 D1C00101 01010101 0101023A 80187138 2D40582C 4500202F 2100001E 000000FF 00325644 344D3233 0A202020 20200000 00FC0041 57323532 3148464C 0A202020 000000FD 0030F01E FF3C000A 20202020 20200138 020333C1 4D900504 03020716 01141F12 134C2309 07078301 00006703 0C001000 001E67D8 5DC40178 8000681A 00000101 30F0E686 6F80A070 38404030 20350020 2F210000 1A5A8780 A070384D 40302035 00202F21 00001AA0 DD807870 3850401C 20980C20 2F210000 1A000000 00000000 00000000 00000000 00000000 0000006D >
-----------------------------------------------------
{ 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0xAC, 0x7A, 0xA1, 0x55, 0x46, 0x4B, 0x30, 0x1E, 0x1E, 0x01, 0x03, 0x80, 0x36, 0x1E, 0x78, 0xE2, 0x08, 0x75, 0xA6, 0x57, 0x4E, 0xA3, 0x26, 0x0C, 0x50, 0x54, 0xA5, 0x4B, 0x00, 0x71, 0x4F, 0x81, 0x80, 0xA9, 0xC0, 0xD1, 0xC0, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0x20, 0x2F, 0x21, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x32, 0x56, 0x44, 0x34, 0x4D, 0x32, 0x33, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x41, 0x57, 0x32, 0x35, 0x32, 0x31, 0x48, 0x46, 0x4C, 0x0A, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x30, 0xF0, 0x1E, 0xFF, 0x3C, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x38, 0x02, 0x03, 0x33, 0xC1, 0x4D, 0x90, 0x05, 0x04, 0x03, 0x02, 0x07, 0x16, 0x01, 0x14, 0x1F, 0x12, 0x13, 0x4C, 0x23, 0x09, 0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x67, 0x03, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x1E, 0x67, 0xD8, 0x5D, 0xC4, 0x01, 0x78, 0x80, 0x00, 0x68, 0x1A, 0x00, 0x00, 0x01, 0x01, 0x30, 0xF0, 0xE6, 0x86, 0x6F, 0x80, 0xA0, 0x70, 0x38, 0x40, 0x40, 0x30, 0x20, 0x35, 0x00, 0x20, 0x2F, 0x21, 0x00, 0x00, 0x1A, 0x5A, 0x87, 0x80, 0xA0, 0x70, 0x38, 0x4D, 0x40, 0x30, 0x20, 0x35, 0x00, 0x20, 0x2F, 0x21, 0x00, 0x00, 0x1A, 0xA0, 0xDD, 0x80, 0x78, 0x70, 0x38, 0x50, 0x40, 0x1C, 0x20, 0x98, 0x0C, 0x20, 0x2F, 0x21, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D }
-----------------------------------------------------
Valid EDID block #0: checksum ok
Valid EDID block #1: checksum ok
-----------------------------------------------------
------------------- MAIN EDID BLOCK -----------------
-----------------------------------------------------
EDID Version........1.3
Manufacturer........DEL (10AC)
Product ID..........41338 (A17A)
Serial Number.......304B4655
Manufactured........Week 30 of year 2020
Max H Size..........54 cm
Max V Size..........30 cm
Gamma...............2.20
Display Supported Features:
---------------------------
Power Management: Active off
Power Management: Suspend
Power Management: Standby
Display type:
-------------
Grayscale display
Display is non continuous frequency
Default color space is not sRGB standard
First detailed Timing is preferred Timing
Input signal & sync:
--------------------
Digital Input
Color info:
-----------
Red x = 0.648 Green x = 0.307 Blue x = 0.149 White x = 0.313
Red y = 0.340 Green y = 0.637 Blue y = 0.050 White y = 0.329
Established Timings supported:
------------------------------
# 0: 720 × 400 @ 70Hz
# 1: 640 × 480 @ 60Hz
# 2: 640 × 480 @ 75Hz
# 3: 800 × 600 @ 60Hz
# 4: 800 × 600 @ 75Hz
# 5: 1024 × 768 @ 60Hz
# 6: 1024 × 768 @ 75Hz
# 7: 1280 × 1024 @ 75Hz
Standard Timing supported:
--------------------------
# 0: 1152 × 864 @ 75Hz (714F)
# 1: 1280 × 1024 @ 60Hz (8180)
# 2: 1600 × 900 @ 60Hz (A9C0)
# 3: 1920 × 1080 @ 60Hz (D1C0)
Monitor Description blocks:
---------------------------
Descriptor #0 - Timing definition:
Mode = 1920 × 1080 @ 60.000Hz
Pixel Clock............. 148.50 MHz Not Interlaced
Horizontal Vertical
Active.................. 1920 pixels 1080 lines
Front Porch............. 88 pixels 4 lines
Sync Width.............. 44 pixels 5 lines
Back Porch.............. 148 pixels 36 lines
Blanking................ 280 pixels 45 lines
Total................... 2200 pixels 1125 lines
Scan Rate............... 67.500 kHz 60.000 Hz
Image Size.............. 544 mm 303 mm
Border.................. 0 pixels 0 lines
Sync: Digital separate with
* Positive vertical polarity
* Positive horizontal polarity
Descriptor #1 - Serial number:
2VD4M23
Descriptor #2 - Monitor name:
AW2521HFL
Descriptor #3 - Monitor range:
Horizontal frequency range.......30-255 kHz
Vertical frequency range.........48-240 Hz
Maximum bandwidth range..........600 MHz
GTF supported
-----------------------------------------------------
------------ EXTENSION EDID BLOCK 1 ---------------
-----------------------------------------------------
CTA-EXT: CTA 861 Series Extension:
----------------------------------
Revision:...........................3
First DTD block at offset...........47
Display Supports:
Underscan on PC modes
Basic audio
Data Block #1
Video Type: standard CTA Timings
VIC # 0: ( 16) 1920 × 1080 @ 60Hz - 16:9 (is native)
VIC # 1: ( 5) 1920 × 1080i @ 60Hz - 16:9
VIC # 2: ( 4) 1280 × 720 @ 60Hz - 16:9
VIC # 3: ( 3) 720 × 480 @ 60Hz - 16:9
VIC # 4: ( 2) 720 × 480 @ 60Hz - 4:3
VIC # 5: ( 7) 1440 × 480i @ 60Hz - 16:9
VIC # 6: ( 22) 1440 × 576i @ 50Hz - 16:9
VIC # 7: ( 1) 640 × 480 @ 60Hz - 4:3
VIC # 8: ( 20) 1920 × 1080i @ 50Hz - 16:9
VIC # 9: ( 31) 1920 × 1080 @ 50Hz - 16:9
VIC #10: ( 18) 720 × 576 @ 50Hz - 16:9
VIC #11: ( 19) 1280 × 720 @ 50Hz - 16:9
VIC #12: ( 76) 1920 × 1080 @ 60Hz - 64:27
Data Block #2
Audio Data Block
Supported format: Linear PCM, on 2 channels
Supported sample rates (kHz): 32kHz, 44.1kHz, 48kHz
Supported sample sizes (bits): 16 bit, 20 bit, 24 bit
Data Block #3
Speaker allocation data block
Speaker map:
FL/FR - Front Left/Right
Data Block #4
Vendor specific Data Block - Vendor Identifier: 00:0C:03 (HDMI)
Found HDMI IEEE Registration Identifier
CEC physical address........... 1.0.0.0
Supports AI (ACP, ISRC)........ No
Supports 48bpp color depth..... No
Supports 36bpp color depth..... No
Supports 30bpp color depth..... No
Supports YCbCr 4:4:4........... No
Supports dual-link DVI......... No
Maximum TMDS clock............. 150 MHz
Supported Content Types:
Graphics
Photo
Cinema
Interlaced Video Latency....... 176 ms
Interlaced Audio Latency....... 186 ms
HDMI video capabilities........ Yes
Supports 3D.................... Yes
3D is supported
3D-capable-VIC mask present
Reserved - 7
Reserved - 11
Reserved - 12
Reserved - 13
Reserved - 14
on following 2D VICs:
VIC # 3: 720 × 480 @ 60Hz - 16:9
VIC # 5: 1440 × 480i @ 60Hz - 16:9
VIC # 6: 1440 × 576i @ 50Hz - 16:9
Data Block #5
Vendor specific Data Block - Vendor Identifier: C4:5D:D8 (HDMI Forum)
(HDMI Forum)
Version: 1
Maximum TMDS Character Rate: 600MHz
SCDC Present
Data Block #6
Vendor specific Data Block - Vendor Identifier: 00:00:1A (AMD)
Payload: 01 01 30 F0 '..0.'
Detailed Timing Blocks - 1 is native
Detailed Timing Block #1 - Timing definition:
Mode = 1920 × 1080 @ 119.982Hz
Pixel Clock............. 285.50 MHz Not Interlaced
Horizontal Vertical
Active.................. 1920 pixels 1080 lines
Front Porch............. 48 pixels 3 lines
Sync Width.............. 32 pixels 5 lines
Back Porch.............. 80 pixels 56 lines
Blanking................ 160 pixels 64 lines
Total................... 2080 pixels 1144 lines
Scan Rate............... 137.260 kHz 119.982 Hz
Image Size.............. 544 mm 303 mm
Border.................. 0 pixels 0 lines
Sync: Digital separate with
* Negative vertical polarity
* Positive horizontal polarity
Detailed Timing Block #2 - Timing definition:
Mode = 1920 × 1080 @ 143.981Hz
Pixel Clock............. 346.50 MHz Not Interlaced
Horizontal Vertical
Active.................. 1920 pixels 1080 lines
Front Porch............. 48 pixels 3 lines
Sync Width.............. 32 pixels 5 lines
Back Porch.............. 80 pixels 69 lines
Blanking................ 160 pixels 77 lines
Total................... 2080 pixels 1157 lines
Scan Rate............... 166.587 kHz 143.981 Hz
Image Size.............. 544 mm 303 mm
Border.................. 0 pixels 0 lines
Sync: Digital separate with
* Negative vertical polarity
* Positive horizontal polarity
Detailed Timing Block #3 - Timing definition:
Mode = 1920 × 1080 @ 239.757Hz
Pixel Clock............. 567.36 MHz Not Interlaced
Horizontal Vertical
Active.................. 1920 pixels 1080 lines
Front Porch............. 28 pixels 57 lines
Sync Width.............. 32 pixels 8 lines
Back Porch.............. 60 pixels 15 lines
Blanking................ 120 pixels 80 lines
Total................... 2040 pixels 1160 lines
Scan Rate............... 278.118 kHz 239.757 Hz
Image Size.............. 544 mm 303 mm
Border.................. 0 pixels 0 lines
Sync: Digital separate with
* Negative vertical polarity
* Positive horizontal polarity
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment