You are not logged in.

#1 2013-07-22 20:59:25

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

laptop-mode-tools no longer adjusts LCD brightness

I just discovered that laptop-mode-tools no longer adjusts the brightness of the LCD when switched to battery. This is not a general issue. laptop-mode is active on battery (as well as being enabled via the systemd service), the computer knows it is on battery (checking with on_ac_power and reading from /sys/class/power_supply/*/* give the expected results) and other things are correctly adjusted e.g. bluetooth is blocked with rfkill. Moreover, as root I can adjust the brightness in the usual way by hand:

echo 10  >| /sys/class/backlight/acpi_video0/brightness

works just fine. The >| is needed because for interactive shell's, root's .bashrc sets noclobber. This obviously doesn't affect laptop-mode tools because it doesn't run an interactive shell. In contrast:

$ cat /etc/laptop-mode/conf.d/lcd-brightness.conf | grep -v "^#"

DEBUG=1

CONTROL_BRIGHTNESS=1

BATT_BRIGHTNESS_COMMAND="echo 7"
LM_AC_BRIGHTNESS_COMMAND="echo 10"
NOLM_AC_BRIGHTNESS_COMMAND="echo 12"
BRIGHTNESS_OUTPUT="/sys/class/backlight/acpi_video0/brightness"

DEBUG wasn't 1 when the problem started. I tried setting it to get more info but haven't found anything more in the journal/logs.

KDE is set to not touch the default brightness at all. All it does is (further) dim the display after so many minutes depending on the power supply and status.

This did work fine but I haven't been on battery for a while so I'm not sure when exactly it stopped working. My brightness is set by default to 12 on boot or wake from sleep which suggests laptop-mode tools does something or something else is now handling this which I'm not aware of. But the switch to battery does not trigger any alteration in the brightness and laptop-mode status does not even mention LCD brightness as one of the things laptop-mode tools controls.

Have I missed a change in how this is handled somewhere?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#2 2013-07-22 21:13:30

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: laptop-mode-tools no longer adjusts LCD brightness

This is better placed in Laptop Issues... Moving.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-07-23 01:50:01

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: laptop-mode-tools no longer adjusts LCD brightness

Thanks. Sorry, it started as a thread about a different issue which seemed very newbie but halfway through writing it I realised what an idiot I was so I turned it into the second thread I planned to start and forgot I probably wanted a different forum. Thanks for moving it.

I think this issue is related to sleep/wake. If I remove the power while the laptop is awake and then replace it, all is well - 12 -> 10 -> 12. But if I put the laptop to sleep on power and wake it on battery, laptop-mode fails to adjust the brightness even if I have systemd restart the service and even though it does make adjustments for other things.

This is what is puzzling me: I would think there could be three possible problems
1. it realises it is on battery, it tries to do everything but there's a problem adjusting the backlight - it tries and fails
2. it realises it is on battery but it does nothing - makes no adjustments at all because although the computer knows it is on battery, laptop-mode isn't enabled or it isn't activated or...
3. it fails to realise it is on battery  and so does nothing - it makes no adjustments because the laptop doesn't recognise the power supply has changed at all

It isn't (1) because there are no errors and it has no problem adjusting the battery if it is awake when AC switches to battery.

It isn't (2) because laptop-mode is enabled and it does get activated and other adjustments (e.g. soft blocking bluetooth) get made.

It isn't (3) because the laptop does recognise the power change, triggering the activation of laptop-mode etc.

So what is (4)? What else could it be?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#4 2013-07-25 20:46:27

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: laptop-mode-tools no longer adjusts LCD brightness

I doubt this is related but it is currently my only lead so here goes. I set the LCD brightness control for debug so I've been trying to watch it. However, so far it is all smiles e.g. on boot it all works fine and says so.

However, I found I'm getting another error on boot which is

/usr/share/laptop-mode-tools/modules/pcie-aspm: line 10: write error: Operation not permitted

Note that I copied that by eye from VT1 so if a colon is out of place, that's why.

The contents of that file is:

#! /bin/sh
#
# Laptop mode tools module: PCIe Active State Power Management
#

if [ x$CONTROL_PCIE_ASPM = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_PCIE_ASPM = xauto ]; then
    if [ $ON_AC -eq 1 ]; then
        log "VERBOSE" "On AC power: setting pcie_aspm to default"
        if [ -f /sys/module/pcie_aspm/parameters/policy ]; then
            echo default > /sys/module/pcie_aspm/parameters/policy
            if [ $? -eq 0 ]; then
                log "VERBOSE" "PCIe ASPM set to 'default'"
            else
                log "VERBOSE" "PCIe ASPM tweaking is prohibited by the kernel"
            fi
        else
            log "VERBOSE" "PCIe ASPM is not available"
        fi
    else
        log "VERBOSE" "On battery: setting pcie_aspm to powersave"
        if [ -f /sys/module/pcie_aspm/parameters/policy ]; then
            echo powersave > /sys/module/pcie_aspm/parameters/policy
            if [ $? -eq 0 ]; then
                log "VERBOSE" "PCIe ASPM set to 'powersave'"
            else
                log "VERBOSE" "PCIe ASPM tweaking is prohibited by the kernel"
            fi
        else
            log "VERBOSE" "PCIe ASPM is not available"
        fi
    fi
else
    log "VERBOSE" "PCIe ASPM power savings module is disabled"
fi

So I assume it is saying it cannot write to /sys/module/pcie_aspm/parameters/policy but the permissions etc. on that, at least, don't look strange:

l /sys/module/pcie_aspm/parameters/
total 0
drwxr-xr-x 2 root root    0 Gor  25 21:24 ./
drwxr-xr-x 3 root root    0 Gor  25 21:23 ../
-rw-r--r-- 1 root root 4.0K Gor  25 21:24 policy

Last edited by cfr (2013-07-25 20:47:13)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-09-12 01:44:41

mpj
Member
Registered: 2013-09-12
Posts: 3

Re: laptop-mode-tools no longer adjusts LCD brightness

I have the same issue, but at least it seems that we're not going to see the error anymore tongue

Offline

#6 2013-09-12 02:04:13

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: laptop-mode-tools no longer adjusts LCD brightness

Thanks for the link - so is the error merely cosmetic?

I've noticed I also now sometimes have trouble with the switch back to AC i.e. the brightness isn't adjusted. Sometimes this happens even if I'm on AC the whole time and the dimming is just because I've not touched the keyboard or mouse in a while. So I wonder if this even has anything to do with laptop-mode-tools - though I can't think what else?

Last edited by cfr (2013-09-12 02:04:44)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#7 2013-09-12 02:15:19

mpj
Member
Registered: 2013-09-12
Posts: 3

Re: laptop-mode-tools no longer adjusts LCD brightness

I don't know really, I have issues with power management myself tongue

Offline

#8 2013-09-13 00:04:16

bazmonkey
Member
Registered: 2010-11-03
Posts: 21

Re: laptop-mode-tools no longer adjusts LCD brightness

Check out https://bbs.archlinux.org/viewtopic.php?id=168361  You might have the same issue.  Does 'acpi -i' report the correct state?

FYI, I posted on that thread that a recent kernel fix had fixed this issue for me.  It didn't.  I have no idea why this problem only recently showed itself, nor why it won't go away.  After the last week it seemed to work correctly for a couple days before stopping again.

A battery/BIOS reset fixes it, but it will break again after a suspend or restart.

Do you have a samsung?

Offline

#9 2013-09-13 00:30:17

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: laptop-mode-tools no longer adjusts LCD brightness

Thanks but that's definitely not it. I have no problems suspending or resuming on lid close/wake.

No, I don't have a Samsung - specs are in my signature wink.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#10 2013-09-13 06:26:15

mpj
Member
Registered: 2013-09-12
Posts: 3

Re: laptop-mode-tools no longer adjusts LCD brightness

I really should investigate more, but it seems my problems dissapeared after uninstalling pm-utils... probably something was conflicting with systemd or laptop-mode-tools

Offline

#11 2013-09-13 06:36:11

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: laptop-mode-tools no longer adjusts LCD brightness

mpj wrote:

I really should investigate more, but it seems my problems dissapeared after uninstalling pm-utils... probably something was conflicting with systemd or laptop-mode-tools

I think cfr already masks all the scripts from pm-utils.  Like systemd, the things in /etc/pm-utils/*.d take priority over files of the same name in /usr/lib/pm-utils/*.d.  So if you either make symlinks to /dev/null or simply create empty files, you are essentially disabling all functionality of pm-utils.

Besides, laptop-mode-tools actually is just a set of scripts, and its changing of the backlight level on A/C simply writes the desired value into /sys/class/backlight/*/backlight in response to the udev generated plug event.  So it should have nothing to do with pm-utils.

Offline

#12 2013-09-13 21:33:30

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: laptop-mode-tools no longer adjusts LCD brightness

I mask everything in power.d and some of the contents of sleep.d. Unfortunately, I can't uninstall pm-utils as KDE still requires it. Someday...


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB