将driver/char/vt.c中的blankinterval值改成0。
2、应用层解决
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/ioctl.h>
int main()
{
int f;
f = open("/dev/tty1", O_RDWR);
write(f, "\033[9;0]", 8);
close(f);
return 0;
}
/etc/rc.local
echo -en "\\033[9;0]" > /dev/tty1
/* disable console. avoid console blank automatically */
system("echo -e \"\033[9;0]\" > /dev/tty1");
解释:
该系统调用相当于setterm -blank 0,详见setterm命令的源码,其中
/* -blank [0-60]. */
if (opt_blank && vcterm)
printf("\033[9;%d]", opt_bl_min);
也可以见Vt.c (drivers\char): case ']': /* setterm functions */
http://blog.chinaunix.net/uid-14009064-id-4115712.html
同时可以参考
我试过用
在 /etc/rc.local 中加入: 你可以任意替换tty号码 | 但不能在REBOOT后保持。 找到了以下方法供你参考: