How to make the ambient light sensor work on Asus Zenbook UX303?

Solution 1:

First install the Asus Zenbook Ambient Light Sensor Driver. You can do this using DKMS.

cd /usr/src
sudo wget https://github.com/danieleds/als/archive/master.tar.gz && \
  sudo tar xvf master.tar.gz
sudo dkms add -m als -v master
sudo dkms install -m als -v master
sudo echo als >>/etc/modules

After that install the Asus Zenbook Ambient Light Sensor Controller.

Pick a folder to install it in. I like to use /home/username/bin.

cd /home/username/bin
git clone https://github.com/danieleds/Asus-Zenbook-Ambient-Light-Sensor-Controller.git
cd Asus-Zenbook-Ambient-Light-Sensor-Controller/service

Then on 64 bit systems run:

qmake als-controller.pro -r -spec linux-g++-64

Or on 32 bit systems run:

qmake als-controller.pro -r -spec linux-g++

then run

make

The generated binary file, als-controller, is what will monitor the light sensor.

How to use

Launch als-controller with root privileges, for example: sudo ./als-controller. This will be the service that monitors the light sensor. Use the same program with user privileges, als-controller, to control the service. Some examples:

./als-controller -e     // Enable the sensor
./als-controller -d     // Disable the sensor
./als-controller -s     // Get sensor status (enabled/disabled)

For an ideal integration with your system, it is a good idea to start the service at boot (run als-controller as root), and then bind the script switch.sh (in the example folder) to a keyboard shortcut.

Solution 2:

I've created another one implementation https://github.com/mikhail-m1/illuminanced, with luminance filtration and tunable settings, also it works with build in kernel driver. Tests on Ubuntu 16.4.