In Linux, LCD is generally output as the terminal. At this time, if it is not operated for a long time, the LCD will be automatically closed.At this time timeout.

Let’s take a look at how the specific code operates:

  Drivers/tty/vt/vt.cIn the file

  static int blankinterval = 10*60;

This means that the default timeout is 10 minutes

  case 9: /* set blanking interval */

  blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60;




  case 10: /* set bell frequency in Hz */

This function is set timeout time, if set to 0, no timeout

  if (blankinterval) {

  blank_state = blank_normal_wait;

  mod_timer(&console_timer, jiffies + (blankinterval * HZ));


If the Blankinterval is 0, the function in the timer is not turned on the timer is the switching LCD.

If we fix the Blankinterval in the kernel, it is too rigid, so we recommend operating on the application layer

  method one:

  echo -e "\033[9;0]" > /dev/tty0

Here is setting the BLANKINTERVAL equal to 0, if used

   echo -e "\033[9;1]" > /dev/tty0

Setting BlankInterval is equivalent to 1 minute

Method two:

The method of using C programs,




  int main()


  int f;

  f = open("/dev/tty0", O_RDWR);

  write(f, "\033[9;0]", 8);


  return 0


  Remarks: If you write it (f, & quot;/033 [9; 0] & quot; 8);, this is wrong

  Note: No matter what method is used, pay attention to the operation/dev/console/dev/fb0/dev/ttyo0, only tty0 tty1 r n

 In addition, CODE contains the PATCH

below to add debugging in Kernel.

  [root@YuGe-AM1808 /test/hxzd]#./lcd-nosleep

  [ 13.634552] ---ALL---DBG---file=vt.c,func=setterm_command,line=1524++++ blankinterval=0,vc->vc_par[1]=0

  [root@YuGe-AM1808 /test/hxzd]#

  [root@YuGe-AM1808 /test/hxzd]#echo -e "\033[9;0]" > /dev/tty0

  [ 135.126953] ---ALL---DBG---file=vt.c,func=setterm_command,line=1524++++ blankinterval=0,vc->vc_par[1]=0

  [root@YuGe-AM1808 /test/hxzd]#

Tags: Array