Line 0
Link Here
|
|
|
1 |
--- src/evdev.c.orig 2015-01-13 14:06:29.000000000 +0100 |
2 |
+++ src/evdev.c 2015-01-13 14:11:54.000000000 +0100 |
3 |
@@ -39,7 +39,9 @@ |
4 |
|
5 |
#include <linux/version.h> |
6 |
#include <sys/stat.h> |
7 |
+#ifdef __linux__ |
8 |
#include <libudev.h> |
9 |
+#endif |
10 |
#include <unistd.h> |
11 |
#include <errno.h> |
12 |
#include <fcntl.h> |
13 |
@@ -222,6 +224,7 @@ |
14 |
static BOOL |
15 |
EvdevDeviceIsVirtual(const char* devicenode) |
16 |
{ |
17 |
+#ifdef __linux__ |
18 |
struct udev *udev = NULL; |
19 |
struct udev_device *device = NULL; |
20 |
struct stat st; |
21 |
@@ -252,6 +255,9 @@ |
22 |
udev_device_unref(device); |
23 |
udev_unref(udev); |
24 |
return rc; |
25 |
+#else |
26 |
+ return FALSE; |
27 |
+#endif |
28 |
} |
29 |
|
30 |
#ifndef HAVE_SMOOTH_SCROLLING |
31 |
@@ -1078,11 +1084,13 @@ |
32 |
do { |
33 |
rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_NORMAL, &ev); |
34 |
if (rc < 0) { |
35 |
- if (rc == -ENODEV) /* May happen after resume */ |
36 |
+ if (rc != -EAGAIN && rc != -EINTR && rc != -EWOULDBLOCK) { |
37 |
+ /* May happen after resume or at device detach */ |
38 |
xf86RemoveEnabledDevice(pInfo); |
39 |
- else if (rc != -EAGAIN) |
40 |
+ EvdevCloseDevice(pInfo); |
41 |
LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error: %s\n", pInfo->name, |
42 |
strerror(-rc)); |
43 |
+ } |
44 |
break; |
45 |
} else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) { |
46 |
#ifdef MULTITOUCH |
47 |
@@ -1436,10 +1444,15 @@ |
48 |
continue; |
49 |
|
50 |
abs = libevdev_get_abs_info(pEvdev->dev, axis); |
51 |
+#if defined(__linux__) |
52 |
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30) |
53 |
/* Kernel provides units/mm, X wants units/m */ |
54 |
resolution = abs->resolution * 1000; |
55 |
#endif |
56 |
+#else |
57 |
+ /* Kernel provides units/mm, X wants units/m */ |
58 |
+ resolution = abs->resolution * 1000; |
59 |
+#endif |
60 |
|
61 |
xf86InitValuatorAxisStruct(device, axnum, |
62 |
atoms[axnum], |