aboutsummaryrefslogtreecommitdiff
path: root/src/evdev.h
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-08-26 14:33:40 +0930
committerPeter Hutterer <peter.hutterer@redhat.com>2008-09-04 18:33:39 +0930
commit9930477cbeb4acfd070ae70894d13ffabfc347b8 (patch)
treea9f58016b8ad839c7ea3752981dea561f87c611b /src/evdev.h
parentUse HAVE_PROPERTIES define instead of GET_ABI_MAJOR for property compilation. (diff)
downloadxf86-input-evdev-9930477cbeb4acfd070ae70894d13ffabfc347b8.tar.gz
xf86-input-evdev-9930477cbeb4acfd070ae70894d13ffabfc347b8.tar.bz2
xf86-input-evdev-9930477cbeb4acfd070ae70894d13ffabfc347b8.zip
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. To be safe, we cache the information from the device and compare against it when we 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. Adds option "ReopenAttempts" <int>
Diffstat (limited to 'src/evdev.h')
-rw-r--r--src/evdev.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/evdev.h b/src/evdev.h
index 6c59dad..eca049e 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -46,6 +46,8 @@
#define HAVE_PROPERTIES 1
#endif
+#define LONG_BITS (sizeof(long) * 8)
+#define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
/* axis specific data for wheel emulation */
typedef struct {
@@ -55,6 +57,7 @@ typedef struct {
} WheelAxis, *WheelAxisPtr;
typedef struct {
+ const char *device;
int kernel24;
int screen;
int min_x, min_y, max_x, max_y;
@@ -100,6 +103,19 @@ typedef struct {
} emulateWheel;
unsigned char btnmap[32]; /* config-file specified button mapping */
+
+ int reopen_attempts; /* max attempts to re-open after read failure */
+ int reopen_left; /* number of attempts left to re-open the device */
+ OsTimerPtr reopen_timer;
+
+ /* Cached info from device. */
+ char name[1024];
+ long bitmask[NBITS(EV_MAX)];
+ long key_bitmask[NBITS(KEY_MAX)];
+ long rel_bitmask[NBITS(REL_MAX)];
+ long abs_bitmask[NBITS(ABS_MAX)];
+ long led_bitmask[NBITS(LED_MAX)];
+ struct input_absinfo absinfo[ABS_MAX];
} EvdevRec, *EvdevPtr;
/* Middle Button emulation */