From eba5ea8d5a19f2b1984cbf20c95d22e243f19567 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Tue, 11 Jul 2006 03:08:30 -0400 Subject: [PATCH 01/13] Set pInfo->fd to -1 when we close it in EvdevProc. --- src/evdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/evdev.c b/src/evdev.c index 69deef6..00323ae 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -200,6 +200,7 @@ EvdevProc(DeviceIntPtr device, int what) RemoveEnabledDevice (pInfo->fd); xf86RemoveSIGIOHandler (pInfo->fd); close (pInfo->fd); + pInfo->fd = -1; if (pEvdev->state.axes) EvdevAxesOff (device); From 9cb7c3dbad1a4afdb84c338e83f597455022dcdc Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Tue, 11 Jul 2006 12:48:10 -0400 Subject: [PATCH 02/13] (Hope this works.) Remove the ChangeLog file, as the entire contents can be gotten via 'git log'. --- ChangeLog | 368 ------------------------------------------------------ 1 file changed, 368 deletions(-) delete mode 100644 ChangeLog 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 - - * src/inotify-syscalls.h: - MIPS support. (Joshua Kinard) - -2006-06-02 Adam Jackson - - * src/evdev_axes.c: - Fix an obvious bogon to avoid crashing on absolute axis setup. - -2006-05-15 Zephaniah E. Hull,,, - - * src/evdev.h: - Hopefully fix the bitops stuff to actually _work_. - -2006-05-14 Zephaniah E. Hull - - * 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 - ) - -2006-04-30 Zephaniah E. Hull - - * configure.ac: - xf86-input-evdev v1.1.2 - * src/evdev_brain.c: (evdevControl): - Bugzilla #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 - - * configure.ac: - * src/Makefile.am: - xf86-input-evdev v1.1.1 - -2006-04-14 Zephaniah E. Hull - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * man/evdev.man: - Update to include all the new device matching options. - -2006-02-27 Zephaniah E. Hull - - * 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 - - * 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 - - * src/Makefile.am: - Compile with -Wall now. - Add evdev.h to the sources so that make distcheck gets it. - - * src/evdev.h: - Bugzilla #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: - 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 - - * src/evdev_btn.c: (EvdevBtnInit): - Bugzilla #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 - - * src/evdev_key.c: (EvdevKbdBell): - Add bell support. - -2006-02-16 Zephaniah E. Hull - - * src/evdev_btn.c: (EvdevBtnCalcRemap): - Bugzilla #5914 - Stupid little bug, properly handle wheels on 3 button mice. - -2006-02-14 Zephaniah E. Hull - - * 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 - 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,,, - - * man/Makefile.am: - * man/evdev.man: - Bugzilla #968 - Patch #4301 - Add evdev manpage - -2005-12-20 Kevin E. Martin - - * configure.ac: - Update package version for X11R7 release. - -2005-12-14 Kevin E. Martin - - * configure.ac: - Update package version number for final X11R7 release candidate. - -2005-12-06 Kevin E. Martin - - * man/Makefile.am: - Change *man_SOURCES ==> *man_PRE to fix autotools warnings. - -2005-12-03 Kevin E. Martin - - * configure.ac: - Update package version number for X11R7 RC3 release. - -2005-12-01 Kevin E. Martin - - * configure.ac: - Remove extraneous AC_MSG_RESULT. - -2005-11-29 Adam Jackson - - * configure.ac: - Only build dlloader modules by default. - -2005-11-09 Kevin E. Martin - - * configure.ac: - Update package version number for X11R7 RC2 release. - -2005-11-01 Kevin E. Martin - - * configure.ac: - Update pkgcheck dependencies to work with separate build roots. From f7a9c74fbccd79bf406b0afc41237303642b75c2 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Tue, 11 Jul 2006 16:42:41 -0400 Subject: [PATCH 03/13] Grab the ChangeLog generation rule from libX11. --- Makefile.am | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 From 1b9a9599a4df85b0e925086d12bd48626b09bb45 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Tue, 11 Jul 2006 16:44:43 -0400 Subject: [PATCH 04/13] Rename .cvsignore to .gitignore. --- .cvsignore => .gitignore | 0 man/{.cvsignore => .gitignore} | 0 src/{.cvsignore => .gitignore} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .cvsignore => .gitignore (100%) rename man/{.cvsignore => .gitignore} (100%) rename src/{.cvsignore => .gitignore} (100%) diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/man/.cvsignore b/man/.gitignore similarity index 100% rename from man/.cvsignore rename to man/.gitignore diff --git a/src/.cvsignore b/src/.gitignore similarity index 100% rename from src/.cvsignore rename to src/.gitignore From 090d43acf315283effe8a1c858cac8167ebe4d08 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Tue, 11 Jul 2006 16:47:15 -0400 Subject: [PATCH 05/13] Update the .gitignore files to remove some more noise. --- .gitignore | 5 +++++ man/.gitignore | 1 + 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index fb1befd..da4f97a 100644 --- a/.gitignore +++ b/.gitignore @@ -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/man/.gitignore b/man/.gitignore index 282522d..c060ea5 100644 --- a/man/.gitignore +++ b/man/.gitignore @@ -1,2 +1,3 @@ Makefile Makefile.in +evdev.4 From dc88668839f4613d60526aa78aed3e74eebe64ad Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Thu, 13 Jul 2006 11:59:25 -0400 Subject: [PATCH 06/13] Split the New functions so that structs can be allocated and buttons detected, and then stuff that depends on _other_ areas. (Specificly, axes and btn have a circular dependency on which one has to run first, this solves that.) Add button names, and a way to get a button number from a name. Add a function for checking to see if a button exists, takes the number from the previous function. Change the (unused) state array of pointers in the button struct to an array of pointers to functions for callback. Implemented the 'touch' feature, on by default if BTN_DIGI_TOUCH exists, won't, in rel mode, process x/y data unless it's down, and is used to try and make 'pick up stencil, move to other side of digitizer, set back down' not jump to the other side of the screen in rel mode. (This doesn't work as well as it could, but I'm fairly sure that it's due to the quality of the absolute input device I'm using, but feedback would be really nice.) FIXME: Update the manpage for this. --- src/evdev.c | 11 ++- src/evdev.h | 13 ++- src/evdev_axes.c | 216 +++++++++++++++++++++++++++++++++++++---------- src/evdev_btn.c | 138 +++++++++++++++++++++++++++++- 4 files changed, 322 insertions(+), 56 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 00323ae..2d8d120 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -228,6 +228,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 @@ -298,9 +299,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); diff --git a/src/evdev.h b/src/evdev.h index a399571..2a65530 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -151,7 +151,7 @@ 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 { @@ -164,6 +164,9 @@ typedef struct { int map[ABS_MAX]; int scale[2]; int screen; /* Screen number for this device. */ + Bool use_touch; + Bool touch; + Bool reset; } evdevAbsRec, *evdevAbsPtr; typedef struct { @@ -247,14 +250,18 @@ 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); diff --git a/src/evdev_axes.c b/src/evdev_axes.c index 0d9b5a7..751978f 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -136,6 +136,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,7 +151,7 @@ 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; @@ -163,27 +165,60 @@ EvdevAxesRealSyn (InputInfoPtr pInfo, int absolute) EvdevBtnPostFakeClicks (pInfo, btn, -state->axes->v[i]); } - 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 && (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]); + */ - for (i = 0; i < ABS_MAX; i++) - state->axes->v[i] = 0; + /* 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 @@ -192,6 +227,7 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; int i, n; + Bool skip_xy = 0; if (!state->axes || !state->abs || !state->abs->count) return; @@ -201,10 +237,21 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) 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) { + for (i = 0; i < 2; i++) + state->axes->v[i] = 0; + xf86Msg(X_INFO, "%s: Resetting.\n", pInfo->name); + state->abs->reset = 0; + } else + for (i = 0; i < 2; i++) { + state->axes->v[i] = state->abs->v[n][i] - state->abs->v[!n][i]; + state->axes->v[i] /= 4; + } + 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++) @@ -221,7 +268,7 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) for (; i < ABS_MAX; i++) state->axes->v[i] = state->abs->v[n][i]; - EvdevAxesRealSyn (pInfo, 1); + EvdevAxesRealSyn (pInfo, 1, skip_xy); state->abs->count = 0; } @@ -240,7 +287,7 @@ EvdevAxesRelSyn (InputInfoPtr pInfo) state->rel->v[i] = 0; } - EvdevAxesRealSyn (pInfo, 0); + EvdevAxesRealSyn (pInfo, 0, 0); state->rel->count = 0; } @@ -310,12 +357,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 +412,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 +467,20 @@ EvdevAxisAbsNew(InputInfoPtr pInfo) if (k < screenInfo.numScreens && k >= 0) { state->abs->screen = k; xf86Msg(X_CONFIG, "%s: AbsoluteScreen: %d.\n", pInfo->name, k); - } else { - state->abs->screen = 0; - xf86Msg(X_CONFIG, "%s: AbsoluteScreen: %d is not a valid screen.\n", pInfo->name, k); - } - state->abs->scale[0] = screenInfo.screens[state->abs->screen]->width; - state->abs->scale[1] = screenInfo.screens[state->abs->screen]->height; + state->abs->scale[0] = screenInfo.screens[state->abs->screen]->width; + state->abs->scale[1] = screenInfo.screens[state->abs->screen]->height; + } else { + if (k != -1) + xf86Msg(X_CONFIG, "%s: AbsoluteScreen: %d is not a valid screen.\n", pInfo->name, k); + state->abs->screen = -1; + } return Success; } static int -EvdevAxisRelNew(InputInfoPtr pInfo) +EvdevAxisRelNew0(InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; @@ -467,26 +547,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 (EvdevAxisAbsNew(pInfo) != Success) + if (EvdevAxisAbsNew0(pInfo) != Success) ret = !Success; - if (EvdevAxisRelNew(pInfo) != 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 (EvdevAxisAbsNew1(pInfo) != Success) + ret = !Success; + if (EvdevAxisRelNew1(pInfo) != Success) ret = !Success; if (!state->abs && !state->rel) { Xfree (state->axes); @@ -541,3 +652,16 @@ EvdevAxesInit (DeviceIntPtr device) return Success; } +static void +EvdevAxesTouchCallback (InputInfoPtr pInfo, int button, int value) +{ + evdevDevicePtr pEvdev = pInfo->private; + evdevStatePtr state = &pEvdev->state; + + xf86Msg(X_INFO, "%s: Touch callback; %d.\n", pInfo->name, value); + if (state->abs->use_touch) { + state->abs->touch = !!value; + if (value) + state->abs->reset = 1; + } +} diff --git a/src/evdev_btn.c b/src/evdev_btn.c index 35edee1..9a9b65e 100644 --- a/src/evdev_btn.c +++ b/src/evdev_btn.c @@ -51,6 +51,91 @@ #include +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) { @@ -168,7 +253,7 @@ EvdevBtnCalcRemap (InputInfoPtr pInfo) 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); +} From fa03de438ea0ae0f07424235f4972e73ff88ef17 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Wed, 19 Jul 2006 23:06:23 -0400 Subject: [PATCH 07/13] Move the axis to button map code back into the rel code. This might solve some problems, but should at least prevent some odd behavior. --- src/evdev.h | 2 +- src/evdev_axes.c | 41 +++++++++++++++++++---------------------- src/evdev_btn.c | 12 ++++++------ 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/evdev.h b/src/evdev.h index 2a65530..161978d 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -174,12 +174,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 { diff --git a/src/evdev_axes.c b/src/evdev_axes.c index 751978f..cc1c24d 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -156,14 +156,7 @@ EvdevAxesRealSyn (InputInfoPtr pInfo, int absolute, int skip_xy) evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; evdevAxesPtr axes = state->axes; - int i, btn; - - 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]); - } + int i; /* if (skip_xy && (axes->v[0] || axes->v[1])) @@ -226,16 +219,12 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; - int i, n; + int i = 0, n = state->abs->n++ & 1; 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) { if (!state->abs->use_touch || state->abs->touch) { if (state->abs->reset) { @@ -277,18 +266,26 @@ EvdevAxesRelSyn (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, 0); - state->rel->count = 0; + rel->count = 0; } void @@ -530,13 +527,13 @@ EvdevAxisRelNew0(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++; } diff --git a/src/evdev_btn.c b/src/evdev_btn.c index 9a9b65e..dc9ed67 100644 --- a/src/evdev_btn.c +++ b/src/evdev_btn.c @@ -215,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; @@ -243,10 +243,10 @@ 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]; } } } From 771eee968282e308d997adfa78bd39e7429d2c1c Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Sun, 23 Jul 2006 22:40:51 -0400 Subject: [PATCH 08/13] Replace the old two buffer approach to handling rel emulation of abs axes, should help with some of the reported jitter problems. --- src/evdev.h | 4 ++-- src/evdev_axes.c | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/evdev.h b/src/evdev.h index 161978d..db33546 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -156,8 +156,8 @@ typedef struct { 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]; diff --git a/src/evdev_axes.c b/src/evdev_axes.c index cc1c24d..df6eb4b 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -219,7 +219,7 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; - int i = 0, n = state->abs->n++ & 1; + int i = 0; Bool skip_xy = 0; if (!state->axes || !state->abs || !state->abs->count) @@ -232,11 +232,12 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) state->axes->v[i] = 0; xf86Msg(X_INFO, "%s: Resetting.\n", pInfo->name); state->abs->reset = 0; - } else - for (i = 0; i < 2; i++) { - state->axes->v[i] = state->abs->v[n][i] - state->abs->v[!n][i]; - state->axes->v[i] /= 4; - } + } else { + state->axes->v[0] = state->abs->v[0] - state->abs->old_x; + 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; @@ -244,18 +245,18 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) 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, skip_xy); state->abs->count = 0; @@ -300,7 +301,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) @@ -309,9 +309,9 @@ 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++; From ab65184d472614d2664e6cd7bca2d6dbc28fad07 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Sun, 10 Sep 2006 06:47:15 -0400 Subject: [PATCH 09/13] Fix compilation. --- src/evdev.c | 10 +++++++--- src/evdev.h | 9 ++++++++- src/evdev_axes.c | 45 +++++++++++++++++++++++++++++++++++++-------- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 2d8d120..1b7fb86 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; } diff --git a/src/evdev.h b/src/evdev.h index db33546..0425482 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -117,6 +117,12 @@ #include #include +/* XInput 1.4+ compatability. */ +#ifndef SendCoreEvents +#define SendCoreEvents 59 +#define DontSendCoreEvents 60 +#endif + /* * Switch events @@ -264,7 +270,8 @@ 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 df6eb4b..28bcdc9 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -215,7 +215,29 @@ EvdevAxesRealSyn (InputInfoPtr pInfo, int absolute, int skip_xy) } static void -EvdevAxesAbsSyn (InputInfoPtr pInfo) +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; + } + +} + +static void +EvdevAxesAbsSynRep (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; @@ -263,7 +285,7 @@ EvdevAxesAbsSyn (InputInfoPtr pInfo) } static void -EvdevAxesRelSyn (InputInfoPtr pInfo) +EvdevAxesRelSynRep (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; @@ -290,10 +312,17 @@ EvdevAxesRelSyn (InputInfoPtr pInfo) } void -EvdevAxesSyn (InputInfoPtr pInfo) +EvdevAxesSynRep (InputInfoPtr pInfo) { - EvdevAxesAbsSyn (pInfo); - EvdevAxesRelSyn (pInfo); + EvdevAxesAbsSynRep (pInfo); + EvdevAxesRelSynRep (pInfo); +} + +void +EvdevAxesSynCfg (InputInfoPtr pInfo) +{ + EvdevAxesAbsSynCfg (pInfo); +/* EvdevAxesRelSynCfg (pInfo);*/ } void @@ -316,7 +345,7 @@ EvdevAxesAbsProcess (InputInfoPtr pInfo, struct input_event *ev) state->abs->count++; if (!state->sync) - EvdevAxesAbsSyn (pInfo); + EvdevAxesAbsSynRep (pInfo); } void @@ -338,7 +367,7 @@ EvdevAxesRelProcess (InputInfoPtr pInfo, struct input_event *ev) state->rel->count++; if (!state->sync) - EvdevAxesRelSyn (pInfo); + EvdevAxesRelSynRep (pInfo); } int @@ -637,7 +666,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); } From d8ea40dc4a78a6197d474d806ac5367dae83655a Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Mon, 2 Oct 2006 17:49:20 -0400 Subject: [PATCH 10/13] Use XORG_VERSION_CURRENT in the module version struct. --- src/evdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evdev.c b/src/evdev.c index 1b7fb86..fd02f75 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -482,7 +482,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, From a96b048e560782399a98c57cad255df778471ea1 Mon Sep 17 00:00:00 2001 From: "Zephaniah E. Hull" Date: Mon, 2 Oct 2006 17:50:55 -0400 Subject: [PATCH 11/13] Make some debugging messages optional. Correctly handle emulating relative mode from absolute data in the case where we do not get X and Y data at the same time on touching. --- src/evdev.h | 2 +- src/evdev_axes.c | 35 ++++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/evdev.h b/src/evdev.h index 0425482..db0d287 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -172,7 +172,7 @@ typedef struct { int screen; /* Screen number for this device. */ Bool use_touch; Bool touch; - Bool reset; + Bool reset_x, reset_y; } evdevAbsRec, *evdevAbsPtr; typedef struct { diff --git a/src/evdev_axes.c b/src/evdev_axes.c index 28bcdc9..6879ab1 100644 --- a/src/evdev_axes.c +++ b/src/evdev_axes.c @@ -49,6 +49,8 @@ #include +#undef DEBUG + static char *rel_axis_names[] = { "X", "Y", @@ -158,10 +160,10 @@ EvdevAxesRealSyn (InputInfoPtr pInfo, int absolute, int skip_xy) evdevAxesPtr axes = state->axes; int i; - /* - if (skip_xy && (axes->v[0] || axes->v[1])) +#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 /* FIXME: This is a truly evil kluge. */ if (skip_xy == 1 && state->axes->axes >= 2) @@ -249,15 +251,24 @@ EvdevAxesAbsSynRep (InputInfoPtr pInfo) if (state->mode == Relative && state->abs->axes >= 2) { if (!state->abs->use_touch || state->abs->touch) { - if (state->abs->reset) { - for (i = 0; i < 2; i++) - state->axes->v[i] = 0; - xf86Msg(X_INFO, "%s: Resetting.\n", pInfo->name); - state->abs->reset = 0; - } else { + 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); @@ -684,10 +695,12 @@ 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 = 1; + state->abs->reset_x = state->abs->reset_y = 1; } } From 5c5ef3fbd6eb0b668139df3ff5eda67766e86dcd Mon Sep 17 00:00:00 2001 From: Drew Parsons Date: Fri, 6 Oct 2006 10:56:24 +1000 Subject: [PATCH 12/13] m68k support (thanks Geert Uytterhoeven for the inotify codes). --- src/inotify-syscalls.h | 4 ++++ 1 file changed, 4 insertions(+) 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 From 4c72fb7b769b78cfa2b4cc39eb03fdacd2b5039c Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 13 Oct 2006 18:25:10 -0400 Subject: [PATCH 13/13] Bump to 1.1.3 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)