Compare commits

...

12 Commits

Author SHA1 Message Date
Peter Hutterer
cf887a2b7c evdev 2.2.2 2009-04-30 16:39:15 +10:00
Peter Hutterer
1cc0651e1b Print read errors as X_NONE to avoid mallocs in the server.
Messages of type X_NONE are just passed down to the log files, everything else
gets the (EE) or (II) prefixed. Since this mallocs, we can't use it in the
signal handler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 220e2dfb8f)
2009-04-30 16:38:43 +10:00
Peter Hutterer
48a747ea86 Pre-allocate the reopen timer so we don't allocate during sigio handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ddc1266374)
2009-04-30 16:38:41 +10:00
Peter Hutterer
aa58eb6096 Trigger read error handling if len is <= 0.
Red Hat Bug 494245 <https://bugzilla.redhat.com/show_bug.cgi?id=494245>

Reported-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 98ecb5233b)
2009-04-06 10:44:55 +10:00
Peter Hutterer
aff7228d97 evdev 2.2.1 2009-03-24 15:13:23 +10:00
Peter Hutterer
c695234c5c Fix jumpy touchpads by updating old_vals only when reported by the device.
Remember whether ABS_X or ABS_Y were reported before the SYN event and only
update the old_vals[0, 1] if we got data for them.
Touchpads that reported pressure data before x/y would otherwise update
old_x/y with bogus values, leading to jumps when the first x/y coordinates
were actually reported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d9809d7edd)
2009-03-23 16:36:15 +10:00
Peter Hutterer
79d4956add If we have a touchpad, print so, don't claim we're configuring a tablet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b11439a176)
2009-03-23 16:36:13 +10:00
Jeremy Jay
7e9809837c make sure to clear all axis_map entries
don't use uninitialized axis_map entries, ie axis_map[ABS_PRESSURE]

Signed-off-by: Jeremy Jay <dinkumator@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 740dc202f7)
2009-03-23 16:36:06 +10:00
Peter Hutterer
d07692a4af Assume touchscreen/touchpad if we have _either_ ABS_PRESSURE or BTN_TOUCH
Touchpads have pressure or touch and also BTN_TOOL_FINGER.
Touchscreens have either pressure or touch, but no finger.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7ac0c4456d)
2009-03-23 16:36:03 +10:00
Jeremy Jay
1073cd4fdc Set "rel" when converting absolute touchpad coordinates to relative (#20661)
We unset "abs" and convert to relative, but never set "rel" so the events
don't get posted. This bit got broken in 43dd2a9592.

X.Org Bug 20661 <http://bugs.freedesktop.org/show_bug.cgi?id=20661>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a3ea979c2b)
2009-03-23 16:35:50 +10:00
Peter Hutterer
486bbdc481 Restore repeat-filtering for server 1.5 and earlier.
Letting the server deal with key repeats is fine if we have server 1.6. For
earlier servers, we need to pass on the repeat events (except for modifier
keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Marty Jack <martyj19@comcast.net>
(cherry picked from commit a7fb654a68)
2009-03-23 16:35:46 +10:00
Peter Hutterer
73e5eba8cd evdev 2.2.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 10:02:23 +10:00
2 changed files with 60 additions and 19 deletions

View File

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

View File

@@ -263,8 +263,17 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
static char warned[KEY_CNT]; static char warned[KEY_CNT];
/* Filter all repeated events from device. /* Filter all repeated events from device.
We'll do softrepeat in the server */ We'll do softrepeat in the server, but only since 1.6 */
if (value == 2) if (value == 2
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) <= 2
&& (ev->code == KEY_LEFTCTRL || ev->code == KEY_RIGHTCTRL ||
ev->code == KEY_LEFTSHIFT || ev->code == KEY_RIGHTSHIFT ||
ev->code == KEY_LEFTALT || ev->code == KEY_RIGHTALT ||
ev->code == KEY_LEFTMETA || ev->code == KEY_RIGHTMETA ||
ev->code == KEY_CAPSLOCK || ev->code == KEY_NUMLOCK ||
ev->code == KEY_SCROLLLOCK) /* XXX windows keys? */
#endif
)
return; return;
if (code > 255) if (code > 255)
@@ -333,6 +342,9 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
return 100; /* come back in 100 ms */ return 100; /* come back in 100 ms */
} }
#define ABS_X_VALUE 0x1
#define ABS_Y_VALUE 0x2
#define ABS_VALUE 0x4
/** /**
* Take one input event and process it accordingly. * Take one input event and process it accordingly.
*/ */
@@ -383,7 +395,12 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
if (ev->code > ABS_MAX) if (ev->code > ABS_MAX)
break; break;
pEvdev->vals[pEvdev->axis_map[ev->code]] = value; pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
abs = 1; if (ev->code == ABS_X)
abs |= ABS_X_VALUE;
else if (ev->code == ABS_Y)
abs |= ABS_Y_VALUE;
else
abs |= ABS_VALUE;
break; break;
case EV_KEY: case EV_KEY:
@@ -434,17 +451,20 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
case EV_SYN: case EV_SYN:
/* convert to relative motion for touchpads */ /* convert to relative motion for touchpads */
if (abs && (pEvdev->flags & EVDEV_TOUCHPAD)) { if (abs && (pEvdev->flags & EVDEV_TOUCHPAD)) {
abs = 0;
if (pEvdev->tool) { /* meaning, touch is active */ if (pEvdev->tool) { /* meaning, touch is active */
if (pEvdev->old_vals[0] != -1) if (pEvdev->old_vals[0] != -1)
delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0]; delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
if (pEvdev->old_vals[1] != -1) if (pEvdev->old_vals[1] != -1)
delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1]; delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1];
pEvdev->old_vals[0] = pEvdev->vals[0]; if (abs & ABS_X_VALUE)
pEvdev->old_vals[1] = pEvdev->vals[1]; pEvdev->old_vals[0] = pEvdev->vals[0];
if (abs & ABS_Y_VALUE)
pEvdev->old_vals[1] = pEvdev->vals[1];
} else { } else {
pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1; pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1;
} }
abs = 0;
rel = 1;
} }
if (rel) { if (rel) {
@@ -527,6 +547,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
} }
} }
#undef ABS_X_VALUE
#undef ABS_Y_VALUE
#undef ABS_VALUE
/* just a magic number to reduce the number of reads */ /* just a magic number to reduce the number of reads */
#define NUM_EVENTS 16 #define NUM_EVENTS 16
@@ -540,25 +564,32 @@ EvdevReadInput(InputInfoPtr pInfo)
while (len == sizeof(ev)) while (len == sizeof(ev))
{ {
len = read(pInfo->fd, &ev, sizeof(ev)); len = read(pInfo->fd, &ev, sizeof(ev));
if (len == 0) if (len <= 0)
{ {
if (errno == ENODEV) /* May happen after resume */ if (errno == ENODEV) /* May happen after resume */
{ {
xf86RemoveEnabledDevice(pInfo); xf86RemoveEnabledDevice(pInfo);
close(pInfo->fd); close(pInfo->fd);
pInfo->fd = -1; pInfo->fd = -1;
pEvdev->reopen_left = pEvdev->reopen_attempts; if (pEvdev->reopen_timer)
pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo); {
pEvdev->reopen_left = pEvdev->reopen_attempts;
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
}
} else if (errno != EAGAIN) } else if (errno != EAGAIN)
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, {
/* We use X_NONE here because it doesn't alloc */
xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name,
strerror(errno)); strerror(errno));
}
break; break;
} }
/* The kernel promises that we always only read a complete
* event, so len != sizeof ev is an error. */
if (len % sizeof(ev[0])) { if (len % sizeof(ev[0])) {
/* The kernel promises that we always only read a complete /* We use X_NONE here because it doesn't alloc */
* event, so len != sizeof ev is an error. */ xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name, strerror(errno));
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, strerror(errno));
break; break;
} }
@@ -1126,12 +1157,17 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
static int static int
EvdevInit(DeviceIntPtr device) EvdevInit(DeviceIntPtr device)
{ {
int i;
InputInfoPtr pInfo; InputInfoPtr pInfo;
EvdevPtr pEvdev; EvdevPtr pEvdev;
pInfo = device->public.devicePrivate; pInfo = device->public.devicePrivate;
pEvdev = pInfo->private; pEvdev = pInfo->private;
/* clear all axis_map entries */
for(i = 0; i < max(ABS_CNT,REL_CNT); i++)
pEvdev->axis_map[i]=-1;
if (pEvdev->flags & EVDEV_KEYBOARD_EVENTS) if (pEvdev->flags & EVDEV_KEYBOARD_EVENTS)
EvdevAddKeyClass(device); EvdevAddKeyClass(device);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS) if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
@@ -1197,7 +1233,7 @@ EvdevOn(DeviceIntPtr device)
if (pInfo->fd == -1) if (pInfo->fd == -1)
{ {
pEvdev->reopen_left = pEvdev->reopen_attempts; pEvdev->reopen_left = pEvdev->reopen_attempts;
pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo); pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
} else } else
{ {
pEvdev->min_maj = EvdevGetMajorMinor(pInfo); pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
@@ -1208,6 +1244,8 @@ EvdevOn(DeviceIntPtr device)
return !Success; return !Success;
} }
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 0, NULL, NULL);
xf86FlushInput(pInfo->fd); xf86FlushInput(pInfo->fd);
xf86AddEnabledDevice(pInfo); xf86AddEnabledDevice(pInfo);
EvdevMBEmuOn(pInfo); EvdevMBEmuOn(pInfo);
@@ -1462,9 +1500,9 @@ EvdevProbe(InputInfoPtr pInfo)
TestBit(ABS_Y, pEvdev->abs_bitmask)) { TestBit(ABS_Y, pEvdev->abs_bitmask)) {
xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name); xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name);
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS; pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
if (!TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) && if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) { TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
if (num_buttons) { if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
xf86Msg(X_INFO, "%s: Found absolute touchpad\n", pInfo->name); xf86Msg(X_INFO, "%s: Found absolute touchpad\n", pInfo->name);
pEvdev->flags |= EVDEV_TOUCHPAD; pEvdev->flags |= EVDEV_TOUCHPAD;
memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals); memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);
@@ -1490,7 +1528,10 @@ EvdevProbe(InputInfoPtr pInfo)
if (has_axes && num_buttons) { if (has_axes && num_buttons) {
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS | pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
XI86_CONFIGURED; XI86_CONFIGURED;
if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) { if (pEvdev->flags & EVDEV_TOUCHPAD) {
xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name);
pInfo->type_name = XI_TOUCHPAD;
} else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) {
xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name); xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name);
pInfo->type_name = XI_TABLET; pInfo->type_name = XI_TABLET;
} else { } else {