diff options
author | Daniel Stone <daniel@fooishbar.org> | 2006-11-02 03:42:13 +0200 |
---|---|---|
committer | Daniel Stone <daniels@endtroducing.fooishbar.org> | 2006-11-02 03:42:13 +0200 |
commit | 1a8cea3dc4d8336b61a071a52479e71d7dd619d4 (patch) | |
tree | 1d450eabd04862122d4675d43e36da6fbc24d94c | |
parent | 51d21a369416bb0a45a2894e83a1cb092cc307d8 (diff) | |
parent | 4c72fb7b769b78cfa2b4cc39eb03fdacd2b5039c (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/driver/xf86-input-evdev
-rw-r--r-- | .gitignore (renamed from .cvsignore) | 5 | ||||
-rw-r--r-- | ChangeLog | 368 | ||||
-rw-r--r-- | Makefile.am | 11 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | man/.gitignore (renamed from man/.cvsignore) | 1 | ||||
-rw-r--r-- | src/.gitignore (renamed from src/.cvsignore) | 0 | ||||
-rw-r--r-- | src/evdev.c | 24 | ||||
-rw-r--r-- | src/evdev.h | 28 | ||||
-rw-r--r-- | src/evdev_axes.c | 323 | ||||
-rw-r--r-- | src/evdev_btn.c | 150 | ||||
-rw-r--r-- | src/inotify-syscalls.h | 4 |
11 files changed, 443 insertions, 473 deletions
@@ -1,9 +1,13 @@ Makefile Makefile.in +ChangeLog +xf86-input-evdev-*.tar.bz2 +xf86-input-evdev-*.tar.gz *.la *.lo aclocal.m4 autom4te.cache +compile config.guess config.h config.h.in @@ -17,3 +21,4 @@ libtool ltmain.sh missing stamp-h1 +.*.swp diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 6a63a2d..0000000 --- a/ChangeLog +++ /dev/null @@ -1,368 +0,0 @@ -2006-06-22 Adam Jackson <ajax@freedesktop.org> - - * src/inotify-syscalls.h: - MIPS support. (Joshua Kinard) - -2006-06-02 Adam Jackson <ajax@freedesktop.org> - - * src/evdev_axes.c: - Fix an obvious bogon to avoid crashing on absolute axis setup. - -2006-05-15 Zephaniah E. Hull,,, <warp@aehallh.com> - - * src/evdev.h: - Hopefully fix the bitops stuff to actually _work_. - -2006-05-14 Zephaniah E. Hull <warp@aehallh.com> - - * man/evdev.man: - Tweak credits and references. - * src/evdev.c: (EvdevParseBits), (EvdevParseBitOption), - (EvdevCorePreInit): - Change the longs to unsigned longs in the bitfields. - - Cleanup our includes. - * src/evdev.h: - Stop pulling in asm/types.h and asm/bitops.h. - - Conditionally define the stuff that used to come from - the above, including our own test_bit, set_bit and clear_bit. - - Change the longs to unsigned longs in the bitfields. - * src/evdev_axes.c: (EvdevAxisAbsNew), (EvdevAxisRelNew): - Change the longs to unsigned longs in the bitfields. - - Use the bitop defines in evdev.h properly. - * src/evdev_brain.c: (MatchAll), (MatchNot), (MatchAny): - Change the longs to unsigned longs in the bitfields. - * src/evdev_btn.c: (EvdevBtnNew): - Change the longs to unsigned longs in the bitfields. - - Use the bitop defines in evdev.h properly. - * src/evdev_key.c: (EvdevKeyNew): - Change the longs to unsigned longs in the bitfields. - - Use the bitop defines in evdev.h properly. - * src/inotify-syscalls.h: - Add HPPA/HPPA64 entries. (Thanks to Fabio M. Di Nitto - <fabbione@ubuntu.com>) - -2006-04-30 Zephaniah E. Hull <warp@aehallh.com> - - * configure.ac: - xf86-input-evdev v1.1.2 - * src/evdev_brain.c: (evdevControl): - Bugzilla #6734 <https://bugs.freedesktop.org/show_bug.cgi=6734> - Apply patch from Philip Langdale which causes us to make sure that - O_NONBLOCK is set on the inotify device. - -2006-04-15 Zephaniah E. Hull <warp@aehallh.com> - - * configure.ac: - * src/Makefile.am: - xf86-input-evdev v1.1.1 - -2006-04-14 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev.h: - evdevAbsRec: Remove the scale bool, rename scale_x and scale_y - to scale[2]. - evdevAxesRec: Make btnMap an int array instead of a Card8 array. - * src/evdev_axes.c: (EvdevAxesAbsSyn), (EvdevAxesAbsProcess), - (EvdevAxisAbsNew), (EvdevAxesInit): - Make abs support and non-core stuff actually work. - - Relative emulation for abs mode is still a bit broken, but that's far - less critical. - - * src/evdev_btn.c: (EvdevBtnInit): - How many buttons we've registered is configuration information, not an - error message. - -2006-04-08 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev.c: (EvdevCorePreInit): - Remove a debugging message. - * src/evdev_axes.c: (EvdevAxesNew), (EvdevAxesInit): - Actually, well, _work_. - Note, abs support still segfaults, I'll debug it after I've slept. - But I should get it tomorrow. - -2006-04-08 Zephaniah E. Hull <warp@aehallh.com> - - * configure.ac: - Dropped the xorg-xserver 1.0.99.901 requirement. - (Things were tweaked to mostly work for older servers again.) - * src/evdev.c: (EvdevReadInput): - Close the device properly on read errer. - * src/evdev_brain.c: (evdevReadInput), (evdevControl): - Minimal inotify support, not ideal yet, but... - * src/inotify-syscalls.h: - Minimal inotify support, not ideal yet, but... - * src/inotify.h: - Minimal inotify support, not ideal yet, but... - -2006-04-08 Zephaniah E. Hull <warp@aehallh.com> - - * src/Makefile.am: - Remove evdev_abs.c and evdev_rel.c. - Added evdev_axes.c. - * src/evdev.c: (EvdevReadInput), (EvdevProc), (EvdevNew), - (EvdevPtrCtrlProc): - Change the calls to refer to EvdevAxes instead of Abs and Rel. - Include mipointer.h. (Fixes a compile error.) - Remove an unused variable from EvdevReadInput. - * src/evdev.h: - Removed evdev_abs.c and evdev_rel.c, added evdev_axes.c. - Added count to rel and abs. - Moved btnMap from rel to the new axes. - Shuffle some includes, and include stdarg.h. - * src/evdev_abs.c: - Removed. - * src/evdev_axes.c: (EvdevConvert), (EvdevAxesRealSyn), - (EvdevAxesAbsSyn), (EvdevAxesRelSyn), (EvdevAxesSyn), - (EvdevAxesAbsProcess), (EvdevAxesRelProcess), (EvdevAxesOn), - (EvdevAxesOff), (EvdevAxisAbsNew), (EvdevAxisRelNew), - (EvdevAxesNew), (EvdevPtrCtrlProc), (EvdevAxesInit): - New, a mix of rel and abs that should actually work in the - rel case. - * src/evdev_btn.c: (EvdevBtnCalcRemap): - Rearrange include order. - btnMap was moved from being part of rel to being part of axes. - * src/evdev_rel.c: - Removed. - * src/evdev_brain.c: - Rearrange include order. - * src/evdev_key.c: - Rearrange include order. - - NOTE: This commit has been compile tested, not run tested. - - I have some other changes to make before I can do more heavy testing. - -2006-04-06 Adam Jackson <ajax@freedesktop.org> - - * configure.ac: - * src/evdev.c: - * src/evdev.h: - * src/evdev_abs.c: - * src/evdev_btn.c: - * src/evdev_key.c: - * src/evdev_rel.c: - Unlibcwrap. Bump server version requirement. Bump to 1.1.0. - -2006-03-31 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev_brain.c: (FillDevInfo), (evdevRescanDevices): - Fix the fd pointer leak reported by primer. (Not the same patch.) - * src/evdev_key.c: (EvdevKeyNew): - Disable the undocumented xkb guts options in the key driver. - (Requested by Daniel Stone.) - -2006-03-16 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev_brain.c: (MatchDriver): - Switch from my own globbing function to fnmatch. - - * src/evdev_key.c: (EvdevKeyNew): - Detect keys numbered higher then buttons. - Remove the (depreciated since long before xkb support was added to - evdev) XkbKeymap option. - -2006-03-16 Zephaniah E. Hull <warp@aehallh.com> - - * man/evdev.man: - Update to include all the new device matching options. - -2006-02-27 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev_key.c: (EvdevKeyOff): - Don't leave keys in the down state when we get turned off. - (VT switching, getting unplugged, that sort of stuff.) - -2006-02-27 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev.c: (EvdevReadInput): - Better error reporting if the read fails. - - * src/evdev_brain.c: (evdevNewDriver): - Work properly if we're defining entirely by capability maps. - -2006-02-24 Zephaniah E. Hull <warp@aehallh.com> - - * src/Makefile.am: - Compile with -Wall now. - Add evdev.h to the sources so that make distcheck gets it. - - * src/evdev.h: - 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. - - * src/evdev.c: (EvdevProc), (EvdevSwitchMode), (EvdevNew), - (EvdevParseBits), (EvdevParseBitOption), (EvdevCorePreInit): - 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. - - * src/evdev_abs.c: (EvdevAbsSyn), (EvdevAbsProcess), - (EvdevAbsInit), (EvdevAbsNew): - Adaptation for the evdevStateRec split and the change in capability - bitmap handling. - - * src/evdev_brain.c: (MatchAll), (MatchNot), (MatchAny), - (MatchDriver), (MatchDevice), (evdevScanDevice), (FillDevInfo), - (evdevRescanDevices), (evdevGetBits): - 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. - - * src/evdev_btn.c: (EvdevBtnInit), (EvdevBtnOn), - (EvdevBtnCalcRemap), (EvdevBtnNew), (EvdevBtnProcess): - 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. - - * src/evdev_key.c: (EvdevKeyInit), (SetXkbOption), (EvdevKeyNew): - Adaptation for the evdevStateRec split and the change in capability - bitmap handling. - - * src/evdev_rel.c: (EvdevRelSyn), (EvdevRelProcess), - (EvdevRelInit), (EvdevRelNew): - Adaptation for the evdevStateRec split and the change in capability - bitmap handling. - -2006-02-20 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev_btn.c: (EvdevBtnInit): - Bugzilla #5950 <https://bugs.freedesktop.org/show_bug.cgi=5950> - Possible (maybe) fix for bug #5950. - Though, I'm not convinced and still don't see how this bug could - be happening, especially if this doesn't do it. - -2006-02-19 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev_key.c: (EvdevKbdBell): - Add bell support. - -2006-02-16 Zephaniah E. Hull <warp@aehallh.com> - - * src/evdev_btn.c: (EvdevBtnCalcRemap): - Bugzilla #5914 <https://bugs.freedesktop.org/show_bug.cgi?id=5914> - Stupid little bug, properly handle wheels on 3 button mice. - -2006-02-14 Zephaniah E. Hull <warp@aehallh.com> - - * configure.ac: - * man/evdev.man: - * src/Makefile.am: - * src/evdev.c: (EvdevReadInput), (EvdevSigioReadInput), - (EvdevProc), (EvdevSwitchMode), (EvdevNew), (EvdevCorePreInit): - * src/evdev.h: - * src/evdev_abs.c: (EvdevPtrCtrlProc), (EvdevConvert), - (EvdevAbsSyn), (EvdevAbsProcess), (EvdevAbsInit), (EvdevAbsOn), - (EvdevAbsOff), (EvdevAbsNew): - * src/evdev_brain.c: (glob_match), (evdevGetFDForDevice), - (evdevRescanDevices), (evdevReadInput), (evdevControl), - (evdevStart), (evdevNewDriver): - * src/evdev_btn.c: (EvdevBtnPostFakeClicks), (EvdevBtnInit), - (EvdevBtnOn), (EvdevBtnOff), (EvdevBtnCalcRemap), (EvdevBtnNew), - (EvdevBtnProcess): - * src/evdev_key.c: (EvdevKbdBell), (EvdevKbdCtrl), (EvdevKeyInit), - (SetXkbOption), (EvdevKeyNew), (EvdevKeyOn), (EvdevKeyOff), - (EvdevKeyProcess): - * src/evdev_rel.c: (EvdevPtrCtrlProc), (EvdevConvert), - (EvdevRelSyn), (EvdevRelProcess), (EvdevRelInit), (EvdevRelOn), - (EvdevRelOff), (EvdevRelNew): - Bugzilla #5696 <https://bugs.freedesktop.org/show_bug.cgi?id=5696> - Slightly updated version of the patch listed. - Basicly a rewrite of the driver, with a few pieces of the old. - XKB support, proper device matching, basic absolute pointer support. - Lots more, will require some user config changes. - -2006-01-09 David Nusinow,,, <set EMAIL_ADDRESS environment variable> - - * man/Makefile.am: - * man/evdev.man: - Bugzilla #968 <https://bugs.freedesktop.org/show_bug.cgi?id=968> - Patch #4301 <https://bugs.freedesktop.org/attachment.cgi?id=4301> - Add evdev manpage - -2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * configure.ac: - Update package version for X11R7 release. - -2005-12-14 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * configure.ac: - Update package version number for final X11R7 release candidate. - -2005-12-06 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * man/Makefile.am: - Change *man_SOURCES ==> *man_PRE to fix autotools warnings. - -2005-12-03 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * configure.ac: - Update package version number for X11R7 RC3 release. - -2005-12-01 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * configure.ac: - Remove extraneous AC_MSG_RESULT. - -2005-11-29 Adam Jackson <ajax@freedesktop.org> - - * configure.ac: - Only build dlloader modules by default. - -2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * configure.ac: - Update package version number for X11R7 RC2 release. - -2005-11-01 Kevin E. Martin <kem-at-freedesktop-dot-org> - - * configure.ac: - Update pkgcheck dependencies to work with separate build roots. diff --git a/Makefile.am b/Makefile.am index 7052905..c8fa46d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,3 +20,14 @@ AUTOMAKE_OPTIONS = foreign SUBDIRS = src man + +EXTRA_DIST=ChangeLog + +CLEANFILES=ChangeLog + +.PHONY: ChangeLog + +ChangeLog: + git-log > ChangeLog + +dist-hook: ChangeLog diff --git a/configure.ac b/configure.ac index e849632..e9a82c4 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-input-evdev], - 1.1.2, + 1.1.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-input-evdev) diff --git a/man/.cvsignore b/man/.gitignore index 282522d..c060ea5 100644 --- a/man/.cvsignore +++ b/man/.gitignore @@ -1,2 +1,3 @@ Makefile Makefile.in +evdev.4 diff --git a/src/.cvsignore b/src/.gitignore index 9730646..9730646 100644 --- a/src/.cvsignore +++ b/src/.gitignore diff --git a/src/evdev.c b/src/evdev.c index f128a81..1ea74c0 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -117,9 +117,13 @@ EvdevReadInput(InputInfoPtr pInfo) case EV_SYN: if (ev.code == SYN_REPORT) { - EvdevAxesSyn (pInfo); - /* EvdevBtnSyn (pInfo); */ - /* EvdevKeySyn (pInfo); */ + EvdevAxesSynRep (pInfo); + /* EvdevBtnSynRep (pInfo); */ + /* EvdevKeySynRep (pInfo); */ + } else if (ev.code == SYN_CONFIG) { + EvdevAxesSynCfg (pInfo); + /* EvdevBtnSynCfg (pInfo); */ + /* EvdevKeySynCfg (pInfo); */ } break; } @@ -200,6 +204,7 @@ EvdevProc(DeviceIntPtr device, int what) RemoveEnabledDevice (pInfo->fd); xf86RemoveSIGIOHandler (pInfo->fd); close (pInfo->fd); + pInfo->fd = -1; if (pEvdev->state.axes) EvdevAxesOff (device); @@ -227,6 +232,7 @@ EvdevSwitchMode (ClientPtr client, DeviceIntPtr device, int mode) { case Absolute: case Relative: + xf86Msg(X_INFO, "%s: Switching mode to %d.\n", pInfo->name, mode); if (state->abs) state->mode = mode; else @@ -297,9 +303,13 @@ EvdevNew(evdevDriverPtr driver, evdevDevicePtr device) } - /* XXX: Note, the order of these is important. */ - EvdevAxesNew (pInfo); - EvdevBtnNew (pInfo); + /* XXX: Note, the order of these is (maybe) still important. */ + EvdevAxesNew0 (pInfo); + EvdevBtnNew0 (pInfo); + + EvdevAxesNew1 (pInfo); + EvdevBtnNew1 (pInfo); + if (device->state.can_grab) EvdevKeyNew (pInfo); @@ -470,7 +480,7 @@ static XF86ModuleVersionInfo EvdevVersionRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - 0, /* Missing from SDK: XORG_VERSION_CURRENT, */ + XORG_VERSION_CURRENT, 1, 1, 0, ABI_CLASS_XINPUT, ABI_XINPUT_VERSION, diff --git a/src/evdev.h b/src/evdev.h index a399571..db0d287 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -117,6 +117,12 @@ #include <X11/extensions/XKB.h> #include <X11/extensions/XKBstr.h> +/* XInput 1.4+ compatability. */ +#ifndef SendCoreEvents +#define SendCoreEvents 59 +#define DontSendCoreEvents 60 +#endif + /* * Switch events @@ -151,19 +157,22 @@ typedef struct { int real_buttons; int buttons; CARD8 map[EVDEV_MAXBUTTONS]; - int *state[EVDEV_MAXBUTTONS]; + void (*callback[EVDEV_MAXBUTTONS])(InputInfoPtr pInfo, int button, int value); } evdevBtnRec, *evdevBtnPtr; typedef struct { int axes; - int n; /* Which abs_v is current, and which is previous. */ - int v[2][ABS_MAX]; + int v[ABS_MAX]; + int old_x, old_y; int count; int min[ABS_MAX]; int max[ABS_MAX]; int map[ABS_MAX]; int scale[2]; int screen; /* Screen number for this device. */ + Bool use_touch; + Bool touch; + Bool reset_x, reset_y; } evdevAbsRec, *evdevAbsPtr; typedef struct { @@ -171,12 +180,12 @@ typedef struct { int v[REL_MAX]; int count; int map[REL_MAX]; + int btnMap[REL_MAX][2]; } evdevRelRec, *evdevRelPtr; typedef struct { int axes; int v[ABS_MAX]; - int btnMap[ABS_MAX][2]; } evdevAxesRec, *evdevAxesPtr; typedef struct { @@ -247,17 +256,22 @@ Bool evdevGetBits (int fd, evdevBitsPtr bits); int EvdevBtnInit (DeviceIntPtr device); int EvdevBtnOn (DeviceIntPtr device); int EvdevBtnOff (DeviceIntPtr device); -int EvdevBtnNew(InputInfoPtr pInfo); +int EvdevBtnNew0(InputInfoPtr pInfo); +int EvdevBtnNew1(InputInfoPtr pInfo); void EvdevBtnProcess (InputInfoPtr pInfo, struct input_event *ev); void EvdevBtnPostFakeClicks(InputInfoPtr pInfo, int button, int count); +int EvdevBtnFind (InputInfoPtr pInfo, const char *button); +int EvdevBtnExists (InputInfoPtr pInfo, int button); int EvdevAxesInit (DeviceIntPtr device); int EvdevAxesOn (DeviceIntPtr device); int EvdevAxesOff (DeviceIntPtr device); -int EvdevAxesNew(InputInfoPtr pInfo); +int EvdevAxesNew0(InputInfoPtr pInfo); +int EvdevAxesNew1(InputInfoPtr pInfo); void EvdevAxesAbsProcess (InputInfoPtr pInfo, struct input_event *ev); void EvdevAxesRelProcess (InputInfoPtr pInfo, struct input_event *ev); -void EvdevAxesSyn (InputInfoPtr pInfo); +void EvdevAxesSynRep (InputInfoPtr pInfo); +void EvdevAxesSynCfg (InputInfoPtr pInfo); int EvdevKeyInit (DeviceIntPtr device); int EvdevKeyNew (InputInfoPtr pInfo); diff --git a/src/evdev_axes.c b/src/evdev_axes.c index 0d9b5a7..6879ab1 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -49,6 +49,8 @@ #include <xf86_OSproc.h> +#undef DEBUG + static char *rel_axis_names[] = { "X", "Y", @@ -136,6 +138,8 @@ static char *abs_axis_names[] = { NULL }; +static void EvdevAxesTouchCallback (InputInfoPtr pInfo, int button, int value); + static Bool EvdevConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2, int v3, int v4, int v5, int *x, int *y) @@ -149,106 +153,187 @@ EvdevConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2, } static void -EvdevAxesRealSyn (InputInfoPtr pInfo, int absolute) +EvdevAxesRealSyn (InputInfoPtr pInfo, int absolute, int skip_xy) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; evdevAxesPtr axes = state->axes; - int i, btn; + int i; - for (i = 0; i < state->axes->axes; i++) { - if ((state->axes->v[i] > 0) && (btn = state->axes->btnMap[i][0])) - EvdevBtnPostFakeClicks (pInfo, btn, state->axes->v[i]); - else if ((state->axes->v[i] < 0) && (btn = state->axes->btnMap[i][1])) - EvdevBtnPostFakeClicks (pInfo, btn, -state->axes->v[i]); - } +#if DEBUG + if (skip_xy == 2 && (axes->v[0] || axes->v[1])) + xf86Msg(X_INFO, "%s: skip_xy: %d, x: %d, y: %d.\n", pInfo->name, skip_xy, axes->v[0], axes->v[1]); +#endif - xf86PostMotionEvent(pInfo->dev, absolute, 0, - state->axes->axes, - axes->v[0x00], axes->v[0x01], axes->v[0x02], axes->v[0x03], - axes->v[0x04], axes->v[0x05], axes->v[0x06], axes->v[0x07], - axes->v[0x08], axes->v[0x09], axes->v[0x0a], axes->v[0x0b], - axes->v[0x0c], axes->v[0x0d], axes->v[0x0e], axes->v[0x0f], - axes->v[0x10], axes->v[0x11], axes->v[0x12], axes->v[0x13], - axes->v[0x14], axes->v[0x15], axes->v[0x16], axes->v[0x17], - axes->v[0x18], axes->v[0x19], axes->v[0x1a], axes->v[0x1b], - axes->v[0x1c], axes->v[0x1d], axes->v[0x1e], axes->v[0x1f], - axes->v[0x20], axes->v[0x21], axes->v[0x22], axes->v[0x23], - axes->v[0x24], axes->v[0x25], axes->v[0x26], axes->v[0x27], - axes->v[0x28], axes->v[0x29], axes->v[0x2a], axes->v[0x2b], - axes->v[0x2c], axes->v[0x2d], axes->v[0x2e], axes->v[0x2f], - axes->v[0x30], axes->v[0x31], axes->v[0x32], axes->v[0x33], - axes->v[0x34], axes->v[0x35], axes->v[0x36], axes->v[0x37], - axes->v[0x38], axes->v[0x39], axes->v[0x3a], axes->v[0x3b], - axes->v[0x3c], axes->v[0x3d], axes->v[0x3e], axes->v[0x3f]); + /* FIXME: This is a truly evil kluge. */ + if (skip_xy == 1 && state->axes->axes >= 2) + xf86PostMotionEvent(pInfo->dev, absolute, 2, + state->axes->axes - 2, + axes->v[0x02], axes->v[0x03], + axes->v[0x04], axes->v[0x05], axes->v[0x06], axes->v[0x07], + axes->v[0x08], axes->v[0x09], axes->v[0x0a], axes->v[0x0b], + axes->v[0x0c], axes->v[0x0d], axes->v[0x0e], axes->v[0x0f], + axes->v[0x10], axes->v[0x11], axes->v[0x12], axes->v[0x13], + axes->v[0x14], axes->v[0x15], axes->v[0x16], axes->v[0x17], + axes->v[0x18], axes->v[0x19], axes->v[0x1a], axes->v[0x1b], + axes->v[0x1c], axes->v[0x1d], axes->v[0x1e], axes->v[0x1f], + axes->v[0x20], axes->v[0x21], axes->v[0x22], axes->v[0x23], + axes->v[0x24], axes->v[0x25], axes->v[0x26], axes->v[0x27], + axes->v[0x28], axes->v[0x29], axes->v[0x2a], axes->v[0x2b], + axes->v[0x2c], axes->v[0x2d], axes->v[0x2e], axes->v[0x2f], + axes->v[0x30], axes->v[0x31], axes->v[0x32], axes->v[0x33], + axes->v[0x34], axes->v[0x35], axes->v[0x36], axes->v[0x37], + axes->v[0x38], axes->v[0x39], axes->v[0x3a], axes->v[0x3b], + axes->v[0x3c], axes->v[0x3d], axes->v[0x3e], axes->v[0x3f]); + else + xf86PostMotionEvent(pInfo->dev, absolute, 0, + state->axes->axes, + axes->v[0x00], axes->v[0x01], axes->v[0x02], axes->v[0x03], + axes->v[0x04], axes->v[0x05], axes->v[0x06], axes->v[0x07], + axes->v[0x08], axes->v[0x09], axes->v[0x0a], axes->v[0x0b], + axes->v[0x0c], axes->v[0x0d], axes->v[0x0e], axes->v[0x0f], + axes->v[0x10], axes->v[0x11], axes->v[0x12], axes->v[0x13], + axes->v[0x14], axes->v[0x15], axes->v[0x16], axes->v[0x17], + axes->v[0x18], axes->v[0x19], axes->v[0x1a], axes->v[0x1b], + axes->v[0x1c], axes->v[0x1d], axes->v[0x1e], axes->v[0x1f], + axes->v[0x20], axes->v[0x21], axes->v[0x22], axes->v[0x23], + axes->v[0x24], axes->v[0x25], axes->v[0x26], axes->v[0x27], + axes->v[0x28], axes->v[0x29], axes->v[0x2a], axes->v[0x2b], + axes->v[0x2c], axes->v[0x2d], axes->v[0x2e], axes->v[0x2f], + axes->v[0x30], axes->v[0x31], axes->v[0x32], axes->v[0x33], + axes->v[0x34], axes->v[0x35], axes->v[0x36], axes->v[0x37], + axes->v[0x38], axes->v[0x39], axes->v[0x3a], axes->v[0x3b], + axes->v[0x3c], axes->v[0x3d], axes->v[0x3e], axes->v[0x3f]); + + if (!skip_xy) + for (i = 0; i < ABS_MAX; i++) + state->axes->v[i] = 0; + else if (skip_xy == 1) + for (i = 2; i < ABS_MAX; i++) + state->axes->v[i] = 0; + else if (skip_xy == 2) + for (i = 0; i < 2; i++) + state->axes->v[i] = 0; +} + +static void +EvdevAxesAbsSynCfg (InputInfoPtr pInfo) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + struct input_absinfo absinfo; + int i; + + for (i = 0; i < ABS_MAX; i++) { + if (!test_bit (i, pEvdev->bits.abs)) + continue; + + if (ioctl (pInfo->fd, EVIOCGABS(i), &absinfo) < 0) { + xf86Msg(X_ERROR, "ioctl EVIOCGABS (%d) failed: %s\n", i, strerror(errno)); + continue; + } + state->abs->min[state->abs->map[i]] = absinfo.minimum; + state->abs->max[state->abs->map[i]] = absinfo.maximum; + } - for (i = 0; i < ABS_MAX; i++) - state->axes->v[i] = 0; } static void -EvdevAxesAbsSyn (InputInfoPtr pInfo) +EvdevAxesAbsSynRep (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; - int i, n; + int i = 0; + Bool skip_xy = 0; if (!state->axes || !state->abs || !state->abs->count) return; - n = state->abs->n & 1; - state->abs->n++; - i = 0; - if (state->mode == Relative && state->abs->axes >= 2) { - for (i = 0; i < 2; i++) - state->axes->v[i] = state->abs->v[n][i] - state->abs->v[!n][i]; - EvdevAxesRealSyn (pInfo, 0); - } else if (state->mode == Absolute && state->abs->screen >= 0 && state->abs->axes >= 2) { + if (!state->abs->use_touch || state->abs->touch) { + if (state->abs->reset_x && state->abs->v[0] != state->abs->old_x) { + state->axes->v[0] = 0; + state->abs->reset_x = 0; +#if DEBUG + xf86Msg(X_INFO, "%s: Resetting X.\n", pInfo->name); +#endif + } else + state->axes->v[0] = state->abs->v[0] - state->abs->old_x; + + if (state->abs->reset_y && state->abs->v[1] != state->abs->old_y) { + state->axes->v[1] = 0; + state->abs->reset_y = 0; +#if DEBUG + xf86Msg(X_INFO, "%s: Resetting Y.\n", pInfo->name); +#endif + } else + state->axes->v[1] = state->abs->v[1] - state->abs->old_y; + + state->abs->old_x = state->abs->v[0]; + state->abs->old_y = state->abs->v[1]; + EvdevAxesRealSyn (pInfo, 0, 2); + } + skip_xy = 1; + } else if (state->mode == Absolute && state->abs->screen != -1 && state->abs->axes >= 2) { int conv_x, conv_y; for (i = 0; i < 2; i++) - state->axes->v[i] = xf86ScaleAxis (state->abs->v[n][i], + state->axes->v[i] = xf86ScaleAxis (state->abs->v[i], 0, state->abs->scale[i], state->abs->min[i], state->abs->max[i]); - EvdevConvert (pInfo, 0, 2, state->abs->v[n][0], state->abs->v[n][1], + EvdevConvert (pInfo, 0, 2, state->abs->v[0], state->abs->v[1], 0, 0, 0, 0, &conv_x, &conv_y); xf86XInputSetScreen (pInfo, state->abs->screen, conv_x, conv_y); } for (; i < ABS_MAX; i++) - state->axes->v[i] = state->abs->v[n][i]; + state->axes->v[i] = state->abs->v[i]; - EvdevAxesRealSyn (pInfo, 1); + EvdevAxesRealSyn (pInfo, 1, skip_xy); state->abs->count = 0; } static void -EvdevAxesRelSyn (InputInfoPtr pInfo) +EvdevAxesRelSynRep (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; - int i; + evdevRelPtr rel = state->rel; + int i, btn; if (!state->axes || !state->rel || !state->rel->count) return; for (i = 0; i < REL_MAX; i++) { - state->axes->v[i] = state->rel->v[i]; - state->rel->v[i] = 0; + if (rel->btnMap[i][0] || rel->btnMap[i][1]) { + if ((rel->v[i] > 0) && (btn = rel->btnMap[i][0])) + EvdevBtnPostFakeClicks (pInfo, btn, rel->v[i]); + else if ((rel->v[i] < 0) && (btn = rel->btnMap[i][1])) + EvdevBtnPostFakeClicks (pInfo, btn, -rel->v[i]); + } + + state->axes->v[i] = rel->v[i]; + rel->v[i] = 0; } - EvdevAxesRealSyn (pInfo, 0); - state->rel->count = 0; + EvdevAxesRealSyn (pInfo, 0, 0); + rel->count = 0; +} + +void +EvdevAxesSynRep (InputInfoPtr pInfo) +{ + EvdevAxesAbsSynRep (pInfo); + EvdevAxesRelSynRep (pInfo); } void -EvdevAxesSyn (InputInfoPtr pInfo) +EvdevAxesSynCfg (InputInfoPtr pInfo) { - EvdevAxesAbsSyn (pInfo); - EvdevAxesRelSyn (pInfo); + EvdevAxesAbsSynCfg (pInfo); +/* EvdevAxesRelSynCfg (pInfo);*/ } void @@ -256,7 +341,6 @@ EvdevAxesAbsProcess (InputInfoPtr pInfo, struct input_event *ev) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; - int n = state->abs->n & 1; int map; if (ev->code >= ABS_MAX) @@ -265,14 +349,14 @@ EvdevAxesAbsProcess (InputInfoPtr pInfo, struct input_event *ev) /* FIXME: Handle inverted axes properly. */ map = state->abs->map[ev->code]; if (map >= 0) - state->abs->v[n][map] = ev->value; + state->abs->v[map] = ev->value; else - state->abs->v[n][-map] = ev->value; + state->abs->v[-map] = ev->value; state->abs->count++; if (!state->sync) - EvdevAxesAbsSyn (pInfo); + EvdevAxesAbsSynRep (pInfo); } void @@ -294,7 +378,7 @@ EvdevAxesRelProcess (InputInfoPtr pInfo, struct input_event *ev) state->rel->count++; if (!state->sync) - EvdevAxesRelSyn (pInfo); + EvdevAxesRelSynRep (pInfo); } int @@ -310,12 +394,12 @@ EvdevAxesOff (DeviceIntPtr device) } static int -EvdevAxisAbsNew(InputInfoPtr pInfo) +EvdevAxisAbsNew0(InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; struct input_absinfo absinfo; - char *s, option[64]; + char option[64]; int i, j, k = 0, real_axes; real_axes = 0; @@ -365,9 +449,41 @@ EvdevAxisAbsNew(InputInfoPtr pInfo) state->abs->axes = state->abs->map[i]; } - if (state->abs->axes != real_axes) - xf86Msg(X_CONFIG, "%s: Configuring %d absolute axes.\n", pInfo->name, - state->abs->axes); + return Success; +} + +static int +EvdevAxisAbsNew1(InputInfoPtr pInfo) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + char *s; + int k = 0; + + if (!state->abs) + return !Success; + + xf86Msg(X_CONFIG, "%s: Configuring %d absolute axes.\n", pInfo->name, + state->abs->axes); + + { + int btn; + + s = xf86SetStrOption(pInfo->options, "AbsoluteTouch", "DIGI_Touch"); + btn = EvdevBtnFind (pInfo, s); + if (btn != -1) { + if (EvdevBtnExists (pInfo, btn)) { + state->abs->use_touch = 1; + xf86Msg(X_ERROR, "%s: Button: %d.\n", pInfo->name, btn); + xf86Msg(X_ERROR, "%s: state->btn: %p.\n", pInfo->name, state->btn); + state->btn->callback[btn] = &EvdevAxesTouchCallback; + } else { + xf86Msg(X_ERROR, "%s: AbsoluteTouch: '%s' does not exist.\n", pInfo->name, s); + } + } else { + xf86Msg(X_ERROR, "%s: AbsoluteTouch: '%s' is not a valid button name.\n", pInfo->name, s); + } + } s = xf86SetStrOption(pInfo->options, "Mode", "Absolute"); if (!strcasecmp(s, "Absolute")) { @@ -388,19 +504,20 @@ EvdevAxisAbsNew(InputInfoPtr pInfo) if (k < screenInfo.numScreens && k >= 0) { state->abs->screen = k; xf86Msg(X_CONFIG, "%s: AbsoluteScreen: %d.\n", pInfo->name, k); + + state->abs->scale[0] = screenInfo.screens[state->abs->screen]->width; + state->abs->scale[1] = screenInfo.screens[state->abs->screen]->height; } else { - state->abs->screen = 0; - xf86Msg(X_CONFIG, "%s: AbsoluteScreen: %d is not a valid screen.\n", pInfo->name, k); + if (k != -1) + xf86Msg(X_CONFIG, "%s: AbsoluteScreen: %d is not a valid screen.\n", pInfo->name, k); + state->abs->screen = -1; } - state->abs->scale[0] = screenInfo.screens[state->abs->screen]->width; - state->abs->scale[1] = screenInfo.screens[state->abs->screen]->height; - return Success; } static int -EvdevAxisRelNew(InputInfoPtr pInfo) +EvdevAxisRelNew0(InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; @@ -450,13 +567,13 @@ EvdevAxisRelNew(InputInfoPtr pInfo) k = state->rel->map[i]; - if (!s || (sscanf(s, "%d %d", &state->axes->btnMap[k][0], - &state->axes->btnMap[k][1]) != 2)) - state->axes->btnMap[k][0] = state->axes->btnMap[k][1] = 0; + if (!s || (sscanf(s, "%d %d", &state->rel->btnMap[k][0], + &state->rel->btnMap[k][1]) != 2)) + state->rel->btnMap[k][0] = state->rel->btnMap[k][1] = 0; - if (state->axes->btnMap[k][0] || state->axes->btnMap[k][1]) + if (state->rel->btnMap[k][0] || state->rel->btnMap[k][1]) xf86Msg(X_CONFIG, "%s: %s: %d %d.\n", pInfo->name, option, - state->axes->btnMap[k][0], state->axes->btnMap[k][1]); + state->rel->btnMap[k][0], state->rel->btnMap[k][1]); j++; } @@ -467,26 +584,57 @@ EvdevAxisRelNew(InputInfoPtr pInfo) state->rel->axes = state->rel->map[i]; if (state->abs && (state->abs->axes >= 2) && (state->rel->axes < 2)) - state->rel->axes = 2; + state->rel->axes += 2; - if (state->rel->axes != real_axes) - xf86Msg(X_CONFIG, "%s: Configuring %d relative axes.\n", pInfo->name, - state->rel->axes); + return Success; +} + +static int +EvdevAxisRelNew1(InputInfoPtr pInfo) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + + if (!state->rel) + return !Success; + + xf86Msg(X_CONFIG, "%s: Configuring %d relative axes.\n", pInfo->name, + state->rel->axes); return Success; } int -EvdevAxesNew (InputInfoPtr pInfo) +EvdevAxesNew0 (InputInfoPtr pInfo) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + int ret = Success; + + state->axes = Xcalloc (sizeof (evdevAxesRec)); + if (EvdevAxisAbsNew0(pInfo) != Success) + ret = !Success; + if (EvdevAxisRelNew0(pInfo) != Success) + ret = !Success; + if (!state->abs && !state->rel) { + Xfree (state->axes); + state->axes = NULL; + } + + return ret; +} + +int +EvdevAxesNew1 (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; int ret = Success; state->axes = Xcalloc (sizeof (evdevAxesRec)); - if (EvdevAxisAbsNew(pInfo) != Success) + if (EvdevAxisAbsNew1(pInfo) != Success) ret = !Success; - if (EvdevAxisRelNew(pInfo) != Success) + if (EvdevAxisRelNew1(pInfo) != Success) ret = !Success; if (!state->abs && !state->rel) { Xfree (state->axes); @@ -529,7 +677,7 @@ EvdevAxesInit (DeviceIntPtr device) return !Success; for (i = 0; i < axes; i++) { - xf86InitValuatorAxisStruct(device, i, 0, 0, 0, 0, 1); + xf86InitValuatorAxisStruct(device, i, 0, -1, 0, 0, 1); xf86InitValuatorDefaults(device, i); } @@ -541,3 +689,18 @@ EvdevAxesInit (DeviceIntPtr device) return Success; } +static void +EvdevAxesTouchCallback (InputInfoPtr pInfo, int button, int value) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + +#if DEBUG + xf86Msg(X_INFO, "%s: Touch callback; %d.\n", pInfo->name, value); +#endif + if (state->abs->use_touch) { + state->abs->touch = !!value; + if (value) + state->abs->reset_x = state->abs->reset_y = 1; + } +} diff --git a/src/evdev_btn.c b/src/evdev_btn.c index 35edee1..dc9ed67 100644 --- a/src/evdev_btn.c +++ b/src/evdev_btn.c @@ -51,6 +51,91 @@ #include <xf86Module.h> +static char *button_names[] = { + "MISC_0", + "MISC_1", + "MISC_2", + "MISC_3", + "MISC_4", + "MISC_5", + "MISC_6", + "MISC_7", + "MISC_8", + "MISC_9", + "MISC_10", + "MISC_11", + "MISC_12", + "MISC_13", + "MISC_14", + "MISC_15", + "MOUSE_LEFT", + "MOUSE_RIGHT", + "MOUSE_MIDDLE", + "MOUSE_SIDE", + "MOUSE_EXTRA", + "MOUSE_FORWARD", + "MOUSE_BACK", + "MOUSE_TASK", + "MOUSE_8", + "MOUSE_9", + "MOUSE_10", + "MOUSE_12", + "MOUSE_13", + "MOUSE_14", + "MOUSE_15", + "JOY_TRIGGER", + "JOY_THUMB", + "JOY_THUMB2", + "JOY_TOP", + "JOY_TOP2", + "JOY_PINKIE", + "JOY_BASE", + "JOY_BASE2", + "JOY_BASE3", + "JOY_BASE4", + "JOY_BASE5", + "JOY_BASE6", + "JOY_12", + "JOY_13", + "JOY_14", + "JOY_DEAD", + "GAME_A", + "GAME_B", + "GAME_C", + "GAME_X", + "GAME_Y", + "GAME_Z", + "GAME_TL", + "GAME_TR", + "GAME_TL2", + "GAME_TR2", + "GAME_SELECT", + "GAME_START", + "GAME_MODE", + "GAME_THUMBL", + "GAME_THUMBR", + "GAME_15", + "DIGI_TOOL_PEN", + "DIGI_TOOL_RUBBER", + "DIGI_TOOL_BRUSH", + "DIGI_TOOL_PENCIL", + "DIGI_TOOL_AIRBRUSH", + "DIGI_TOOL_FINGER", + "DIGI_TOOL_MOUSE", + "DIGI_TOOL_LENS", + "DIGI_8", + "DIGI_9", + "DIGI_TOUCH", + "DIGI_STYLUS", + "DIGI_STYLUS2", + "DIGI_TOOL_DOUBLETAP", + "DIGI_TOOL_TRIPLETAP", + "DIGI_15", + "WHEEL_GEAR_UP", + "WHEEL_GEAR_DOWN", + NULL +}; + void EvdevBtnPostFakeClicks(InputInfoPtr pInfo, int button, int count) { @@ -130,12 +215,12 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo) do { clear = 1; for (j = 0; j < REL_MAX; j++) { - if (state->axes->btnMap[j][0] == (i + base)) { + if (state->rel->btnMap[j][0] == (i + base)) { base++; clear = 0; break; } - if (state->axes->btnMap[j][1] == (i + base)) { + if (state->rel->btnMap[j][1] == (i + base)) { base++; clear = 0; break; @@ -158,17 +243,17 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo) if (state->rel) { for (i = 0; i < REL_MAX; i++) { - if (state->axes->btnMap[i][0] > state->btn->buttons) - state->btn->buttons = state->axes->btnMap[i][0]; - if (state->axes->btnMap[i][1] > state->btn->buttons) - state->btn->buttons = state->axes->btnMap[i][1]; + if (state->rel->btnMap[i][0] > state->btn->buttons) + state->btn->buttons = state->rel->btnMap[i][0]; + if (state->rel->btnMap[i][1] > state->btn->buttons) + state->btn->buttons = state->rel->btnMap[i][1]; } } } int -EvdevBtnNew(InputInfoPtr pInfo) +EvdevBtnNew0(InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; @@ -191,6 +276,18 @@ EvdevBtnNew(InputInfoPtr pInfo) if (state->btn->real_buttons) xf86Msg(X_INFO, "%s: Found %d mouse buttons\n", pInfo->name, state->btn->real_buttons); + return Success; +} + +int +EvdevBtnNew1(InputInfoPtr pInfo) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + + if (!state->btn) + return !Success; + EvdevBtnCalcRemap (pInfo); if (state->btn->buttons) @@ -221,7 +318,7 @@ EvdevBtnProcess (InputInfoPtr pInfo, struct input_event *ev) if (!state->btn) return; - button = ev->code - BTN_MISC; + button = ev->code; if ((ev->code >= BTN_MOUSE) && (ev->code < BTN_JOYSTICK)) { button -= BTN_MOUSE - BTN_MISC; @@ -229,9 +326,42 @@ EvdevBtnProcess (InputInfoPtr pInfo, struct input_event *ev) button += BTN_MOUSE - BTN_MISC; } - if (state->btn->state[button]) - *state->btn->state[button] = ev->value; + button -= BTN_MISC; + + if (state->btn->callback[button]) + state->btn->callback[button](pInfo, button, ev->value); button = state->btn->map[button]; xf86PostButtonEvent (pInfo->dev, 0, button, ev->value, 0, 0); } + +int +EvdevBtnFind (InputInfoPtr pInfo, const char *button) +{ + int i; + + for (i = 0; button_names[i]; i++) + if (!strcasecmp(button, button_names[i])) + return i + 1; + + return -1; +} + +int +EvdevBtnExists (InputInfoPtr pInfo, int button) +{ + evdevDevicePtr pEvdev = pInfo->private; + + button += BTN_MISC; + + xf86Msg(X_INFO, "%s: Checking button %s (%d)\n", pInfo->name, button_names[button - BTN_MISC], button); + + if ((button >= BTN_MOUSE) && (button < BTN_JOYSTICK)) { + button -= BTN_MOUSE - BTN_MISC; + } else if ((button >= BTN_MISC) && (button < BTN_MOUSE)) { + button += BTN_MOUSE - BTN_MISC; + } + + xf86Msg(X_INFO, "%s: Checking bit %d\n", pInfo->name, button); + return test_bit(button, pEvdev->bits.key); +} diff --git a/src/inotify-syscalls.h b/src/inotify-syscalls.h index 7c68bc6..296da90 100644 --- a/src/inotify-syscalls.h +++ b/src/inotify-syscalls.h @@ -57,6 +57,10 @@ # define __NR_inotify_add_watch 5244 # define __NR_inotify_rm_watch 5245 # endif +#elif defined (__mc68000__) +# define __NR_inotify_init 284 +# define __NR_inotify_add_watch 285 +# define __NR_inotify_rm_watch 286 #else # error "Unsupported architecture!" #endif |