Compare commits

...

18 Commits

Author SHA1 Message Date
Adam Jackson
4c72fb7b76 Bump to 1.1.3 2006-10-13 18:25:10 -04:00
Drew Parsons
5c5ef3fbd6 m68k support (thanks Geert Uytterhoeven for the inotify codes). 2006-10-06 10:56:24 +10:00
Zephaniah E. Hull
a96b048e56 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.
2006-10-02 17:50:55 -04:00
Zephaniah E. Hull
d8ea40dc4a Use XORG_VERSION_CURRENT in the module version struct. 2006-10-02 17:49:20 -04:00
Zephaniah E. Hull
ab65184d47 Fix compilation. 2006-09-10 06:47:15 -04:00
Zephaniah E. Hull
771eee9682 Replace the old two buffer approach to handling rel emulation of abs axes,
should help with some of the reported jitter problems.
2006-07-23 22:40:51 -04:00
Zephaniah E. Hull
fa03de438e 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.
2006-07-19 23:06:23 -04:00
Zephaniah E. Hull
dc88668839 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.
2006-07-13 11:59:25 -04:00
Zephaniah E. Hull
090d43acf3 Update the .gitignore files to remove some more noise. 2006-07-11 16:47:15 -04:00
Zephaniah E. Hull
1b9a9599a4 Rename .cvsignore to .gitignore. 2006-07-11 16:44:43 -04:00
Zephaniah E. Hull
f7a9c74fbc Grab the ChangeLog generation rule from libX11. 2006-07-11 16:42:41 -04:00
Zephaniah E. Hull
9cb7c3dbad (Hope this works.)
Remove the ChangeLog file, as the entire contents can be gotten via 'git log'.
2006-07-11 12:48:10 -04:00
Zephaniah E. Hull
eba5ea8d5a Set pInfo->fd to -1 when we close it in EvdevProc. 2006-07-11 03:08:30 -04:00
Adam Jackson
4645247d45 MIPS support. (Joshua Kinard) 2006-06-22 21:16:44 +00:00
Adam Jackson
57a7f28441 Fix an obvious bogon to avoid crashing on absolute axis setup. 2006-06-02 19:39:52 +00:00
Zephaniah E. Hull
1b03250797 Hopefully fix the bitops stuff to actually _work_. 2006-05-15 22:47:23 +00:00
Zephaniah E. Hull
e9c60da89a Tweak credits and references.
Change the longs to unsigned longs in the bitfields.
Cleanup our includes.
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.
Change the longs to unsigned longs in the bitfields.
Use the bitop defines in evdev.h properly.
Change the longs to unsigned longs in the bitfields.
Change the longs to unsigned longs in the bitfields.
Use the bitop defines in evdev.h properly.
Change the longs to unsigned longs in the bitfields.
Use the bitop defines in evdev.h properly.
Add HPPA/HPPA64 entries. (Thanks to Fabio M. Di Nitto
    <fabbione@ubuntu.com>)
2006-05-14 11:55:50 +00:00
Zephaniah E. Hull
eca922bd95 xf86-input-evdev v1.1.2
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-30 21:39:08 +00:00
14 changed files with 517 additions and 477 deletions

View File

@@ -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

310
ChangeLog
View File

@@ -1,310 +0,0 @@
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.

View File

@@ -20,3 +20,14 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src man
EXTRA_DIST=ChangeLog
CLEANFILES=ChangeLog
.PHONY: ChangeLog
ChangeLog:
git-log > ChangeLog
dist-hook: ChangeLog

View File

@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-evdev],
1.1.1,
1.1.3,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-evdev)

View File

@@ -1,2 +1,3 @@
Makefile
Makefile.in
evdev.4

View File

@@ -312,16 +312,11 @@ enhance the keyboard layout details. Default: not set.
.BI "Option \*qXkbOptions\*q \*q" options \*q
specifies the XKB keyboard option components. These can be used to
enhance the keyboard behaviour. Default: not set.
.PP
Some other XKB-related options are available, but they are incompatible
with the ones listed above and are not recommended, so they are not
documented here.
.TP 7
.PP
.SH AUTHORS
Kristian Høgsberg.
.fi
Zephaniah E. Hull.
.fi
Kristian Høgsberg.
.SH "SEE ALSO"
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
README.mouse.
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__).

View File

View File

@@ -61,8 +61,6 @@
#include <X11/XF86keysym.h>
#include <X11/extensions/XIproto.h>
#include <string.h>
#include "evdev.h"
#include <xf86.h>
@@ -119,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;
}
@@ -202,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);
@@ -229,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
@@ -299,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);
@@ -328,7 +336,7 @@ EvdevNew(evdevDriverPtr driver, evdevDevicePtr device)
}
static void
EvdevParseBits (char *in, long *out, int len)
EvdevParseBits (char *in, unsigned long *out, int len)
{
unsigned long v[2];
int n, i, max_bits = len * BITS_PER_LONG;
@@ -351,7 +359,7 @@ EvdevParseBits (char *in, long *out, int len)
}
static void
EvdevParseBitOption (char *opt, long *all, long *not, long *any, int len)
EvdevParseBitOption (char *opt, unsigned long *all, unsigned long *not, unsigned long *any, int len)
{
char *cur, *next;
@@ -395,7 +403,7 @@ EvdevCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
EvdevParseBitOption (tmp, pEvdev->all_bits.field, \
pEvdev->not_bits.field, \
pEvdev->any_bits.field, \
sizeof(pEvdev->not_bits.field) / sizeof (long)); \
sizeof(pEvdev->not_bits.field) / sizeof (unsigned long)); \
free (tmp); \
}
bitoption(ev);
@@ -474,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,

View File

@@ -72,20 +72,29 @@
#include <stdarg.h>
#include <xf86Xinput.h>
#define BITS_PER_LONG (sizeof(long) * 8)
#ifndef BITS_PER_LONG
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
#endif
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
#define MASK(x) (1UL << ((x) & (BITS_PER_LONG - 1)))
#ifndef test_bit
#define test_bit(bit, array) (!!(array[LONG(bit)] & MASK(bit)))
#endif
#ifndef set_bit
#define set_bit(bit, array) (array[LONG(bit)] |= MASK(bit))
#endif
#ifndef clear_bit
#define clear_bit(bit, array) (array[LONG(bit)] &= ~MASK(bit))
#endif
/* 2.4 compatibility */
#ifndef EVIOCGSW
#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 */
@@ -108,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
@@ -128,33 +143,36 @@
#define EVDEV_MAXBUTTONS 96
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)];
unsigned long ev[NBITS(EV_MAX)];
unsigned long key[NBITS(KEY_MAX)];
unsigned long rel[NBITS(REL_MAX)];
unsigned long abs[NBITS(ABS_MAX)];
unsigned long msc[NBITS(MSC_MAX)];
unsigned long led[NBITS(LED_MAX)];
unsigned long snd[NBITS(SND_MAX)];
unsigned long ff[NBITS(FF_MAX)];
} evdevBitsRec, *evdevBitsPtr;
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 {
@@ -162,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 {
@@ -238,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);

View File

@@ -49,13 +49,7 @@
#include <xf86_OSproc.h>
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
#define BITS_PER_LONG (sizeof(long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define TestBit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
#undef DEBUG
static char *rel_axis_names[] = {
"X",
@@ -144,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)
@@ -157,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]);
for (i = 0; i < ABS_MAX; i++)
state->axes->v[i] = 0;
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
EvdevAxesAbsSyn (InputInfoPtr pInfo)
EvdevAxesAbsSynCfg (InputInfoPtr pInfo)
{
evdevDevicePtr pEvdev = pInfo->private;
evdevStatePtr state = &pEvdev->state;
int i, n;
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;
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
EvdevAxesSyn (InputInfoPtr pInfo)
EvdevAxesSynRep (InputInfoPtr pInfo)
{
EvdevAxesAbsSyn (pInfo);
EvdevAxesRelSyn (pInfo);
EvdevAxesAbsSynRep (pInfo);
EvdevAxesRelSynRep (pInfo);
}
void
EvdevAxesSynCfg (InputInfoPtr pInfo)
{
EvdevAxesAbsSynCfg (pInfo);
/* EvdevAxesRelSynCfg (pInfo);*/
}
void
@@ -264,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)
@@ -273,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
@@ -302,7 +378,7 @@ EvdevAxesRelProcess (InputInfoPtr pInfo, struct input_event *ev)
state->rel->count++;
if (!state->sync)
EvdevAxesRelSyn (pInfo);
EvdevAxesRelSynRep (pInfo);
}
int
@@ -318,17 +394,17 @@ 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;
for (i = 0; i < ABS_MAX; i++)
if (TestBit (i, pEvdev->bits.abs))
if (test_bit (i, pEvdev->bits.abs))
real_axes++;
if (!real_axes)
@@ -344,7 +420,7 @@ EvdevAxisAbsNew(InputInfoPtr pInfo)
pInfo->conversion_proc = EvdevConvert;
for (i = 0, j = 0; i < ABS_MAX; i++) {
if (!TestBit (i, pEvdev->bits.abs))
if (!test_bit (i, pEvdev->bits.abs))
continue;
snprintf(option, sizeof(option), "%sAbsoluteAxisMap", abs_axis_names[i]);
@@ -373,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")) {
@@ -389,26 +497,27 @@ EvdevAxisAbsNew(InputInfoPtr pInfo)
xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s);
}
if (TestBit (ABS_X, pEvdev->bits.abs) && TestBit (ABS_Y, pEvdev->bits.abs))
if (test_bit (ABS_X, pEvdev->bits.abs) && test_bit (ABS_Y, pEvdev->bits.abs))
k = xf86SetIntOption(pInfo->options, "AbsoluteScreen", 0);
else
k = xf86SetIntOption(pInfo->options, "AbsoluteScreen", -1);
if (k < screenInfo.numScreens) {
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;
@@ -417,7 +526,7 @@ EvdevAxisRelNew(InputInfoPtr pInfo)
real_axes = 0;
for (i = 0; i < REL_MAX; i++)
if (TestBit (i, pEvdev->bits.rel))
if (test_bit (i, pEvdev->bits.rel))
real_axes++;
if (!real_axes && (!state->abs || state->abs->axes < 2))
@@ -434,7 +543,7 @@ EvdevAxisRelNew(InputInfoPtr pInfo)
pInfo->conversion_proc = EvdevConvert;
for (i = 0, j = 0; i < REL_MAX; i++) {
if (!TestBit (i, pEvdev->bits.rel))
if (!test_bit (i, pEvdev->bits.rel))
continue;
snprintf(option, sizeof(option), "%sRelativeAxisMap", rel_axis_names[i]);
@@ -458,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++;
}
@@ -475,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 (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);
@@ -537,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);
}
@@ -549,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;
}
}

View File

@@ -39,6 +39,7 @@
#include <xf86.h>
#include <fnmatch.h>
#include <sys/poll.h>
#include "inotify.h"
#include "inotify-syscalls.h"
@@ -85,7 +86,7 @@ typedef struct {
} evdevDevInfoRec, *evdevDevInfoPtr;
static Bool
MatchAll (long *dev, long *match, int len)
MatchAll (unsigned long *dev, unsigned long *match, int len)
{
int i;
@@ -97,7 +98,7 @@ MatchAll (long *dev, long *match, int len)
}
static Bool
MatchNot (long *dev, long *match, int len)
MatchNot (unsigned long *dev, unsigned long *match, int len)
{
int i;
@@ -109,7 +110,7 @@ MatchNot (long *dev, long *match, int len)
}
static Bool
MatchAny (long *dev, long *match, int len)
MatchAny (unsigned long *dev, unsigned long *match, int len)
{
int i, found = 0;
@@ -347,7 +348,7 @@ static int
evdevControl(DeviceIntPtr pPointer, int what)
{
InputInfoPtr pInfo;
int i;
int i, flags;
pInfo = pPointer->public.devicePrivate;
@@ -376,6 +377,19 @@ evdevControl(DeviceIntPtr pPointer, int what)
SYSCALL (close (pInfo->fd));
pInfo->fd = -1;
}
if ((flags = fcntl(pInfo->fd, F_GETFL)) < 0) {
xf86Msg(X_ERROR, "%s: Unable to NONBLOCK inotify, using fallback. "
"(errno: %d)\n", pInfo->name, errno);
evdev_inotify = 0;
SYSCALL (close (pInfo->fd));
pInfo->fd = -1;
} else if (fcntl(pInfo->fd, F_SETFL, flags | O_NONBLOCK) < 0) {
xf86Msg(X_ERROR, "%s: Unable to NONBLOCK inotify, using fallback. "
"(errno: %d)\n", pInfo->name, errno);
evdev_inotify = 0;
SYSCALL (close (pInfo->fd));
pInfo->fd = -1;
}
if (!evdev_inotify) {
SYSCALL (pInfo->fd = open ("/proc/bus/usb/devices", O_RDONLY));

View File

@@ -51,14 +51,90 @@
#include <xf86Module.h>
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
#define BITS_PER_LONG (sizeof(long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define TestBit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
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)
@@ -139,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;
@@ -167,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;
@@ -186,7 +262,7 @@ EvdevBtnNew(InputInfoPtr pInfo)
state->btn = Xcalloc (sizeof (evdevBtnRec));
for (i = BTN_MISC; i < (KEY_OK - 1); i++)
if (TestBit (i, pEvdev->bits.key)) {
if (test_bit (i, pEvdev->bits.key)) {
bit = i;
if ((bit >= BTN_MOUSE) && (bit < BTN_JOYSTICK)) {
bit -= BTN_MOUSE - BTN_MISC;
@@ -200,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)
@@ -230,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;
@@ -238,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);
}

View File

@@ -81,11 +81,6 @@
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
#define BITS_PER_LONG (sizeof(long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define TestBit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
#define MIN_KEYCODE 8
#define GLYPHS_PER_KEY 2
@@ -356,13 +351,13 @@ EvdevKeyNew (InputInfoPtr pInfo)
int i, keys = 0;
for (i = 0; i <= KEY_UNKNOWN; i++)
if (TestBit (i, pEvdev->bits.key)) {
if (test_bit (i, pEvdev->bits.key)) {
keys = 1;
break;
}
if (!keys)
for (i = KEY_OK; i <= KEY_MAX; i++)
if (TestBit (i, pEvdev->bits.key)) {
if (test_bit (i, pEvdev->bits.key)) {
keys = 1;
break;
}

View File

@@ -39,6 +39,28 @@
# define __NR_inotify_init 290
# define __NR_inotify_add_watch 291
# define __NR_inotify_rm_watch 292
#elif defined (__hppa__) || defined (__hppa64__)
# define __NR_inotify_init 269
# define __NR_inotify_add_watch 270
# define __NR_inotify_rm_watch 271
#elif defined (__mips__)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define __NR_inotify_init 4284
# define __NR_inotify_add_watch 4285
# define __NR_inotify_rm_watch 4286
# elif _MIPS_SIM == _MIPS_SIM_NABI32
# define __NR_inotify_init 6247
# define __NR_inotify_add_watch 6248
# define __NR_inotify_rm_watch 6249
# elif _MIPS_SIM == _MIPS_SIM_ABI64
# define __NR_inotify_init 5243
# 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