본문 바로가기

개발자/Raspberry Pi3

라즈베리파이 화면 꺼짐 중지, Disable Screen Saver In Raspberrypi

라즈베리파이가 화면이 10분 정도 지나면 블랙화면으로 꺼진다. 아예 스크린 세이버가 동작하지 않게 하기로 한다.

아래 명령어를 실행하여 파일을 수정한다.

pi@raspberrypi:~ $ sudo nano /etc/kbd/config 

 

/etc/kbd/config 파일을 열어서 맨뒤에 

BLANK_TIME=0 
POWERDOWN_TIME=0 

두 줄을 추가한다. 전혀 안된다. 10분 정도 지나니 모니터(Installing LCD 7 (B) to Raspberry Pi 3 터치스크린 LCD 설치: https://fishpoint.tistory.com/3416)가 꺼진다.

 

다시 바로 아래 명령어를 실행하여 스크린 세이버를 실행시켜 동작이 안되게 하니 잘 되긴 하는데 x윈도우 환경에서만 잘되고 터미널 환경에서는 여전히 10분 정도 지나면 모니터가 꺼진다.

 

$sudo apt-get update 
$sudo apt-get install xscreensaver

In the [Display Mode] tab, set like this - Mode: [Disable Screen Saver]

 

다시 텍스트 콘솔로 부팅하여 시도한다. 

$setterm -blank 0

$setterm -powerdown 0

하니 10 분이 넘어도 안꺼진다. 다시 아래 파일을 열어서 

$sudo nano /boot/cmdline.txt

 

다음 명령어를 맨뒤에 추가한 후 리부팅한다.

consoleblank=0

결과는? 잘됨. OK

 

아래 설명을 보고 다른 여러가지를 시도해보실 분은 자유!

 

아래 질문이 올라온 링크 - https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=57552

Howto: Disable Screen Saver In Raspbian I became very frustrated in my attempts to disable the screen saver. I finally found that there are two steps to this.

 

The bash (shell) text terminal has its own blanking software, while the Xserver uses independant graphic settings.

To add to the frustration, many recommendations just don't work on the Raspbian version of Debian, or (as I found out) Raspbian used different files.

 

To view your Xsession screen saver setting, use this command (must be used from xterminal) xset q In brief, this is what must be done for Raspbian...

Disable text terminals from blanking
change two settings in /etc/kbd/config 
BLANK_TIME=0
POWERDOWN_TIME=0

Disable Xsession from blanking
Additional info https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling
Add these lines to /etc/xdg/lxsession/LXDE/autostart
@xset s noblank 
@xset s off 
@xset -dpms

Here is a script that will permanently disable Xsession blanking
no_blank.sh

#!/bin/bash

NOBLANK="
@xset s noblank
@xset s off
@xset -dpms
"

  # Pretty ANSI text colors
  OFF="\033[0m"
  BOLD="\033[1m"
  DIM="\033[2m"
  RED="\033[1;31m"
  GREEN="\033[1;32m"
  YELLOW="\033[1;33m"
  BLUE="\033[1;34m"

  clear
  printf "\n\n\t $YELLOW           "; date ; printf "$OFF"
  printf "\n $GREEN"
  printf "\t +------------------------------------------------+\n"
  printf "\t |                  no_blank.sh                   |\n"
  printf "\t |                rev Oct 1, 2013                 |\n"
  printf "\t |                                                |\n"
  printf "\t |  by: Jan Zumwalt - net-wrench.com              |\n"
  printf "\t |                                                |\n"
  printf "\t |  This script permanently disables the xsession |\n"
  printf "\t |  screen saver for RASPBIAN PI OS. It allows    |\n"
  printf "\t |  the user to abort before any change is made.  |\n"
  printf "\t +------------------------------------------------+$OFF\n\n"

  printf "\t This program will disable your xsession\n"
  printf "\t screen saver permanently, is this what \n"
  printf "\t you really want to do? $YELLOW<y/n>$OFF"; read -n 1 KEYIN

  if [[ $KEYIN == "N"  ||  $KEYIN == "n" ]]; then
    printf "\n\n\t OK, I quit and did not do anything.\n\n"
    exit 0
  fi

  printf "\n\n\t I intend to modify your current \n"
  printf "\t /etc/xdg/lxsession/LXDE/autostart \n"
  printf "\t I will add the$GREEN GREEN$OFF lines to the file...\n\n"

  printf "$DIM\n"
  pr -t -o 9 /etc/xdg/lxsession/LXDE/autostart
  printf "$OFF$GREEN$NOBLANK" | pr -t -o 9
  printf "$OFF\n\n" 

  printf "\t Is this really what you want to do? $YELLOW<y/n>$OFF"; read -n 1 KEYIN

  if [[ $KEYIN == "N"  ||  $KEYIN == "n" ]]; then
    printf "\n\n\t OK, I quit and did not do anything.\n\n"
    exit 0
  fi

  cat /etc/xdg/lxsession/LXDE/autostart > /etc/xdg/lxsession/LXDE/autostart.`date +%m-%d-%Y_%I:%M:%S`
  printf "\n\t Created backup copy of the autostart file...\n"
  printf "$NOBLANK" >> /etc/xdg/lxsession/LXDE/autostart

  printf "\t Your new file looks like this\n"
  printf "$DIM\n"
  pr -t -o 9 /etc/xdg/lxsession/LXDE/autostart
  printf "$OFF\n\n"

  printf "\t$RED Modified file. Screensaver is now disabled.$OFF\n"

  # required so xterm will not close
  printf "\n\t press any key to exit: "; read -n 1 KEYIN
  printf "\t$GREEN Program ended normaly $OFF\n\n"

다른 최고의 해결책!

 

The easiest way to disable screen blanking in the Raspbian GUI is to install xscreensaver then configure it to disabled.

sudo apt-get update
sudo apt-get install xscreensaver

In the [Display Mode] tab, set like this - Mode: [Disable Screen Saver]

 

다음은 참고로 라즈베리파이 칸피그레이션의 내용을 찾아 올려둔다. 

Setting the screen saver/screen blanking
내용출처: https://www.raspberrypi.org/documentation/configuration/screensaver.md

On the Console
If you are using the Raspberry Pi solely on the console (no desktop GUI), you need to set the console blanking. The current setting, in seconds, can be displayed using

cat /sys/module/kernel/parameters/consoleblank

Here, consoleblank is a kernel parameter. In order to be permanently set, it needs to be defined on the kernel command line.

sudo nano /boot/cmdline.txt

 

Add consoleblank=0 to turn screen blanking off completely, or edit it to set the number of seconds of inactivity before the console will blank. Note the kernel command line must be a single line of text.

On the Raspberry Pi Desktop
By default, the Raspberry Pi Desktop does not have any easy-to-use screensaver software installed, although the screensaver is enabled. Firstly, you should install the X Windows screensaver application.

sudo apt-get install xscreensaver

 

This may take a few minutes.

Once this has been installed, you can find the screensaver application under the Preferences option on the main desktop menu. This provides many options for setting up the screensaver, or disabling it completely.

 

x윈도우에서 커맨드 창을 열고 아래와 같은 명령을 실행하면 xset, 즉 x 윈도우의 각종 환경을 보인다. 참고하시기를 바란다.

 

$xset q

 

아래와 유사한 화면이 보인다. 

Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  auto repeating keys:  0000000000000000
                        0000000000000000
                        0000000000000000
                        0000000000000000
  bell percent:  50    bell pitch:  400    bell duration:  100
 
Pointer Control:
  acceleration:  2 = 2 / 1    threshold:  4
 
Screen Saver:
  prefer blanking:  no    allow exposures:  no
  timeout:  0    cycle:  0
 
Colors:
  default colormap:  0x8006e    BlackPixel:  0    WhitePixel:  1
 
Font Path:
   /usr/lib/X11/fonts/,/usr/lib/X11/fonts/75dpi/,/usr/lib/X11/fonts/100dpi/,/usr/
lib/X11/fonts/oldx10/,/usr/lib/X11/fonts/oldx11/,/usr/lib/X11/fonts/bmug/,/usr/l
ib/X11/fonts/info-mac/,/usr/lib/X11/fonts/JP/,/usr/lib/X11/fonts/misc/

 

이미지 출처: 유튜브 링크 https://www.youtube.com/watch?v=b3_dNun1g00