diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-09-04 18:41:13 +0930 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-09-04 20:17:29 +0930 |
commit | 32768f8acd49f49a3daa7965fc2672ca13306780 (patch) | |
tree | 978846df883db895f8cb7ebbd50c4d524656200c /src/evdev.h | |
parent | evdev 2.0.4 (diff) | |
download | xf86-input-evdev-32768f8acd49f49a3daa7965fc2672ca13306780.tar.gz xf86-input-evdev-32768f8acd49f49a3daa7965fc2672ca13306780.tar.bz2 xf86-input-evdev-32768f8acd49f49a3daa7965fc2672ca13306780.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>
Conflicts:
man/evdev.man
src/evdev.c
src/evdev.h
Diffstat (limited to 'src/evdev.h')
-rw-r--r-- | src/evdev.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/evdev.h b/src/evdev.h index cad1eed..9f16b81 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -40,7 +40,11 @@ #include <X11/extensions/XKBstr.h> #endif +#define LONG_BITS (sizeof(long) * 8) +#define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS) + typedef struct { + const char *device; int kernel24; int screen; int min_x, min_y, max_x, max_y; @@ -67,6 +71,18 @@ typedef struct { Time expires; /* time of expiry */ Time timeout; } emulateMB; + 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 */ |