A slightly different topic, but I hope this may be helpful to others in the future.
I had a similar issue, but I was looking for IODisplayConnect for the purposes of reading the display brightness.
On a M1 Mac with Big Sur, I found the easiest way to get the brightness info is by running corebrightnessdiag (this can also read keyboard backlight brightness):
$ /usr/libexec/corebrightnessdiag status-info | grep 'DisplayServicesBrightness '
DisplayServicesBrightness = "0.9302966";
To get and set brightness from code, you can use private APIs from the DisplayServices framework (/System/Library/PrivateFrameworks/DisplayServices.framework):
extern int DisplayServicesGetBrightness(int display, float *brightness);
extern int DisplayServicesSetBrightness(int display, float brightness);
/* Change brightness */
float brightness = 0.8;
int err = DisplayServicesSetBrightness(1, brightness);
/* Get current brightness */
err = DisplayServicesGetBrightness(1, &brightness);
Topic:
App & System Services
SubTopic:
Drivers
Tags: