hwapi::onCCWakeGpioChanged():
when switching cc-terminal off, send 0 to watch-file (watched by a filesystem watcher). when switching cc-terminal on, send 1 to watch-file (watched by a filesystem watcher).
This commit is contained in:
parent
c31b38917a
commit
91a0f88cd9
@ -146,11 +146,25 @@ void hwapi::onCCWakeGpioChanged(QString const &fileName) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching terminal off...";
|
||||
mod_switchWake(false);
|
||||
mod_switchPower(false);
|
||||
f.close();
|
||||
f.setFileName(m_watchedFile);
|
||||
// to turn off cc-terminal, the content must be "0"
|
||||
if (f.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
|
||||
QTextStream s(&f);
|
||||
s << "switching terminal off";
|
||||
}
|
||||
} else
|
||||
if (content.startsWith("1")) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << "switching terminal on...";
|
||||
mod_switchPower(true);
|
||||
mod_switchWake(true);
|
||||
f.close();
|
||||
f.setFileName(m_watchedFile);
|
||||
// to turn on cc-terminal, the content must be "1"
|
||||
if (f.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
|
||||
QTextStream s(&f);
|
||||
s << "switching terminal on";
|
||||
}
|
||||
} else {
|
||||
qCritical() << "watched file contained" << content;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user