kfix / ddcctl

DDC monitor controls (brightness) for Mac OSX command line
GNU General Public License v3.0
1.86k stars 150 forks source link

refactor IOFramebuffer discovery #87

Closed kfix closed 3 years ago

kfix commented 3 years ago

fix #17, by partially reverting 0d660108 and only falling back to the "replacement" for the deprecated CGDisplayIOServicePort API function if it ever disappears from the OS libraries for reals or is nerfed.

the fallback function is refined to use some helper information grabbed from WindowServer.plist so it might be able to discern frame buffers of identical monitor model's apart, based on their IOReg locations as recorded in the prefs file. This file does seem to take a few seconds to update after a monitor is first plugged into a system, so I'm hoping to find a better way to get this information in the future.

I'm still not in possession of two matched monitors so I can't really test that #17 is fixed, but it works for my usual setups (Intel and AMD)

kfix commented 3 years ago

shelling out to system_profiler SPDisplaysDataType -xml or hacking a call to the private SPSupport.framework can also provide the DisplayID <=> dispalyPath association we need, and is less ambiguous than the WindowServer prefs dump

echocrow commented 3 years ago

(Posting here as #17 is still "locked as too heated" and I didn't wanna open a new issue.)

Just tested this PR on the latest master @ ebffe35 and wanted to confirm that I can individually control monitors of the same model! I've tested brightness, contrast, and power; all work as expected.

Thanks a bunch for all the hard work on this!

kfix commented 3 years ago

Nice, thanks for the confirmation!