diff --git a/src/hwapi.cpp b/src/hwapi.cpp index 69e66a3..22f9c2c 100755 --- a/src/hwapi.cpp +++ b/src/hwapi.cpp @@ -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; }