Il 25/02/23 19:00, Carlos E. R. ha scritto:
On 2023-02-25 14:07, Marco Calistri wrote:
Il 24/02/23 18:34, Carlos E. R. ha scritto:


El 2023-02-19 a las 12:56 -0000, Marco Calistri escribió:

> Not enough scripting skill may be.

I can help with that.

> Besides that I want something "less experimental", something like "plug and play", since I already tested several solutions which have
> failed.

> Inviato da Outlook per Android

Try (/usr/lib/systemd/system-sleep/mine-brightness):


#!/bin/bash

LOGGER=/usr/bin/logger

# $1: "pre" is hibernating. "post" is recovering.

case $1 in
     post)
        $LOGGER -t mine-brightness -p daemon.info "Restoring brightness after hibernating/suspend."
    echo -n 1 > /sys/class/backlight/acpi_video0/brightness
        ;;
esac

I have not tested this.

If the script runs, you will see that message in the journal and/or syslog.


/usr/lib/systemd/system-sleep/mine-brightness must be marked executable, I understand.


Hi Carlos,

Thanks for the script, I'm testing it.

But, don't I need to enable it as a systemd service?

First attempt, just after creating the script and entering in suspend mode, without exiting or rebooting the system, has failed: brightness set to max!

Logger has wrote the following into my journal:

feb 25 09:55:29 linux-turion64.ddns.net mine-brightness[5433]: Restoring brightness after hibernating/suspend.

Then it is working as expected.

You just have to write the brightness you want it to set. It is your own line you posted previously:

echo -n 1 > /sys/class/backlight/acpi_video0/brightness

Experiment with different numbers till you get the brightness you prefer.

It does nothing on reboot.


I would have to change your affirmation as follows:

The script works as expected by writing the comments on the system log, but in the reality it does not adjust the brightness to the same value (which is 1) set at boot by the script I added into my /etc/init.d/after.local:

#!/bin/sh
#old script
#echo -n 700 > /sys/class/backlight/intel_backlight/brightness
#new script
echo -n 1 > /sys/class/backlight/acpi_video0/brightness

To be more clear: the setting of acpi_video0 brightness works at boot but it does not work after suspend, in fact in this case it goes at very high intensity so that I need to adjust it manually.

In any case I thank you a lot for your attention!

Best regards,


-- 
Marco Calistri
Build:  openSUSE Tumbleweed 20230224 
Kernel: 6.1.12-1-default - XFCE: (4.18.1)