- evdev-2.0.4-reopen-device.patch: When arming the reopen timer, stash it
in the driver private, and explicitly cancel it if the server decides to close the device for real. - evdev-2.0.4-cache-info.patch: Rebase to account for same.
This commit is contained in:
parent
18c1927e96
commit
a7b51f43ac
@ -1,25 +1,6 @@
|
|||||||
From 441a97c22933db462dd53e000d1cb269dab6e825 Mon Sep 17 00:00:00 2001
|
diff -up xf86-input-evdev-2.0.4/src/evdev.c.jx xf86-input-evdev-2.0.4/src/evdev.c
|
||||||
From: Peter Hutterer <peter.hutterer@redhat.com>
|
--- xf86-input-evdev-2.0.4/src/evdev.c.jx 2008-09-12 16:04:34.000000000 -0400
|
||||||
Date: Thu, 28 Aug 2008 10:29:26 +0930
|
+++ xf86-input-evdev-2.0.4/src/evdev.c 2008-09-12 16:04:56.000000000 -0400
|
||||||
Subject: [PATCH] Cache device information and compare against info after re-open.
|
|
||||||
|
|
||||||
This way we ensure that if the topology changes under us, we don't open a
|
|
||||||
completely different device. If a device has changed, we disable it.
|
|
||||||
(cherry picked from commit 3bb7d100570134058eb4c906d4902c655148a8be)
|
|
||||||
|
|
||||||
Conflicts:
|
|
||||||
|
|
||||||
src/evdev.c
|
|
||||||
src/evdev.h
|
|
||||||
---
|
|
||||||
src/evdev.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
|
||||||
src/evdev.h | 12 +++++
|
|
||||||
2 files changed, 137 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/evdev.c b/src/evdev.c
|
|
||||||
index 16cf67f..ca6da6e 100644
|
|
||||||
--- a/src/evdev.c
|
|
||||||
+++ b/src/evdev.c
|
|
||||||
@@ -98,6 +98,7 @@ static const char *evdevDefaults[] = {
|
@@ -98,6 +98,7 @@ static const char *evdevDefaults[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -28,7 +9,7 @@ index 16cf67f..ca6da6e 100644
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
|
SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
|
||||||
@@ -176,11 +177,19 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
@@ -176,12 +177,19 @@ EvdevReopenTimer(OsTimerPtr timer, CARD3
|
||||||
|
|
||||||
if (pInfo->fd != -1)
|
if (pInfo->fd != -1)
|
||||||
{
|
{
|
||||||
@ -36,8 +17,8 @@ index 16cf67f..ca6da6e 100644
|
|||||||
- pEvdev->reopen_attempts - pEvdev->reopen_left);
|
- pEvdev->reopen_attempts - pEvdev->reopen_left);
|
||||||
-
|
-
|
||||||
pEvdev->reopen_left = 0;
|
pEvdev->reopen_left = 0;
|
||||||
|
pEvdev->reopen_timer = NULL;
|
||||||
- EvdevOn(pInfo->dev);
|
- EvdevOn(pInfo->dev);
|
||||||
+
|
|
||||||
+ if (EvdevCacheCompare(pInfo, TRUE) == Success)
|
+ if (EvdevCacheCompare(pInfo, TRUE) == Success)
|
||||||
+ {
|
+ {
|
||||||
+ xf86Msg(X_INFO, "%s: Device reopened after %d attempts.\n", pInfo->name,
|
+ xf86Msg(X_INFO, "%s: Device reopened after %d attempts.\n", pInfo->name,
|
||||||
@ -52,7 +33,7 @@ index 16cf67f..ca6da6e 100644
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,8 +377,6 @@ EvdevReadInput(InputInfoPtr pInfo)
|
@@ -370,8 +378,6 @@ EvdevReadInput(InputInfoPtr pInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +42,7 @@ index 16cf67f..ca6da6e 100644
|
|||||||
#define TestBit(bit, array) (array[(bit) / LONG_BITS]) & (1 << ((bit) % LONG_BITS))
|
#define TestBit(bit, array) (array[(bit) / LONG_BITS]) & (1 << ((bit) % LONG_BITS))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -994,6 +1001,116 @@ EvdevConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2,
|
@@ -1000,6 +1006,116 @@ EvdevConvert(InputInfoPtr pInfo, int fir
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +159,7 @@ index 16cf67f..ca6da6e 100644
|
|||||||
static int
|
static int
|
||||||
EvdevProbe(InputInfoPtr pInfo)
|
EvdevProbe(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
@@ -1173,6 +1290,8 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
@@ -1179,6 +1295,8 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,10 +168,9 @@ index 16cf67f..ca6da6e 100644
|
|||||||
return pInfo;
|
return pInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/evdev.h b/src/evdev.h
|
diff -up xf86-input-evdev-2.0.4/src/evdev.h.jx xf86-input-evdev-2.0.4/src/evdev.h
|
||||||
index 0f8cf4b..47bbff2 100644
|
--- xf86-input-evdev-2.0.4/src/evdev.h.jx 2008-09-12 16:04:34.000000000 -0400
|
||||||
--- a/src/evdev.h
|
+++ xf86-input-evdev-2.0.4/src/evdev.h 2008-09-12 16:04:56.000000000 -0400
|
||||||
+++ b/src/evdev.h
|
|
||||||
@@ -40,6 +40,9 @@
|
@@ -40,6 +40,9 @@
|
||||||
#include <X11/extensions/XKBstr.h>
|
#include <X11/extensions/XKBstr.h>
|
||||||
#endif
|
#endif
|
||||||
@ -201,10 +181,10 @@ index 0f8cf4b..47bbff2 100644
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
const char *device;
|
const char *device;
|
||||||
int kernel24;
|
int kernel24;
|
||||||
@@ -71,6 +74,15 @@ typedef struct {
|
@@ -72,6 +75,15 @@ typedef struct {
|
||||||
|
|
||||||
int reopen_attempts; /* max attempts to re-open after read failure */
|
int reopen_attempts; /* max attempts to re-open after read failure */
|
||||||
int reopen_left; /* number of attempts left to re-open the device */
|
int reopen_left; /* number of attempts left to re-open the device */
|
||||||
|
OsTimerPtr reopen_timer;
|
||||||
+
|
+
|
||||||
+ /* Cached info from device. */
|
+ /* Cached info from device. */
|
||||||
+ char name[1024];
|
+ char name[1024];
|
||||||
@ -217,6 +197,3 @@ index 0f8cf4b..47bbff2 100644
|
|||||||
} EvdevRec, *EvdevPtr;
|
} EvdevRec, *EvdevPtr;
|
||||||
|
|
||||||
/* Middle Button emulation */
|
/* Middle Button emulation */
|
||||||
--
|
|
||||||
1.5.6.4
|
|
||||||
|
|
||||||
|
@ -1,31 +1,6 @@
|
|||||||
From 188f07089d9c91d503391d05f0c3776360d7446b Mon Sep 17 00:00:00 2001
|
diff -up xf86-input-evdev-2.0.4/man/evdev.man.reopen-device xf86-input-evdev-2.0.4/man/evdev.man
|
||||||
From: Peter Hutterer <peter.hutterer@redhat.com>
|
--- xf86-input-evdev-2.0.4/man/evdev.man.reopen-device 2008-08-14 22:27:13.000000000 -0400
|
||||||
Date: Thu, 28 Aug 2008 10:24:33 +0930
|
+++ xf86-input-evdev-2.0.4/man/evdev.man 2008-09-12 15:45:50.000000000 -0400
|
||||||
Subject: [PATCH] Attempt to re-open devices on read errors.
|
|
||||||
|
|
||||||
Coming back from resume may leave us with a file descriptor that can be opened
|
|
||||||
but fails on the first read (ENODEV).
|
|
||||||
In this case, try to open the device until it becomes available or until the
|
|
||||||
predefined count expires.
|
|
||||||
|
|
||||||
Adds option "ReopenAttempts" <int>
|
|
||||||
(cherry picked from commit b41d39a745cce9e91241453935ea4c702772c5da)
|
|
||||||
|
|
||||||
Conflicts:
|
|
||||||
|
|
||||||
man/evdev.man
|
|
||||||
src/evdev.c
|
|
||||||
src/evdev.h
|
|
||||||
---
|
|
||||||
man/evdev.man | 5 ++
|
|
||||||
src/evdev.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++++--------
|
|
||||||
src/evdev.h | 4 ++
|
|
||||||
3 files changed, 120 insertions(+), 19 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/man/evdev.man b/man/evdev.man
|
|
||||||
index f438f78..530f979 100644
|
|
||||||
--- a/man/evdev.man
|
|
||||||
+++ b/man/evdev.man
|
|
||||||
@@ -67,6 +67,11 @@ button event is registered.
|
@@ -67,6 +67,11 @@ button event is registered.
|
||||||
Sets the timeout (in milliseconds) that the driver waits before deciding
|
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||||
if two buttons where pressed "simultaneously" when 3 button emulation is
|
if two buttons where pressed "simultaneously" when 3 button emulation is
|
||||||
@ -38,10 +13,9 @@ index f438f78..530f979 100644
|
|||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Kristian Høgsberg.
|
Kristian Høgsberg.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
diff --git a/src/evdev.c b/src/evdev.c
|
diff -up xf86-input-evdev-2.0.4/src/evdev.c.reopen-device xf86-input-evdev-2.0.4/src/evdev.c
|
||||||
index a857db3..16cf67f 100644
|
--- xf86-input-evdev-2.0.4/src/evdev.c.reopen-device 2008-08-14 22:27:13.000000000 -0400
|
||||||
--- a/src/evdev.c
|
+++ xf86-input-evdev-2.0.4/src/evdev.c 2008-09-12 15:55:42.000000000 -0400
|
||||||
+++ b/src/evdev.c
|
|
||||||
@@ -73,6 +73,7 @@
|
@@ -73,6 +73,7 @@
|
||||||
#define EVDEV_RELATIVE_EVENTS (1 << 2)
|
#define EVDEV_RELATIVE_EVENTS (1 << 2)
|
||||||
#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
|
#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
|
||||||
@ -59,7 +33,7 @@ index a857db3..16cf67f 100644
|
|||||||
static void
|
static void
|
||||||
SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
|
SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
|
||||||
{
|
{
|
||||||
@@ -154,6 +157,46 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
|
@@ -154,6 +157,48 @@ PostKbdEvent(InputInfoPtr pInfo, struct
|
||||||
xf86PostKeyboardEvent(pInfo->dev, code, value);
|
xf86PostKeyboardEvent(pInfo->dev, code, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +60,7 @@ index a857db3..16cf67f 100644
|
|||||||
+ pEvdev->reopen_attempts - pEvdev->reopen_left);
|
+ pEvdev->reopen_attempts - pEvdev->reopen_left);
|
||||||
+
|
+
|
||||||
+ pEvdev->reopen_left = 0;
|
+ pEvdev->reopen_left = 0;
|
||||||
|
+ pEvdev->reopen_timer = NULL;
|
||||||
+ EvdevOn(pInfo->dev);
|
+ EvdevOn(pInfo->dev);
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
@ -97,6 +72,7 @@ index a857db3..16cf67f 100644
|
|||||||
+ xf86Msg(X_ERROR, "%s: Failed to reopen device after %d attempts.\n",
|
+ xf86Msg(X_ERROR, "%s: Failed to reopen device after %d attempts.\n",
|
||||||
+ pInfo->name, pEvdev->reopen_attempts);
|
+ pInfo->name, pEvdev->reopen_attempts);
|
||||||
+ DisableDevice(pInfo->dev);
|
+ DisableDevice(pInfo->dev);
|
||||||
|
+ pEvdev->reopen_timer = NULL;
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -106,7 +82,7 @@ index a857db3..16cf67f 100644
|
|||||||
static void
|
static void
|
||||||
EvdevReadInput(InputInfoPtr pInfo)
|
EvdevReadInput(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
@@ -173,6 +216,15 @@ EvdevReadInput(InputInfoPtr pInfo)
|
@@ -173,6 +218,15 @@ EvdevReadInput(InputInfoPtr pInfo)
|
||||||
/* The kernel promises that we always only read a complete
|
/* The kernel promises that we always only read a complete
|
||||||
* event, so len != sizeof ev is an error. */
|
* event, so len != sizeof ev is an error. */
|
||||||
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, strerror(errno));
|
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, strerror(errno));
|
||||||
@ -117,12 +93,12 @@ index a857db3..16cf67f 100644
|
|||||||
+ close(pInfo->fd);
|
+ close(pInfo->fd);
|
||||||
+ pInfo->fd = -1;
|
+ pInfo->fd = -1;
|
||||||
+ pEvdev->reopen_left = pEvdev->reopen_attempts;
|
+ pEvdev->reopen_left = pEvdev->reopen_attempts;
|
||||||
+ TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
|
+ pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
|
||||||
+ }
|
+ }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,6 +888,47 @@ EvdevInit(DeviceIntPtr device)
|
@@ -836,6 +890,47 @@ EvdevInit(DeviceIntPtr device)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +126,7 @@ index a857db3..16cf67f 100644
|
|||||||
+ close(pInfo->fd);
|
+ close(pInfo->fd);
|
||||||
+ pInfo->fd = -1;
|
+ pInfo->fd = -1;
|
||||||
+ pEvdev->reopen_left = pEvdev->reopen_attempts;
|
+ pEvdev->reopen_left = pEvdev->reopen_attempts;
|
||||||
+ TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
|
+ pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
|
||||||
+ } else
|
+ } else
|
||||||
+ {
|
+ {
|
||||||
+ xf86AddEnabledDevice(pInfo);
|
+ xf86AddEnabledDevice(pInfo);
|
||||||
@ -170,7 +146,7 @@ index a857db3..16cf67f 100644
|
|||||||
static int
|
static int
|
||||||
EvdevProc(DeviceIntPtr device, int what)
|
EvdevProc(DeviceIntPtr device, int what)
|
||||||
{
|
{
|
||||||
@@ -851,30 +944,26 @@ EvdevProc(DeviceIntPtr device, int what)
|
@@ -851,30 +946,30 @@ EvdevProc(DeviceIntPtr device, int what)
|
||||||
return EvdevInit(device);
|
return EvdevInit(device);
|
||||||
|
|
||||||
case DEVICE_ON:
|
case DEVICE_ON:
|
||||||
@ -209,12 +185,16 @@ index a857db3..16cf67f 100644
|
|||||||
case DEVICE_CLOSE:
|
case DEVICE_CLOSE:
|
||||||
xf86Msg(X_INFO, "%s: Close\n", pInfo->name);
|
xf86Msg(X_INFO, "%s: Close\n", pInfo->name);
|
||||||
- close(pInfo->fd);
|
- close(pInfo->fd);
|
||||||
|
+ if (pEvdev->reopen_timer) {
|
||||||
|
+ TimerCancel(pEvdev->reopen_timer);
|
||||||
|
+ pEvdev->reopen_timer = NULL;
|
||||||
|
+ }
|
||||||
+ if (pInfo->fd != -1)
|
+ if (pInfo->fd != -1)
|
||||||
+ close(pInfo->fd);
|
+ close(pInfo->fd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1060,11 +1149,12 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
@@ -1060,11 +1155,12 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +209,7 @@ index a857db3..16cf67f 100644
|
|||||||
|
|
||||||
if (pInfo->fd < 0) {
|
if (pInfo->fd < 0) {
|
||||||
xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
|
xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
|
||||||
@@ -1072,6 +1162,8 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
@@ -1072,6 +1168,8 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,10 +218,9 @@ index a857db3..16cf67f 100644
|
|||||||
pEvdev->noXkb = noXkbExtension;
|
pEvdev->noXkb = noXkbExtension;
|
||||||
/* parse the XKB options during kbd setup */
|
/* parse the XKB options during kbd setup */
|
||||||
|
|
||||||
diff --git a/src/evdev.h b/src/evdev.h
|
diff -up xf86-input-evdev-2.0.4/src/evdev.h.reopen-device xf86-input-evdev-2.0.4/src/evdev.h
|
||||||
index cad1eed..0f8cf4b 100644
|
--- xf86-input-evdev-2.0.4/src/evdev.h.reopen-device 2008-08-14 22:27:13.000000000 -0400
|
||||||
--- a/src/evdev.h
|
+++ xf86-input-evdev-2.0.4/src/evdev.h 2008-09-12 15:55:44.000000000 -0400
|
||||||
+++ b/src/evdev.h
|
|
||||||
@@ -41,6 +41,7 @@
|
@@ -41,6 +41,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -250,16 +229,14 @@ index cad1eed..0f8cf4b 100644
|
|||||||
int kernel24;
|
int kernel24;
|
||||||
int screen;
|
int screen;
|
||||||
int min_x, min_y, max_x, max_y;
|
int min_x, min_y, max_x, max_y;
|
||||||
@@ -67,6 +68,9 @@ typedef struct {
|
@@ -67,6 +68,10 @@ typedef struct {
|
||||||
Time expires; /* time of expiry */
|
Time expires; /* time of expiry */
|
||||||
Time timeout;
|
Time timeout;
|
||||||
} emulateMB;
|
} emulateMB;
|
||||||
+
|
+
|
||||||
+ int reopen_attempts; /* max attempts to re-open after read failure */
|
+ int reopen_attempts; /* max attempts to re-open after read failure */
|
||||||
+ int reopen_left; /* number of attempts left to re-open the device */
|
+ int reopen_left; /* number of attempts left to re-open the device */
|
||||||
|
+ OsTimerPtr reopen_timer;
|
||||||
} EvdevRec, *EvdevPtr;
|
} EvdevRec, *EvdevPtr;
|
||||||
|
|
||||||
/* Middle Button emulation */
|
/* Middle Button emulation */
|
||||||
--
|
|
||||||
1.5.6.4
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Summary: Xorg X11 evdev input driver
|
Summary: Xorg X11 evdev input driver
|
||||||
Name: xorg-x11-drv-evdev
|
Name: xorg-x11-drv-evdev
|
||||||
Version: 2.0.4
|
Version: 2.0.4
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
URL: http://www.x.org
|
URL: http://www.x.org
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: User Interface/X Hardware Support
|
Group: User Interface/X Hardware Support
|
||||||
@ -35,8 +35,8 @@ X.Org X11 evdev input driver.
|
|||||||
%setup -q -n %{tarball}-%{version}
|
%setup -q -n %{tarball}-%{version}
|
||||||
|
|
||||||
# apply patches
|
# apply patches
|
||||||
%patch1 -p1 -b .reopen-device.patch
|
%patch1 -p1 -b .reopen-device
|
||||||
%patch2 -p1 -b .cache-info.patch
|
%patch2 -p1 -b .cache-info
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -v --install || exit 1
|
autoreconf -v --install || exit 1
|
||||||
@ -61,6 +61,12 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_mandir}/man4/evdev.4*
|
%{_mandir}/man4/evdev.4*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 12 2008 Adam Jackson <ajax@redhat.com> 2.0.4-3
|
||||||
|
- evdev-2.0.4-reopen-device.patch: When arming the reopen timer, stash it in
|
||||||
|
the driver private, and explicitly cancel it if the server decides to
|
||||||
|
close the device for real.
|
||||||
|
- evdev-2.0.4-cache-info.patch: Rebase to account for same.
|
||||||
|
|
||||||
* Thu Aug 28 2008 Peter Hutterer <peter.hutterer@redhat.com> 2.0.4-2
|
* Thu Aug 28 2008 Peter Hutterer <peter.hutterer@redhat.com> 2.0.4-2
|
||||||
- evdev-2.0.4-reopen-device.patch: try to reopen devices if a read error
|
- evdev-2.0.4-reopen-device.patch: try to reopen devices if a read error
|
||||||
occurs on the fd.
|
occurs on the fd.
|
||||||
|
Loading…
Reference in New Issue
Block a user