我放弃了休眠调试,但我希望暂停功能可以正常工作。现在,第一次尝试暂停时,屏幕熄灭,红色 LED 开始闪烁,但 PC 已打开电源,LED 一直闪烁。我必须按下电源按钮才能唤醒它。第二次暂停时,PC 正确暂停。第三次暂停时,情况与第一次相同。依此类推。有人遇到过这种情况并修复过吗?
答案1
我编写了一个小型实用程序来自动执行关机、注销、锁定计算机、挂起和休眠。根据需要更改声音,然后编译并更改 chmod u+x 文件名。从终端运行它。我编写了一个小脚本,双击并在终端中运行。
#include <iostream>
using namespace std;
#define bold_on "\e[1m"
#define bold_off "\e[22m"
#define red_on "\033[31m"
#define reset "\033[0m"
#define yellow "\033[33m"
#define b_green "\033[1m\033[32m"
//======================================================================
int main(int argc, char *argv[])
{
char answer;
cout << b_green "\n\n Please make you choice? Any other key to quit the program. \n" reset << endl;
cout << bold_on red_on " S" bold_off reset yellow" - Shutdown the Computer" << endl;
cout << bold_on red_on " R" bold_off reset yellow" - Restart the Computer"<< endl;
cout << bold_on red_on " L" bold_off reset yellow" - Logoff the Computer"<< endl;
cout << bold_on red_on " U" bold_off reset yellow" - Suspend the Computer"<< endl;
cout << bold_on red_on " H" bold_off reset yellow" - Hybernate the Computer"<< endl;
cout << bold_on red_on " X" bold_off reset yellow" - Lock the Computer \n\n" red_on;
cin >> answer;
if( answer=='L' ) {
system("paplay /home/dad/Music/desktop-logout.wav");
system("cinnamon-session-quit");
} else if( answer=='R' ) {
system("paplay /home/dad/Music/desktop-logout.wav");
system("systemctl reboot") ;
} else if (answer =='S') {
system("paplay /home/dad/Music/desktop-logout.wav");
system("systemctl poweroff" );
} else if (answer =='U') {
system("paplay /home/dad/Music/desktop-logout.wav");
system("systemctl suspend");
} else if (answer =='X') {
system("paplay /home/dad/Music/desktop-logout.wav");
system("cinnamon-screensaver-command -l");
} else if (answer =='H') {
system("paplay /home/dad/Music/desktop-logout.wav");
system("systemctl hibernate");
}
}
这是我桌面上的脚本。
#!/bin/bash
/home/dad/LRS
exit