So reading a Macbook’s ambient light sensor in Linux is just reading off /sys/class/hwmon/hwmon2/device/light – That seems easy and good, a far cry from having to write a C program.
The problem? Linux’s granularity of the read is way too low.
In MacOSX, the sample program returns numbers in at least the hundreds range. I can see the numbers change if I try very hard to cover where I think the sensors are. I get nonzero readings even in late afternoon when the room is nearly dark. In MacOSX, the light sensors felt super sensitive.
In Linux, the kernel returns an ordered pair like (12, 0) if I turn on my bright spotlights. If you put a piece of tape over the the webcam like a lot of people do, you get something more like (9, 0).
First disturbing thought: No matter what the ambient lighting looks like, Linux gives you zero for the right-hand-side sensor.
Even more disturbing: If I turn on just my regular 60W light I get all zeroes. From Linux’s point of view there’s no difference between no ambient light at all and having about 800 lumens dispersed in a small room. Heck, I get zero even during the day, right next to a window (so I live in an apartment – we get crappy lighting in apartments, but still). Compared to MacOSX, in Linux the light sensors seem so insensitive they are practically useless.
If we get zero even during the day, what point is reading from the light detectors? I can’t even tell night from day, or a darkened lecture hall from a brightly-lit classroom.
Short of reading the kernel source code is there even a way to figure out why granularity is so low?