Skip to content

Commit

Permalink
fix: add S3 wakeup detect support
Browse files Browse the repository at this point in the history
  add S3 detect support

Log:  add S3 detect support

Bug: https://pms.uniontech.com/bug-view-273929.html
  • Loading branch information
jeffshuai committed Sep 23, 2024
1 parent 19a0fe2 commit f3d6510
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
34 changes: 21 additions & 13 deletions deepin-devicemanager-server/deepin-deviceinfo/src/mainjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <QFile>
#include <QLoggingCategory>
#include <QTimer>
#include <QDBusConnection>

#include <DSysInfo>

Expand Down Expand Up @@ -49,25 +50,32 @@ MainJob::MainJob(const char *name, QObject *parent)
}
#endif

// 后台加载后先禁用设备
QProcess process;
QStringList options;
options << "--netcard" << "--keyboard" << "--mouse" << "--usb";
process.start("hwinfo", options);
process.waitForFinished(-1);
QString info = process.readAllStandardOutput();
process.close();

ControlInterface::getInstance()->disableOutDevice(info);
ControlInterface::getInstance()->disableInDevice();
ControlInterface::getInstance()->updateWakeup(info);

slotRebootInit(0);
connect(m_deviceInterface, &DeviceInterface::sigUpdate, this, &MainJob::slotUsbChanged);
connect(ControlInterface::getInstance(), &ControlInterface::sigUpdate, this, &MainJob::slotUsbChanged);
#ifndef DISABLE_DRIVER
connect(ControlInterface::getInstance(), &ControlInterface::sigFinished, this, &MainJob::slotDriverControl);
#endif
});
//"System has woken up from sleep (S3)";
QDBusConnection::systemBus().connect("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "PrepareForSleep", // Signal
this, SLOT(slotRebootInit(bool))
);
}
void MainJob::slotRebootInit(bool isSleep)
{
// 后台加载后先禁用设备
QProcess process;
QStringList options;
options << "--netcard" << "--keyboard" << "--mouse" << "--usb";
process.start("hwinfo", options);
process.waitForFinished(-1);
QString info = process.readAllStandardOutput();
process.close();
// init from sql db
ControlInterface::getInstance()->disableOutDevice(info);
ControlInterface::getInstance()->disableInDevice();
ControlInterface::getInstance()->updateWakeup(info);
}

bool MainJob::serverIsRunning()
Expand Down
5 changes: 4 additions & 1 deletion deepin-devicemanager-server/deepin-deviceinfo/src/mainjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ private slots:
* @param usbchanged
*/
void slotDriverControl(bool success);

/**
* @brief slotRebootInit
*/
void slotRebootInit(bool);
private:
/**
* @brief initDriverRepoSource : 初始化驱动仓库
Expand Down

0 comments on commit f3d6510

Please sign in to comment.