diff options
author | Zephaniah E. Hull <warp@aehallh.com> | 2006-02-24 13:44:56 +0000 |
---|---|---|
committer | Zephaniah E. Hull <warp@aehallh.com> | 2006-02-24 13:44:56 +0000 |
commit | 47482dad76ab74c0b5c9e8d455f04935651173ec (patch) | |
tree | 22818646846473ac8826d724fab4a297ac35e541 /src/evdev.h | |
parent | include errno.h to make it compile. (diff) | |
download | xf86-input-evdev-47482dad76ab74c0b5c9e8d455f04935651173ec.tar.gz xf86-input-evdev-47482dad76ab74c0b5c9e8d455f04935651173ec.tar.bz2 xf86-input-evdev-47482dad76ab74c0b5c9e8d455f04935651173ec.zip |
Compile with -Wall now. Add evdev.h to the sources so that make distcheck
gets it.
Bugzilla #5943 <https://bugs.freedesktop.org/show_bug.cgi=5943> Make sure
we include errno.h.
Reduce EVDEV_MAXBUTTONS to 96.
Split up evdevStateRec into a struct with pointers to new structs for btn,
abs, rel, and key.
New structure type for handling the device capability bitmaps.
Add device bits and struct input_id to evdevDeviceRec.
Add matching device bits, struct input_id, and pass number to
evdevDriverRec.
Prototype for evdevGetBits from evdev_brain.c.
Conversion for the evdevStateRec split.
Remove the errno.h include, it's in evdev.h for now.
Move the bit getting from the drivers to here, into evdevDeviceRec.
Fix a rare case of fd leakage.
Add several new (and somewhat ugly) device matching options: <map>Bits:
Where map is one of ev, key, rel, abs, msc, led, snd, or ff. In the
format of '+0 +3 -1-2 ~5-10', requires bits 0 and 3 be set, bits 1 and
2 to not be set, and at least one bit in the range of 5 to
10 be set. bustype, vendor, product, and version: Simple integer options
for matching the struct device_id fields, must be 0 (the default) or
the exact value you wish to match against. pass: Bounded to 0-3,
devices are matched to the first matching entry found, order for
multiple matching entries in the same pass is undefined, but it starts
with pass 0 and goes to pass 3.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
Add evdevGetBits to fill the new evdevBitsRec struct type.
Lots of somewhat ugly code for matching by capability bits.
Split out of evdevRescanDevices to smaller handling functions. The new
design should be better if I decide to handle arbitrary Device fields
again.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
Handle all buttons, no button compression at this time, however we reorder
things so that BTN_MOUSE comes before BTN_MISC, somewhat evily.
Support for the new btn->state[] array of int pointers.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
I really hope I didn't miss any changes.
Diffstat (limited to 'src/evdev.h')
-rw-r--r-- | src/evdev.h | 88 |
1 files changed, 63 insertions, 25 deletions
diff --git a/src/evdev.h b/src/evdev.h index 0cd021e..f31b160 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -62,6 +62,7 @@ #include <linux/input.h> #include <xf86Xinput.h> +#include <errno.h> #define BITS_PER_LONG (sizeof(long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) @@ -76,6 +77,7 @@ #include <sys/time.h> #include <sys/ioctl.h> #include <asm/types.h> +#include <asm/bitops.h> #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ @@ -115,40 +117,64 @@ #define EV_BUS_GSC 0x1A -#define EVDEV_MAXBUTTONS 128 +#define EVDEV_MAXBUTTONS 96 -typedef struct _evdevState { - Bool can_grab; - Bool sync; +typedef struct { + long ev[NBITS(EV_MAX)]; + long key[NBITS(KEY_MAX)]; + long rel[NBITS(REL_MAX)]; + long abs[NBITS(ABS_MAX)]; + long msc[NBITS(MSC_MAX)]; + long led[NBITS(LED_MAX)]; + long snd[NBITS(SND_MAX)]; + long ff[NBITS(FF_MAX)]; +} evdevBitsRec, *evdevBitsPtr; + +typedef struct { int real_buttons; int buttons; - CARD8 buttonMap[EVDEV_MAXBUTTONS]; - - int mode; /* Either Absolute or Relative. */ - - int abs_axes; - int abs_n; /* Which abs_v is current, and which is previous. */ - int abs_v[2][ABS_MAX]; - int abs_min[ABS_MAX]; - int abs_max[ABS_MAX]; - int absMap[ABS_MAX]; - Bool abs_scale; - int abs_scale_x; - int abs_scale_y; - int abs_screen; /* Screen number for this device. */ - - int rel_axes; - int rel_v[REL_MAX]; - CARD8 relToBtnMap[REL_MAX][2]; - int relMap[REL_MAX]; - - Bool keys; + CARD8 map[EVDEV_MAXBUTTONS]; + int *state[EVDEV_MAXBUTTONS]; +} evdevBtnRec, *evdevBtnPtr; + +typedef struct { + int axes; + int n; /* Which abs_v is current, and which is previous. */ + int v[2][ABS_MAX]; + int min[ABS_MAX]; + int max[ABS_MAX]; + int map[ABS_MAX]; + Bool scale; + int scale_x; + int scale_y; + int screen; /* Screen number for this device. */ +} evdevAbsRec, *evdevAbsPtr; + +typedef struct { + int axes; + int v[REL_MAX]; + CARD8 btnMap[REL_MAX][2]; + int map[REL_MAX]; +} evdevRelRec, *evdevRelPtr; + +typedef struct { char *xkb_rules; char *xkb_model; char *xkb_layout; char *xkb_variant; char *xkb_options; XkbComponentNamesRec xkbnames; +} evdevKeyRec, *evdevKeyPtr; + +typedef struct _evdevState { + Bool can_grab; + Bool sync; + int mode; /* Either Absolute or Relative. */ + + evdevBtnPtr btn; + evdevAbsPtr abs; + evdevRelPtr rel; + evdevKeyPtr key; } evdevStateRec, *evdevStatePtr; typedef struct _evdevDevice { @@ -160,6 +186,9 @@ typedef struct _evdevDevice { InputInfoPtr pInfo; int (*callback)(DeviceIntPtr cb_data, int what); + evdevBitsRec bits; + struct input_id id; + evdevStateRec state; struct _evdevDevice *next; @@ -170,6 +199,14 @@ typedef struct _evdevDriver { const char *phys; const char *device; + evdevBitsRec all_bits; + evdevBitsRec not_bits; + evdevBitsRec any_bits; + + struct input_id id; + + int pass; + InputDriverPtr drv; IDevPtr dev; Bool (*callback)(struct _evdevDriver *driver, evdevDevicePtr device); @@ -182,6 +219,7 @@ typedef struct _evdevDriver { int evdevGetFDForDevice (evdevDevicePtr driver); Bool evdevStart (InputDriverPtr drv); Bool evdevNewDriver (evdevDriverPtr driver); +Bool evdevGetBits (int fd, evdevBitsPtr bits); int EvdevBtnInit (DeviceIntPtr device); int EvdevBtnOn (DeviceIntPtr device); |