summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoe2011-04-20 21:38:27 +0200
committerjoe2011-04-20 21:38:27 +0200
commit4a6f646f50ecac88a4d1523ae6556689a58d045e (patch)
tree5a893b83e51f5d3fc4a55ac2c2855cdf1bfc803b /src
parentkexec done by fbgui (diff)
downloadfbgui-4a6f646f50ecac88a4d1523ae6556689a58d045e.tar.gz
fbgui-4a6f646f50ecac88a4d1523ae6556689a58d045e.tar.xz
fbgui-4a6f646f50ecac88a4d1523ae6556689a58d045e.zip
fixed kernel command line reading & fixed performShutDown / performReboot
Diffstat (limited to 'src')
-rw-r--r--src/fbgui.cpp51
-rw-r--r--src/main.cpp3
2 files changed, 28 insertions, 26 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index 2222f74..8d2135a 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -313,14 +313,14 @@ void fbgui::toggleDebugConsole() {
* @see JavascriptInterface::shutDown()
*/
void fbgui::performShutDown() {
- QProcess *process = new QProcess(this);
- QString cmd("echo o > /proc/sysrq-trigger");
- qxtLog->debug() << "[sysinfo] Script Output: try to open: " << cmd;
- process->start(cmd, QIODevice::ReadOnly);
-
- if (!process->waitForStarted())
- qxtLog->debug()
- << "[sysinfo] Script Output: process couldn't get opened";
+ QFile file("/proc/sysrq-trigger");
+ if (file.open(QIODevice::WriteOnly)) {
+ file.write("o");
+ file.close();
+ }
+ else {
+ qxtLog->debug() << "[gui] Could not open /proc/sysrq-trigger";
+ }
}
//-------------------------------------------------------------------------------------------
/**
@@ -336,14 +336,14 @@ void fbgui::performShutDown() {
* @see JavascriptInterface::reboot()
*/
void fbgui::performReboot() {
- QProcess *process = new QProcess(this);
- QString cmd = "echo b > /proc/sysrq-trigger";
- qxtLog->debug() << "[sysinfo] Script Output: try to open: " << cmd;
- process->start(cmd, QIODevice::ReadOnly);
-
- if (!process->waitForStarted())
- qxtLog->debug()
- << "[sysinfo] Script Output: process couldn't get opened";
+ QFile file("/proc/sysrq-trigger");
+ if (file.open(QIODevice::WriteOnly)) {
+ file.write("b");
+ file.close();
+ }
+ else {
+ qxtLog->debug() << "[gui] Could not open /proc/sysrq-trigger";
+ }
}
//-------------------------------------------------------------------------------------------
/**
@@ -376,24 +376,25 @@ void fbgui::prepareKexec() {
qxtLog->debug() << "[gui] Complete KCL: " << kcl;
-
QProcess *process = new QProcess(this);
QString cmdline = "kexec -l " + downloadPath.toUtf8() + "/kernel --initrd="
- + downloadPath.toUtf8() + "/initramfs --append=\"" + kcl.toUtf8() + "\"";
- qxtLog->debug() << "[gui] kexec cmdline: " << cmdline ;
+ + downloadPath.toUtf8() + "/initramfs --append=\"" + kcl.toUtf8()
+ + "\"";
+ qxtLog->debug() << "[gui] kexec cmdline: " << cmdline;
process->start(cmdline);
bool ret = process->waitForFinished();
if (!ret) {
qxtLog->debug() << "[sysinfo] Failed to load kexec! Exiting...";
- exit(EXIT_FAILURE);
- }
- else {
+ exit( EXIT_FAILURE);
+ } else {
qxtLog->debug() << "[gui] Kexec load successfull.";
if (debugMode < 0) {
runKexec();
} else {
- qxtLog->debug() << "[gui] Skipping execution of kexec - open debug shell.";
- qxtLog->debug() << "[gui] To start the system execute \"kexec -e\" in your shell.";
+ qxtLog->debug()
+ << "[gui] Skipping execution of kexec - open debug shell.";
+ qxtLog->debug()
+ << "[gui] To start the system execute \"kexec -e\" in your shell.";
close();
}
}
@@ -403,6 +404,6 @@ void fbgui::runKexec() {
process->startDetached("kexec -e");
if (!process->waitForStarted()) {
qxtLog->debug() << "[gui] Failed to execute: kexec -e";
- exit(EXIT_FAILURE);
+ exit( EXIT_FAILURE);
}
}
diff --git a/src/main.cpp b/src/main.cpp
index 5f15d39..baff7af 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -184,8 +184,9 @@ int main(int argc, char *argv[]) {
qxtLog->debug() << "*******************************************";
// set invisible cursor
- //qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
QWSServer::instance()->setCursorVisible(false);
+ QWSServer::instance()->setDefaultKeyboard("TTY:/dev/tty0");
+ QWSServer::instance()->setDefaultMouse("IntelliMouse:/dev/mice");
// start fbgui
fbgui gui;
gui.show();