Skip to content

Instantly share code, notes, and snippets.

@evadne

evadne/About.md

Last active Apr 25, 2018
Embed
What would you like to do?
Create display override file to force Mac OS X to use RGB mode for Display.

Create display override file to force Mac OS X to use RGB mode for Display.

  • Dell (4268) = 0x40ac
  • U3011 (16485) = 0x4065: /System/Library/Displays/Overrides/DisplayVendorID-10ac/DisplayProductID-4065
  • U2713HM (16512) = 0x4080: /System/Library/Displays/Overrides/DisplayVendorID-10ac/DisplayProductID-4080

Credit: http://embdev.net/topic/284710; works for OS X 10.8 & last tested on 10.9 13A476u.

<?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">
<dict>
<key>DisplayProductName</key>
<string>Dell U3011 (RGB 4:4:4 Only)</string>
<key>IODisplayEDID</key>
<data>AP///////wAQrGVATDNCQgIXAQS1QCh4Io2FrU81sSUOUFSlSwBxT4EAgYCp
QNEA0UABAQEB4mgAoKBALmAwIDYAgZEhAAAaAAAA/wBQSDVOWTMxR0JCM0wK
AAAA/ABERUxMIFUzMDExCiAgAAAA/QAxVh1xHAAKICAgICAgABI=
</data>
<key>DisplayVendorID</key>
<integer>4268</integer>
<key>DisplayProductID</key>
<integer>16485</integer>
</dict>
</plist>
<?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">
<dict>
<key>DisplayProductName</key>
<string>Dell U2713HM (RGB 4:4:4 Only)</string>
<key>IODisplayEDID</key>
<data>AP///////wAQrIBATFEyQSsWAQSlPCJ4Iku1p1ZLoyUKUFSlSwCBALMA0QBx
T6lAgYABAQEBVl4AoKCgKVAwIDUAVVAhAAAaAAAA/wBHSzBLRDJBTUEyUUwK
AAAA/ABERUxMIFUyNzEzSE0KAAAA/QAxVh1xHgEKICAgICAgAKE=
</data>
<key>DisplayVendorID</key>
<integer>4268</integer>
<key>DisplayProductID</key>
<integer>16512</integer>
</dict>
</plist>
#!/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 -r -c AppleDisplay`
edid_hex=data.match(/IODisplayEDID.*?<([a-z0-9]+)>/i)[1]
vendorid=data.match(/DisplayVendorID.*?([0-9]+)/i)[1].to_i
productid=data.match(/DisplayProductID.*?([0-9]+)/i)[1].to_i
puts "found display: vendorid #{vendorid}, productid #{productid}, EDID:\n#{edid_hex}"
bytes=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" % vendorid) rescue nil
f = File.open("DisplayVendorID-%x/DisplayProductID-%x" % [vendorid, productid], '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>Display with forced RGB mode (EDID override)</string>
<key>IODisplayEDID</key>
<data>#{Base64.encode64(bytes.pack('C*'))}</data>
<key>DisplayVendorID</key>
<integer>#{vendorid}</integer>
<key>DisplayProductID</key>
<integer>#{productid}</integer>
</dict>
</plist>"
f.close
@lcat

This comment has been minimized.

Copy link

@lcat lcat commented Apr 13, 2015

patch-edid.rb:9:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)

OS X Yosemite 10.10.2

@lcat

This comment has been minimized.

Copy link

@lcat lcat commented Apr 13, 2015

lcat:~ lcat$ ioreg -l -w0 -d0 -r -c AppleDisplay
+-o AppleDisplay  <class AppleDisplay, id 0x10000066e, registered, matched, active, busy 0 (0 ms), retain 8>
    {
      "IOClass" = "AppleDisplay"
      "CFBundleIdentifier" = "com.apple.iokit.IOGraphicsFamily"
      "IOProviderClass" = "IODisplayConnect"
      "DisplayProductID" = 1815
      "IOPowerManagement" = {"CapabilityFlags"=49152,"MaxPowerState"=3,"CurrentPowerState"=3}
      "IODisplayPrefsKey" = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2/AppleIntelFramebuffer@2/display0/AppleDisplay-756e6b6e-717"
      "IODisplayParameters" = {"bgsc"={"min"=0,"max"=65536,"value"=65536},"rgsc"={"min"=0,"max"=65536,"value"=65536},"cmod"={"min"=0,"max"=4096,"value"=1},"ggsc"={"min"=0,"max"=65536,"value"=65536},"cyuv"={"min"=0,"max"=268435456,"value"=268435456},"vblm"={"min"=0,"max"=196608,"value"=65536},"gsc "={"min"=0,"max"=65536,"value"=65536},"colr"={"min"=0,"max"=18446744073709551615,"value"=257}}
      "IOProbeScore" = 2000
      "IOMatchCategory" = "IODefaultMatchCategory"
      "IODisplayConnectFlags" = <00000000>
      "DisplayVendorID" = 1970170734
      "DisplaySerialNumber" = 0
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.