mirror of
https://github.com/X11Libre/xf86-input-libinput.git
synced 2026-04-14 10:54:17 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user