Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control LCD backlight on OS X beyond system API

Tags:

macos

cocoa

Apple's I/O kit (via IODisplaySetFloatParameter) allows you to set the display brightness within a given range. However, I remember my prior laptops being significantly dimmer at the lowest setting.

Various screen dimming utilities alter the Gamma settings, and this brings the display down even further. However, the qualitative difference in the change and how such these utilities use RGB tables leads me to suspect that the Gamma setting ONLY alters the color tables, not the LED backlight.

Does anyone know of private API's (or how I would find them) that let me set the display to something lower than what IODisplaySetFloatParameter allows?

like image 659
Indolering Avatar asked Jul 13 '13 00:07

Indolering


1 Answers

The hardware for this kind of thing tends to use PWM (Pulse Width Modulation), since LEDs are not inherently dimmable; that is, the hardware will switch the LEDs off and on very quickly, ensuring that when it is set to maximum brightness the LEDs are on 100% of the time, while at minimum brightness the LED will actually be switched off for most of each cycle.

That leads to the following observation: there is no particular reason you can't implement your own PWM in software, toggling the backlight on and off and controlling the proportion of the time it spends in each state. The downside is that you want to do this toggling fast to avoid it looking like flickering, and that will burn some CPU. You might want to investigate whether it's best to let the hardware PWM run as well as yours (since then yours can run somewhat slower), by setting the display brightness at a value other than 100% for the “on” part of the cycle.

Anyway, just an idea.

like image 166
al45tair Avatar answered Oct 22 '22 08:10

al45tair