summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-02-24 12:56:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-02-27 09:34:36 +1000
commitaae2c8ad9a9f1712149c93d50284ddb5f37e4cbd (patch)
treea2c6652acb82c4b0cbe760ad28b863e675382cc3
parentdafc296f2df587a1bb5feb37697c50608db4f246 (diff)
downloadxorg-driver-xf86-input-libinput-aae2c8ad9a9f1712149c93d50284ddb5f37e4cbd.tar.gz
Open sysfs files directly instead of going through the server
Only use-case here are pad mode LEDs that now live in /sys/class/leds. Asking the server to open them is pointless, the server only knows how to open Option "Device". And since the LEDs are in sysfs we should have access to them anyway, so no need for jumping through or hula-ing hoops. xf86CloseSerial() works as intended as it's a slim wrapper around close(), so we only have to worry about the open() path here. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/xf86libinput.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index ef03d3e..888c8f2 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2187,6 +2187,12 @@ open_restricted(const char *path, int flags, void *data)
InputInfoPtr pInfo;
int fd = -1;
+ /* Special handling for sysfs files (used for pad LEDs) */
+ if (strneq(path, "/sys/", 5)) {
+ fd = open(path, flags);
+ return fd < 0 ? -errno : fd;
+ }
+
nt_list_for_each_entry(pInfo, xf86FirstLocalDevice(), next) {
char *device = xf86CheckStrOption(pInfo->options, "Device", NULL);