View previous topic :: View next topic |
Author |
Message |
alogim Tux's lil' helper

Joined: 21 Aug 2015 Posts: 127
|
Posted: Fri Oct 05, 2018 7:40 am Post subject: Ambient light sensor to dynamically adjust screen brightness |
|
|
Good morning everyone. I am a (sofar) happy owner of an HP EliteBook 850 G5. Now, this laptop comes with an in-built ambient light sensor on the top of the screen. When I tried the Ubuntu live, it used to work smoothly (whenever the ambient light changed, the screen brightness changed as well).
I would like to be able to get this on Gentoo as well, taking into account the fact that I am currently using Xfce4.
I can see the sensor listed under /sys/bus/iio/devices and under /dev:
Code: |
➜ / ls /sys/bus/iio/devices
iio:device0 trigger0
➜ / ls /dev | grep iio
iio:device0
| If I enter directory iio:device0, I can see the following: Code: | ➜ iio:device0 ls
buffer in_illuminance_hysteresis in_illuminance_raw in_illuminance_scale in_intensity_hysteresis in_intensity_sampling_frequency name scan_elements trigger
dev in_illuminance_offset in_illuminance_sampling_frequency in_intensity_both_raw in_intensity_offset in_intensity_scale power subsystem uevent |
Is there a way I can write some kind of utility to manage brightness according to the values available there? Could anyone help me with this? _________________ Desktop: i5-3570k - 2x4 GB - Sapphire HD 7950 Dual-X - 500 GB WD Caviar Black - Dell SE2717H 27"
Laptop: HP EliteBook 850 G5 - i7-8550U - 1x16GB - Intel UHD 620 - 512 GB Samsung NVMe SSD
Phone: OnePlus 5T - SD835 - 8 GB - Adreno 540 - 128 GB |
|
Back to top |
|
 |
Fitzcarraldo Veteran


Joined: 30 Aug 2008 Posts: 1774 Location: United Kingdom
|
Posted: Fri Oct 05, 2018 10:26 am Post subject: |
|
|
There is a kernel module hp-wmi for controlling various things in HP laptops, including the ambient light sensor. If it is not already configured in your kernel, you could configure it (CONFIG_HP_WMI=m) and load the module to see if that works ('modprobe hp-wmi' then 'echo 1 > /sys/devices/platform/hp-wmi/als' to enable the ALS). But, as you say it is working in Ubuntu, before you reconfigure and rebuild your kernel in Gentoo I suggest you boot an Ubuntu LiveCD or LivePendrive to check whether or not the hp-wmi module is loaded in Ubuntu ('lsmod'). _________________ Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
 |
Fitzcarraldo Veteran


Joined: 30 Aug 2008 Posts: 1774 Location: United Kingdom
|
|
Back to top |
|
 |
alogim Tux's lil' helper

Joined: 21 Aug 2015 Posts: 127
|
Posted: Fri Oct 05, 2018 11:44 am Post subject: |
|
|
Fitzcarraldo wrote: | There is a kernel module hp-wmi for controlling various things in HP laptops, including the ambient light sensor. If it is not already configured in your kernel, you could configure it (CONFIG_HP_WMI=m) and load the module to see if that works ('modprobe hp-wmi' then 'echo 1 > /sys/devices/platform/hp-wmi/als' to enable the ALS). But, as you say it is working in Ubuntu, before you reconfigure and rebuild your kernel in Gentoo I suggest you boot an Ubuntu LiveCD or LivePendrive to check whether or not the hp-wmi module is loaded in Ubuntu ('lsmod'). |
I forgot to say that I wrote down all modules used by Ubuntu as well, so I enabled hp_wmi in the kernel right when I installed it. I also had to enable ACPI_ALS and HID_SENSOR_ALS.
If I try to echo 1 on that file (which exists), I get the following error: Code: | bash: echo: write error: Invalid argument | If I try to open the file with nano, I get Code: | [ magic_file(als) failed: cannot read `als' (Invalid argument) ] |
_________________ Desktop: i5-3570k - 2x4 GB - Sapphire HD 7950 Dual-X - 500 GB WD Caviar Black - Dell SE2717H 27"
Laptop: HP EliteBook 850 G5 - i7-8550U - 1x16GB - Intel UHD 620 - 512 GB Samsung NVMe SSD
Phone: OnePlus 5T - SD835 - 8 GB - Adreno 540 - 128 GB |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|