Changeset View
Changeset View
Standalone View
Standalone View
x11-drivers/xf86-input-evdev/files/patch-src_evdev.c
--- src/evdev.c.orig 2015-03-27 01:35:50 UTC | --- src/evdev.c.orig 2017-01-03 01:26:00 UTC | ||||
+++ src/evdev.c | +++ src/evdev.c | ||||
@@ -37,9 +37,13 @@ | @@ -38,9 +38,13 @@ | ||||
#include <X11/keysym.h> | #include <X11/keysym.h> | ||||
#include <X11/extensions/XI.h> | #include <X11/extensions/XI.h> | ||||
+#ifdef __linux__ | +#ifdef __linux__ | ||||
#include <linux/version.h> | #include <linux/version.h> | ||||
+#endif | +#endif | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
+#ifdef HAVE_LIBUDEV | +#ifdef HAVE_LIBUDEV | ||||
#include <libudev.h> | #include <libudev.h> | ||||
+#endif | +#endif | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
@@ -222,6 +226,7 @@ EvdevIsDuplicate(InputInfoPtr pInfo) | @@ -226,6 +230,7 @@ EvdevIsDuplicate(InputInfoPtr pInfo) | ||||
static BOOL | static BOOL | ||||
EvdevDeviceIsVirtual(const char* devicenode) | EvdevDeviceIsVirtual(const char* devicenode) | ||||
{ | { | ||||
+#ifdef HAVE_LIBUDEV | +#ifdef HAVE_LIBUDEV | ||||
struct udev *udev = NULL; | struct udev *udev = NULL; | ||||
struct udev_device *device = NULL; | struct udev_device *device = NULL; | ||||
struct stat st; | struct stat st; | ||||
@@ -252,6 +257,9 @@ out: | @@ -256,6 +261,9 @@ out: | ||||
udev_device_unref(device); | udev_device_unref(device); | ||||
udev_unref(udev); | udev_unref(udev); | ||||
return rc; | return rc; | ||||
+#else | +#else | ||||
+ return FALSE; | + return FALSE; | ||||
+#endif | +#endif | ||||
} | } | ||||
#ifndef HAVE_SMOOTH_SCROLLING | |||||
@@ -1086,11 +1094,13 @@ EvdevReadInput(InputInfoPtr pInfo) | @@ -1062,11 +1070,13 @@ EvdevReadInput(InputInfoPtr pInfo) | ||||
do { | do { | ||||
rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_NORMAL, &ev); | rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_NORMAL, &ev); | ||||
if (rc < 0) { | if (rc < 0) { | ||||
- if (rc == -ENODEV) /* May happen after resume */ | - if (rc == -ENODEV) /* May happen after resume */ | ||||
+ if (rc != -EAGAIN && rc != -EINTR && rc != -EWOULDBLOCK) { | + if (rc != -EAGAIN && rc != -EINTR && rc != -EWOULDBLOCK) { | ||||
+ /* May happen after resume or at device detach */ | + /* May happen after resume or at device detach */ | ||||
xf86RemoveEnabledDevice(pInfo); | xf86RemoveEnabledDevice(pInfo); | ||||
- else if (rc != -EAGAIN) | - else if (rc != -EAGAIN) | ||||
+ EvdevCloseDevice(pInfo); | + EvdevCloseDevice(pInfo); | ||||
LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error: %s\n", pInfo->name, | LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error: %s\n", pInfo->name, | ||||
strerror(-rc)); | strerror(-rc)); | ||||
+ } | + } | ||||
break; | break; | ||||
} else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) { | } else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) { | ||||
#ifdef MULTITOUCH | if (pEvdev->mtdev) | ||||
@@ -1470,10 +1480,15 @@ EvdevAddAbsValuatorClass(DeviceIntPtr de | @@ -1476,10 +1486,15 @@ EvdevAddAbsValuatorClass(DeviceIntPtr de | ||||
continue; | continue; | ||||
abs = libevdev_get_abs_info(pEvdev->dev, axis); | abs = libevdev_get_abs_info(pEvdev->dev, axis); | ||||
+#ifdef __linux__ | +#ifdef __linux__ | ||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30) | #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30) | ||||
/* Kernel provides units/mm, X wants units/m */ | /* Kernel provides units/mm, X wants units/m */ | ||||
resolution = abs->resolution * 1000; | resolution = abs->resolution * 1000; | ||||
#endif | #endif | ||||
+#else | +#else | ||||
+ /* Kernel provides units/mm, X wants units/m */ | + /* Kernel provides units/mm, X wants units/m */ | ||||
+ resolution = abs->resolution * 1000; | + resolution = abs->resolution * 1000; | ||||
+#endif | +#endif | ||||
xf86InitValuatorAxisStruct(device, axnum, | xf86InitValuatorAxisStruct(device, axnum, | ||||
atoms[axnum], | atoms[axnum], |