Skip to content

Commit

Permalink
chore: Add message informaing about solutions in case of problems wit…
Browse files Browse the repository at this point in the history
…h uinput
  • Loading branch information
pktiuk committed Oct 5, 2021
1 parent f222268 commit 7cfd0ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/eventhandlers/uinputeventhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <QDebug>
#include <QFileInfo>
#include <QMessageBox>
#include <QStringList>
#include <QStringListIterator>
#include <QTimer>
Expand All @@ -49,6 +50,7 @@ static const QString springMouseDeviceName = PadderCommon::springMouseDeviceName

UInputEventHandler::UInputEventHandler(QObject *parent)
: BaseEventHandler(parent)
, is_problem_with_opening_uinput_present(false)
{
keyboardFileHandler = 0;
mouseFileHandler = 0;
Expand Down Expand Up @@ -319,6 +321,7 @@ int UInputEventHandler::openUInputHandle()
lastErrorString = tr("Could not open uinput device file\n"
"Please check that you have permission to write to the device");
lastErrorString.append(": ").append(possibleLocation).append('\n');
is_problem_with_opening_uinput_present = true;
} else
{
uinputDeviceLocation = possibleLocation;
Expand Down Expand Up @@ -480,6 +483,15 @@ void UInputEventHandler::printPostMessages()
if (!lastErrorString.isEmpty())
{
PRINT_STDERR() << lastErrorString;
if (is_problem_with_opening_uinput_present)
{
QMessageBox msgBox;
msgBox.setText(tr("Unable to open uinput files, this may cause problems with generating events.\nTo check "
"possible solutions please visit: ")
.append("https://github.com/AntiMicroX/antimicrox/wiki/Open-uinput-error"));
msgBox.setDetailedText(lastErrorString);
msgBox.exec();
}
}

if (!uinputDeviceLocation.isEmpty())
Expand Down
1 change: 1 addition & 0 deletions src/eventhandlers/uinputeventhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class UInputEventHandler : public BaseEventHandler
int mouseFileHandler;
int springMouseFileHandler;
QString uinputDeviceLocation;
bool is_problem_with_opening_uinput_present;

bool cleanupUinputEvHand();
void testAndAppend(bool tested, QList<unsigned int> &tempList, unsigned int key);
Expand Down

0 comments on commit 7cfd0ae

Please sign in to comment.