Skip to content

Commit 3b01762

Browse files
add-uosdeepin-bot[bot]
authored andcommitted
fix(input): create udev rules directory when missing during keyboard enable
create udev rules directory when missing during keyboard enable or disable log: create udev rules directory bug: https://pms.uniontech.com/bug-view-346127.html
1 parent c3465b2 commit 3b01762

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

deepin-devicemanager-server/deepin-devicecontrol/src/controlinterface.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,12 @@ bool ControlInterface::enableKeyboard(const QString& vid, const QString& pid, co
240240
QFileInfo fileInfo(rulesFile);
241241
QDir rulesDir = fileInfo.absoluteDir();
242242
if (!rulesDir.exists()) {
243-
qCWarning(appLog) << "Udev rules directory does not exist:" << rulesDir.absolutePath();
244-
return false;
243+
qCInfo(appLog) << "Udev rules directory does not exist, creating:" << rulesDir.absolutePath();
244+
if (!rulesDir.mkpath(".")) {
245+
qCWarning(appLog) << "Failed to create udev rules directory:" << rulesDir.absolutePath();
246+
return false;
247+
}
248+
qCInfo(appLog) << "Successfully created udev rules directory:" << rulesDir.absolutePath();
245249
}
246250

247251
QFile file(rulesFile);

0 commit comments

Comments
 (0)