ports/x11-drivers/xf86-input-evdev/files/patch-src_evdev.c
Matthew Rezny 3f87b5cb51 Xorg-servers update to 1.18.4 with driver updates and revision bumps.
Update xf86-video-ati to 7.8.0
Update xf86-video-intel to 2.99.917.20170103
Update xf86-input-synaptics to 1.9.0
Update xf86-input-evdev to 2.10.5
Update xf86-video-r128 to 6.10.2
Update xf86-video-rendition to 4.2.6
New port: xf86-video-geode

PR:		214591,216269,214687,214593,214715,216276,216277,216278,216287,
		216288,216292,216298,214560,216299,216300,216301,216302
Approved by:	swills (mentor, portmgr)
Differential Revision:	https://reviews.freebsd.org/D9436
2017-02-11 14:17:58 +00:00

66 lines
2 KiB
C

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