Light Sensor
NOTE: The contents of this page are not set in stone, and are subject to change! This page is a draft in active flux ... |
A light sensor is built into the XO-1.75.
XO-1.75 B1 has a restricted form of the feature, in that the wireless activity indicator is affected by the sensor, and any future use of the storage indicator will affect the sensor.
XO-1.75 A3 has a restricted form of the feature, in that the sensor is affected by the battery and power LED.
The sensor is managed by the embedded controller, and is averaged and updated roughly every two seconds.
Testing
In OpenFirmware at the Ok prompt, type als@ .d (cr d# 200 ms many and press enter.
Programming
- your program must read /sys/devices/platform/olpc-ols.0/power_state and parse the result as an integer,
- your program should avoid reading power_state at a rate more than the sample rate the sensor is configured for, because this consumes extra power by making the CPU and the EC more busy,
Internals
The sensor is a reverse biased LED. The EC charges the LED as if it is a capacitor, and then times how long it takes to discharge. The discharge time is mostly related to the ambient light, and slightly related to operating temperature of the embedded controller.
XO-1.75 B1 Restriction
The sensor is adjacent to the wireless indicator. The EC disables the wireless indicator while taking a sample. The storage indicator, if it is used, may affect the sample.
XO-1.75 A3 Restriction
The sensor is adjacent to the battery indicator, and as a result generates distorted samples when the laptop is connected to a DC power cable.
References
- (yet to be released) runin-light-sensor script for testing data stream from sensor,
- kernel implementation,
- embedded controller implementation
- OpenFirmware implementation