Skip to content

Commit

Permalink
libinput-gesture-gatherer: warn on error opening device
Browse files Browse the repository at this point in the history
Throwing an exception in this case was causing random crashes and now
that we are using systemd it does not make sense anymore.

Fix #566
  • Loading branch information
JoseExposito committed Apr 1, 2022
1 parent b5ba54e commit 6f415d0
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/gesture-gatherer/libinput-gesture-gatherer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include <array>
#include <cmath>
#include <exception>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>

#include "config/config.h"
#include "gesture-controller/gesture-controller-delegate.h"
Expand Down Expand Up @@ -147,19 +147,8 @@ int LibinputGestureGatherer::openRestricted(const char *path, int flags,
void * /*userData*/) {
int fd = open(path, flags); // NOLINT
if (fd < 0) {
std::string errorMessage{"Error initialising Touchégg: libinput open."};
errorMessage += "\nPath: ";
errorMessage += path;
errorMessage += "\nFlags: ";
errorMessage += flags;
errorMessage +=
"\nTouchégg should be run in daemon mode by systemd in order to be "
"part of the 'input' group and have access to your touchpad.\n"
"If you prefer to run Touchégg without using systemd, please execute "
"the following command:\n"
"$ sudo usermod -a -G input $USER\n"
"And reboot to solve this issue";
throw std::runtime_error{errorMessage};
tlg::warning << "Warning: Error opening device " << path << std::endl;
return -errno;
}
return fd;
}
Expand Down

0 comments on commit 6f415d0

Please sign in to comment.