Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deepin-devicemanager/src/DeviceManager/DeviceInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,12 @@ EnableDeviceStatus DeviceInput::setEnable(bool e)
}
if(e){
//鼠标启用时,唤醒能力打开
DBusWakeupInterface::getInstance()->setWakeupMachine(wakeupID(), sysPath(), true, name(), m_HardwareClass);
DBusWakeupInterface::getInstance()->setWakeupMachine(wakeupID(), sysPath(), true, name(), m_HardwareClass, m_Interface);
m_wakeupChanged = true;

} else if (m_wakeupChanged) { //鼠标禁用时,唤醒能力关闭
m_wakeupChanged = false;
DBusWakeupInterface::getInstance()->setWakeupMachine(wakeupID(), sysPath(), false, name(), m_HardwareClass);
DBusWakeupInterface::getInstance()->setWakeupMachine(wakeupID(), sysPath(), false, name(), m_HardwareClass, m_Interface);
}
bool res = DBusEnableInterface::getInstance()->enable(m_HardwareClass, m_Name, m_SysPath, m_UniqueID, e, m_Driver);
if (res) {
Expand Down Expand Up @@ -505,7 +505,7 @@ QString DeviceInput::wakeupPath()
return "";
}

if (m_Name.contains("PS/2")) {
if (m_Name.contains("PS/2") || m_Interface.contains("PS/2")) {
return "/proc/acpi/wakeup";
} else {
return QString("/sys") + m_SysPath.left(index) + QString("/power/wakeup");
Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/src/Page/PageMultiInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void PageMultiInfo::getTableListInfo(const QList<DeviceBaseInfo *> &lst, QList<Q
if (input) {
menuControl.append(input->canWakeupMachine() ? "true" : "false");
menuControl.append(input->wakeupPath());
if (info->name().contains("PS/2")) {
if (info->name().contains("PS/2") || input->getInterface().contains("PS/2")) {
menuControl.append(input->getBusInfo());
menuControl.append(input->name());
menuControl.append(input->hardwareClass());
Expand Down
5 changes: 3 additions & 2 deletions deepin-devicemanager/src/Page/PageSingleInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,9 @@ void PageSingleInfo::slotWakeupMachine()
DBusWakeupInterface::getInstance()->setWakeupMachine(input->wakeupID(),
input->sysPath(),
mp_WakeupMachine->isChecked(),
input->getInterface(),
input->hardwareClass());
input->name(),
input->hardwareClass(),
input->getInterface());
}

// 网卡的远程唤醒
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@
}

bool DBusWakeupInterface::setWakeupMachine(const QString &unique_id,
const QString &path,

Check warning on line 39 in deepin-devicemanager/src/WakeupControl/DBusWakeupInterface.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Local variable 'path' shadows outer argument
bool wakeup,
const QString &name,
const QString &hardwareclass)
const QString &hardwareclass,
const QString &interfaceType)
{
if (nullptr != mp_InputIface && mp_InputIface->isValid()) {
QStringList pathList = path.split("/", QString::SkipEmptyParts);
if (pathList.size() < 3)
return false;

if (name.contains("PS/2")) {
if (name.contains("PS/2") || interfaceType.contains("PS/2")) {
// ps2设备无法通过/sys/devices/platform/i8042/serio1/power/wakeup控制,只能通过acpi的接口进行控制
QDBusInterface interface(INPUT_SERVICE_NAME, INPUT_WAKEUP_SERVICE_PATH, INPUT_WAKEUP_PROPERTIES_INTERFACE, QDBusConnection::systemBus());
if (interface.isValid()) {
Expand Down
6 changes: 5 additions & 1 deletion deepin-devicemanager/src/WakeupControl/DBusWakeupInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ class DBusWakeupInterface
* @param unique_id 设备的唯一标识
* @param path 设备节点路径
* @param wakeup 可唤醒 不可唤醒
* @param name 设备名称
* @param hardwareclass 硬件类型(mouse/keyboard)
* @param interfaceType 接口类型(PS/2/USB/Bluetooth等)
* @return
*/
bool setWakeupMachine(const QString &unique_id,
const QString &path,
bool wakeup,
const QString &name,
const QString &hardwareclass);
const QString &hardwareclass,
const QString &interfaceType);

/**
* @brief canWakeupMachine 获取input是否支持唤醒
Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/src/Widget/TextBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void TextBrowser::setWakeupMachine(bool wakeup)
// 键盘鼠标唤醒机器
DeviceInput *input = qobject_cast<DeviceInput*>(mp_Info);
if(input && !input->wakeupID().isEmpty() && !input->sysPath().isEmpty()){
DBusWakeupInterface::getInstance()->setWakeupMachine(input->wakeupID(),input->sysPath(),wakeup, input->name(), input->hardwareClass());
DBusWakeupInterface::getInstance()->setWakeupMachine(input->wakeupID(),input->sysPath(),wakeup, input->name(), input->hardwareClass(), input->getInterface());
}

// 网卡的远程唤醒
Expand Down
Loading