LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to disable console blanking in text mode (https://www.linuxquestions.org/questions/linux-server-73/how-to-disable-console-blanking-in-text-mode-780272/)

ShadyCraig 01-06-2010 09:05 AM

How to disable console blanking in text mode
 
Hi All,

I run a custom build of linux running kernel 2.6.24 and busybox.
At the moment I'm investigating a kernel panic.

The problem is that after 10 minutes the screen is blanked, i.e. it is still on but has been turned black. If you press a key then the command prompt is shown once again, but if the kernel has crashed then this won't work and any info about the panic is inaccessible.

So I'd like to prevent the display being blanked.
I've tried booting with 'apm=off' and 'apm=off acpi=on' kernel parameters but neither had any effect.

Any help in this matter will be gratefully received.

Thanks,
Craig

slinx 01-06-2010 09:08 AM

Have you checked your monitor for a blanking setting? It may have a setting you can configure in the OSD.

ShadyCraig 01-06-2010 09:58 AM

Thanks for your reply slinx,

I've checked the OSD for the monitor and no such setting exists.

Also I'm sure it's not the monitor as when in power saving mode the power led changes to amber but it's remaining green.

Thanks again!

slacker_et 01-06-2010 10:06 AM

Wow ! It's been years since I had to change that setting.
But I think you may want to investigate using setterm and it's -blank argument.

Code:

SETTERM(1)                                                        Linux Programmer's Manual                                                      SETTERM(1)



NAME
      setterm - set terminal attributes

SYNOPSIS
      setterm [options]

DESCRIPTION
      setterm  writes  to standard output a character string that will invoke the specified terminal capabilities.  Where possible terminfo is consulted to
      find the string to use.  Some options however (marked "virtual consoles only" below) do not correspond to a terminfo(5) capability.  In this case, if
      the  terminal  type is "con" or "linux" the string that invokes the specified capabilities on the PC Minix virtual console driver is output.  Options
      that are not implemented by the terminal are ignored.

OPTIONS
.
.
.
.
      -blank [0-60] (virtual consoles only)
              Sets  the interval of inactivity, in minutes, after which the screen will be automatically blanked (using APM if available).  Without an argu-
              ment, defaults to 0 (disable console blanking).

--ET

ShadyCraig 01-06-2010 10:14 AM

Thanks slacker_et,

Unfortunately I don't have setterm on my system but I'm having a look at the source to see what it does.
I can't just compile it as everything has to be cross-compiled for this system :-(

Cheers!

ShadyCraig 01-06-2010 10:29 AM

I've had a look at the source code for setterm and basically it prints some special characters to the terminal.
Using the command-line version of printf it's possible to emulate it.

To set the -blank option do:

Code:

printf "\033[9;%ld]" minutes
Replace 'minutes' with a value 0-60.

In my case I used 0 to disable the blanking:

Code:

printf "\033[9;%ld]" 0
Just have to wait an see it it works (ok so far).

Thanks for the pointer slacker_et!


All times are GMT -5. The time now is 05:54 AM.