How To Disable frame buffer screen blanking

Summary

The virtual console will blank the LCD display on many of our boards after 10 minutes of operation and it will only come back if a key is hit on a keyboard (may of our boards don't have keyboards so you have to use a USB keyboard to unblank the screen). Screen blanking can be disabled by either turning off the frame buffer console or by setting the virtual console KD mode.

Prerequisites

Kernel with frame buffer console enabled.

Procedure

You can disable this behavior by disabling the kernel frame buffer console driver (CONFIG_FRAMEBUFFER_CONSOLE=n) or by setting the virtual console to KD_GRAPHICS mode as shown in the example below.

Examples

Example code for setting the KD_GRAPHICS mode:

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

#include <sys/ioctl.h>
#include <sys/kd.h>

int main (int argc, char **argv)
{

  int vconsole_fd; 
  vconsole_fd = open("/dev/tty0", O_RDWR);
  if (!vconsole_fd) 
  {
    fprintf(stderr,"Could not open virtual console.\n");
    exit(1);
  }

  if (ioctl( vconsole_fd, KDSETMODE, KD_GRAPHICS))
  {
    fprintf(stderr,"Could not set virtual console to KD_GRAPHICS mode.\n");
    exit(1);      
  }

  exit(0);

}