How to turn off the backlight of the screen when the lid of my laptop is closed?

0

I want to use an old laptop(Dell E5420) as a CentOS7 server in my home, so it is not required at all to operate it on the console, and certainly there is no X-server or other GUI on it.

When it is running, the screen(monitor) always emits some annoying light. I can not simply close the lid, because this will suspend the computer. To prevent it from suspending when the lid is closed, I configured the HandleLidSwitch option of the /etc/systemd/logind.conf to ="ignore". It works, that the system does not suspend when the lid is closed, but the back-light of the screen still is on, and very glaring especially at night.

It is not only annoying, but also consuming power and lifetime of the screen unnecessarily. I tried "setterm -blank 1 -powersave powerdown". If I issue this command on the console, it works, but does not if through a remote ssh terminal("setterm -blank 1 -powersave powerdown >> /dev/tty0" doesn't work also). If I issue the command through a pseudo terminal(ssh), the result is "

setterm: cannot (un)set powersave mode: Inappropriate ioctl for device

".

My ultimate purpose is put this command into a startup script or a systemd.service that will run once the system has started.

My question is : Is there a way in it I can turn off the backlight of the screen without logging-in the console of the laptop?

Btw, I tried to install vbetool but failed, maybe I should use another repo of yum?

Thanks a lot! Sorry for my English, I'm a Chinese.

Leon

Posted 2019-03-04T08:09:03.677

Reputation: 3

try this: echo 0 | sudo tee /sys/class/backlight/intel_backlight/brightness – DDS – 2019-03-04T09:55:02.043

Answers

0

To set power saving on boot, you can put the commands in /etc/rc.local . Edit it manually, or:

echo 'setterm -blank 1 -powersave powerdown' >>/etc/rc.local

To prevent the "Inappropriate ioctl" message when running it via SSH, you also need to set stdin to the terminal you're trying to control:

setterm -blank 1 -powersave powerdown >/dev/tty0 </dev/tty0

PS your English is excellent, as good as most native English speakers. :)

Loops

Posted 2019-03-04T08:09:03.677

Reputation: 1

Thanks for your help! But they all don't work. – Leon – 2019-11-12T11:51:39.270