15

I am trying to write a simple Cocoa App for the Mac for one simple purpose: switching my Dell monitor input to another one (so I can switch between PC and MAC). I already found an application for Windows that does that (mControl by entechtaiwan), and they explain what they do in there:

"To switch inputs via software you use the VESA MCCS command 60h. To send that command to the monitor, you'll need to read and write to the GPU I/O pads that connect to the monitor. Ditto on the Mac."

Does anyone know how can I send such a command from a Cocoa app? Maybe there's a library for that...shouldn't it be quite simple?

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Martí Gascó
  • 385
  • 2
  • 11
  • Probably something to do with I/O Kit, though I don't know enough about I/O Kit generally or this task specifically to make a proper answer of it. It's also possible that there may be an API in I/O Kit or (improbable but worth checking) Quartz Display Services that encapsulates this task—telling the monitor to switch inputs—without you having to worry about the implementation details. – Peter Hosey Apr 21 '13 at 20:28
  • There are some mentions of MCCS in http://www.opensource.apple.com/source/IOGraphics/IOGraphics-468/IOGraphicsFamily/ but mainly about MCCS interrupts - that would indicate receiving MCCS events, not generating them. There is also a `/System/Library/Extensions/AppleMCCSControl.kext` but that's closed source and I have no idea what it does or if it offers an interesting interface. You could try poring over the output from `nm -U /System/Library/Extensions/AppleMCCSControl.kext/Contents/MacOS/AppleMCCSControl | c++filt | less` – pmdj Dec 17 '13 at 04:51
  • I don't know much about display ports but if MCCS has anything to do with I2C, that aspect can definitely be controlled via IOKit. – pmdj Dec 17 '13 at 04:55

2 Answers2

3

there seems to be an implementation for Linux at: http://ddccontrol.sourceforge.net

it uses the <sys/msg.h> api. There seems to be no man-pages for that api but it's available on the mac. I haven't tried to compile the ddccontrol tool, but looks like the closest you can get and it should be a good starting point.

Karsten
  • 2,772
  • 17
  • 22
2

This open source app lets you control an external monitor's brightness and contrast. Since it's open source, you should be able to find out how to write your own script from reading the source.

https://github.com/the0neyouseek/MonitorControl

enter image description here

seanlinsley
  • 3,165
  • 2
  • 25
  • 26