在程序中系统调用如下两个命令,可以关闭显示器。
1,xset dpms force off
2,system("vbetool dpms off");
因为应用要在ubuntu开机启动时启动,放在了/etc/rc.local里面。每次调用xset关闭显示器,总报错误:
xset: unable to open display ""
开始以为初始化问题,试了很多方法都不行。后来替换成了vbetool,非常好用。