ALS wakes up the suspended Ubuntu

Asked by Hrishikesh Kadam

After suspending the Laptop, ALS (Ambient Light Sensor) is waking it up.

Wanted to disable the ALS, but unable to edit /sys/devices/platform/hp-wmi/als even in root.
> sudo su
> echo 0 > /sys/devices/platform/hp-wmi/als
bash: echo: write error: Invalid argument

System Information -
Product Name: HP ZBook Studio x360 G5
SKU Number: 5LA90PA#ACJ

OS Information -
> uname -a
Linux *** 5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon Jan 18 17:52:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> lsb_release -rd
Description: Ubuntu 20.04.2 LTS
Release: 20.04

Edit 1 -
I eventually found out how to disable ALS.

> sudo modprobe -rv hid_sensor_als
modprobe: FATAL: Module hid_sensor_als is in use.

So, I blaclisted hid-sensor-als by appending following text in /etc/modprobe.d/blacklist.conf -
# ALS
blacklist hid-sensor-als

Restarted the system and checked if the module is really blacklisted using -
> lsmod | grep hid_sensor_als

But the issue still persists that ALS wakes up the suspended Ubuntu.
Also, BIOS doesn't have the option to disable ALS.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

for diagnostic purposes, what is the output of the commands

uname -a
lsb_release -crid
ls -l /sys/devices/platform/hp-wmi/als
file /sys/devices/platform/hp-wmi/als

Your problem look similar to https://forums.fedoraforum.org/showthread.php?318517-writing-in-sys-in-F28

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

The redicrect doesn't have sudo access. The only part of your command with sudo access is the echo part. You need to use:

echo 0 | sudo tee /sys/devices/platform/hp-wmi/als

It will then work

Revision history for this message
Hrishikesh Kadam (hrishikesh-kadam) said :
#3

@Manfred Hampl (m-hampl)
> sudo su
> uname -a
Linux *** 5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon Jan 18 17:52:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
> ls -l /sys/devices/platform/hp-wmi/als
-rw-r--r-- 1 root root 4096 Feb 9 16:59 /sys/devices/platform/hp-wmi/als
> file /sys/devices/platform/hp-wmi/als
/sys/devices/platform/hp-wmi/als: ERROR: cannot read `/sys/devices/platform/hp-wmi/als' (Invalid argument)

Also, I already saw this https://forums.fedoraforum.org/showthread.php?318517-writing-in-sys-in-F28 post but unable to understand what is the resolution out of it.

@actionparsnip (andrew-woodhead666)
> echo 0 | sudo tee /sys/devices/platform/hp-wmi/als
tee: /sys/devices/platform/hp-wmi/als: Invalid argument

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

Also the fedoraforum did not pose a solution.

A strange detail:
-rw-r--r-- 1 root root 4096 Feb 9 16:59 /sys/devices/platform/hp-wmi/als
indicates a "file size" of 4096 Bytes. Apparently this is a very special kind of device that does not allow normal file access.

It seems to me that on current systems reading or changing the value simply does not work any more.

Maybe it is possible to disable als by certain other methods (disabling the hp_wmi kernel module, or with a boot parameter).

Revision history for this message
Hrishikesh Kadam (hrishikesh-kadam) said :
#5

@Manfred Hampl (m-hampl)
Will this be a bug in Ubuntu 20.04 then?
I have just switched from Windows to Ubuntu. I am naive in Ubuntu / Linux world.
I found this something similar - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1860940

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

You can try creating a bug report, but you have to be aware that the required changes may have to be done in the kernel packages probably outside the responsibility of Ubuntu.

For additional diagnostics:

Is there any output for the commands
dmesg | grep wmi
dmesg | grep als

Revision history for this message
Hrishikesh Kadam (hrishikesh-kadam) said :
#7

> dmesg | grep wmi
[ 37.770089] hp_wmi: query 0x4 returned error 0x5
[ 37.810463] hp_wmi: query 0x4 returned error 0x5
[ 37.834427] hp_wmi: query 0xd returned error 0x5
[ 37.882147] hp_wmi: query 0x1b returned error 0x5

> dmesg | grep als
No result

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

This now looks like Bug #1806681

Revision history for this message
Hrishikesh Kadam (hrishikesh-kadam) said :
#9

Okay, I'll put this in simple words, ALS sensors are active even when Ubuntu is suspended. So any change in ambient light wakes the system.
Is there any other to tell Ubuntu that when the system is suspending, also suspend the ALS, and when the system is waking up, wake up the ALS too?

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

I assume that ALS is managed by the hp_wmi kernel module, which usually manages other functions like additional function keys and possibly also power functions.

You could try unloading the hp_wmi kernel module and check what effects this has.

sudo modprobe -rv hp_wmi

Does this turn off ALS?
If you then put your system to suspend mode, does a light change wake it up?
Are any other functions missing?

If you then reload the module with

sudo modprobe -v hp_wmi

Do the missing functions come back?

Revision history for this message
Hrishikesh Kadam (hrishikesh-kadam) said :
#11

@Manfred Hampl (m-hampl) Thank you so for your prompt replies.

I eventually found out how to disable ALS.

> sudo modprobe -rv hid_sensor_als
modprobe: FATAL: Module hid_sensor_als is in use.

So, I blaclisted hid-sensor-als by appending following text in /etc/modprobe.d/blacklist.conf -
# ALS
blacklist hid-sensor-als

Restarted the system and checked if the module is really blacklisted using -
> lsmod | grep hid_sensor_als

But the issue still persists that ALS wakes up the suspended Ubuntu.
Also, BIOS doesn't have the option to disable ALS.

Maybe Ubuntu is still entertaining the ALS in suspended mode.
I think this should be the bug.

Revision history for this message
Hrishikesh Kadam (hrishikesh-kadam) said :
#12
Revision history for this message
Bernard Stafford (bernard010) said :
#13

Use hibernate instead.
Hibernate Moves the contents of memory into swap, tells the bootloader to boot directly into the appropriate kernel, and shuts the machine down, in this state, the system does not require power.

Terminal: sudo pm-hibernate

Can you help with this problem?

Provide an answer of your own, or ask Hrishikesh Kadam for more information if necessary.

To post a message you must log in.