Closed aarohaa closed 5 years ago
I experience the same issue with iMac5k in OS X.
On Thursday, December 3, 2015, aarohaa notifications@github.com wrote:
bash-3.2# brightness -lv display 0: main, active, awake, online, built-in, ID 0x42bf888 resolution 2560 x 1440 pt (5120 x 2880 px) @ 0.0 Hz, origin (0, 0) physical size 599 x 340 mm IOKit flags 0x7; IOKit display mode ID 0x80005000 usable for desktop GUI, uses OpenGL acceleration brightness: failed to get brightness of display 0x42bf888 (error -536870201) display 1: active, awake, online, external, ID 0x424a392 resolution 2560 x 1440 pt (2560 x 1440 px) @ 0.0 Hz, origin (-2560, -1440) physical size 597 x 336 mm IOKit flags 0x2000007; IOKit display mode ID 0x80005000 usable for desktop GUI, uses OpenGL acceleration display 1: brightness 0.500114 display 2: active, awake, online, external, ID 0x4248d83 resolution 2560 x 1440 pt (2560 x 1440 px) @ 0.0 Hz, origin (-2560, 0) physical size 597 x 336 mm IOKit flags 0x2000007; IOKit display mode ID 0x80005000 usable for desktop GUI, uses OpenGL acceleration display 2: brightness 0.517021
bash-3.2# brightness -d 0 0.1 brightness: failed to set brightness of display 0x42bf888 (error -536870201)
BTW display 1 and 2 are external thunderbolt monitors and do work.
— Reply to this email directly or view it on GitHub https://github.com/nriley/brightness/issues/10.
Sorry I don't have a 5K iMac to test with but it must use a different method of adjusting the brightness from what the API I am using supports. Sorry about that!
@nriley any tips for how to dig for what the correct API is? I have no idea where to start looking.
also, any hints on how to determine what the error is?I am getting the same error as above (but with 2 displays):
brightness 1
brightness: failed to set brightness of display 0x42bf7fc (error -536870201)
brightness: failed to set brightness of display 0x4248d82 (error -536870201)
what is error -536870201
? one of these: https://developer.apple.com/reference/iokit/2011153-iokit_constants ? do i need to iterate through them to figure it out?
@swrobel — You could try enumerating IOKit with any of the many ways to investigate the registry, such as the command line ioreg tool, to see if it is exposed there. Otherwise, you’ll probably have to reverse engineer one of Apple’s frameworks. This is much harder now than when I first did it for the old O3Engine SPIs, because of Apple’s increased use of security measures such as rootless, XPC, encrypted binaries, etc. I don’t have a lot of recent reverse engineering experience in OS X unfortunately so I'm not sure if any of the techniques I could recommend would actually work.
@thegreatmichael — here's a tech Q&A that explains how to decode IOKit error codes:
FYI, same error (-536870201
) with external 2x Thunderbolt 3 - LG 5K displays
If still interested, please check out the changes I made for #21 and see if the current master version works with a 5K iMac display and/or the LG Thunderbolt displays. Thanks!
@nriley it does seem to work for setting brightness now, but I still can't successfully query brightness for my 2015 5k iMac
$ ./brightness -l
display 0: main, active, awake, online, built-in, ID 0x42b22ec
./brightness: failed to get brightness of display 0x42b22ec (error -536870201)
@swrobel, thanks for testing. Please try the version I just checked in — it relies on even more private stuff but hopefully should work. I only have 13ʺ MBPs and AirPlay to test with currently, but it seems to work on the former and not on the latter.
@nriley fantastic, it works now! Thank you!!!
bash-3.2# brightness -lv display 0: main, active, awake, online, built-in, ID 0x42bf888 resolution 2560 x 1440 pt (5120 x 2880 px) @ 0.0 Hz, origin (0, 0) physical size 599 x 340 mm IOKit flags 0x7; IOKit display mode ID 0x80005000 usable for desktop GUI, uses OpenGL acceleration brightness: failed to get brightness of display 0x42bf888 (error -536870201) display 1: active, awake, online, external, ID 0x424a392 resolution 2560 x 1440 pt (2560 x 1440 px) @ 0.0 Hz, origin (-2560, -1440) physical size 597 x 336 mm IOKit flags 0x2000007; IOKit display mode ID 0x80005000 usable for desktop GUI, uses OpenGL acceleration display 1: brightness 0.500114 display 2: active, awake, online, external, ID 0x4248d83 resolution 2560 x 1440 pt (2560 x 1440 px) @ 0.0 Hz, origin (-2560, 0) physical size 597 x 336 mm IOKit flags 0x2000007; IOKit display mode ID 0x80005000 usable for desktop GUI, uses OpenGL acceleration display 2: brightness 0.517021
bash-3.2# brightness -d 0 0.1 brightness: failed to set brightness of display 0x42bf888 (error -536870201)
BTW display 1 and 2 are external thunderbolt monitors and do work.