Open xorgy opened 6 years ago
Maybe indeed the way it was done is the better way then? Also searching for the illuminance channel? I guess it should be scanned for only in an "init" though.
Yeah, it would involve adding some state, but you could just have an init enumerate the devices, decide which one makes sense, and put that path somewhere get_ambient_light()
can find it.
Currently, brightml assumes that the illuminance/ambient light sensor is iio:device0. IIO is used for all sorts of sensors, including generic volt meters/ADCs, current meters, accelerometers, humidity sensors, pressure sensors (both atmospheric and mechanical), temperature sensors, orientation sensors, fused IMUs, magnetometers, generic counters, pedometers (including step counters, distance estimators, activity type estimators), exercise monitors (i.e. energy/caloric throughput) capacitance sensors, odometers, chemical concentration detectors, resistance sensors, pH sensors, electrical conductivity sensors (in S/m), and potentially more things in the future.
As such, I think it would be a good idea to look for the first iio device with an illuminance channel, and read that instead of relying on it being device0. I will try to find a real device which has more than one iio device, to give this a genuine spin.