Rebased ref, commits from common ancestor: commit 30c3645e20e945b0f8b7dc624748948464be606e Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Jan 11 12:46:40 2011 +1000
evdev 2.6.0 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 44d5976..887021c 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-evdev], - [2.5.99.903], + [2.6.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-evdev]) AC_CONFIG_SRCDIR([Makefile.am]) commit 3b52fe2ea4a934a8d87aacd185593beb01f8f273 Author: Chase Douglas <chase.doug...@canonical.com> Date: Wed Jan 5 10:09:55 2011 -0500 Print out error messages when failing to init devices Signed-off-by: Chase Douglas <chase.doug...@canonical.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index d47b6c2..45873c1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1320,8 +1320,11 @@ EvdevAddAbsClass(DeviceIntPtr device) #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 GetMotionHistory, #endif - GetMotionHistorySize(), Absolute)) + GetMotionHistorySize(), Absolute)) { + xf86Msg(X_ERROR, "%s: failed to initialize valuator class device.\n", + device->name); return !Success; + } for (axis = ABS_X; axis <= ABS_MAX; axis++) { int axnum = pEvdev->axis_map[axis]; @@ -1365,8 +1368,11 @@ EvdevAddAbsClass(DeviceIntPtr device) } } - if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) + if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) { + xf86Msg(X_ERROR, "%s: failed to initialize pointer feedback class " + "device.\n", device->name); return !Success; + } if (pEvdev->flags & EVDEV_TOUCHPAD) pEvdev->flags |= EVDEV_RELATIVE_MODE; @@ -1449,11 +1455,17 @@ EvdevAddRelClass(DeviceIntPtr device) #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 GetMotionHistory, #endif - GetMotionHistorySize(), Relative)) + GetMotionHistorySize(), Relative)) { + xf86Msg(X_ERROR, "%s: failed to initialize valuator class device.\n", + device->name); return !Success; + } - if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) + if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) { + xf86Msg(X_ERROR, "%s: failed to initialize pointer feedback class " + "device.\n", device->name); return !Success; + } for (axis = REL_X; axis <= REL_MAX; axis++) { commit 540a4cce9071fce183c941ded35e7e8fb8f3507e Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Jan 5 09:04:56 2011 +1000 evdev 2.5.99.903 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 7b75618..44d5976 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-evdev], - [2.5.99.902], + [2.5.99.903], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-evdev]) AC_CONFIG_SRCDIR([Makefile.am]) commit bed25600f66db245b895a48d6edca30568ca7559 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Dec 23 12:13:16 2010 +1000 Don't update first_val and num_val if we don't have data (#32480) For touchpads, rel_queued may be on (due to abs to rel conversion) but the delta for x/y is 0/0 on the first touch. Hence, we don't have any valuators to post. The current results in a num_vals of -15 and a subsequent segfault when the data is posted to the server. Start with a last valuator of -1, so that we know if we have at least one to post. X.Org Bug 32480 <http://bugs.freedesktop.org/show_bug.cgi?id=32480> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Chase Douglas <chase.doug...@canonical.com> diff --git a/src/evdev.c b/src/evdev.c index 50847a8..d47b6c2 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -402,7 +402,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, } if (pEvdev->rel_queued) { - int first = REL_CNT, last = 0; + int first = REL_CNT, last = -1; int i; if (pEvdev->swap_axes) { @@ -428,8 +428,11 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, } } - *num_v = (last - first + 1); - *first_v = first; + if (last >= 0) + { + *num_v = (last - first + 1); + *first_v = first; + } } /* * Some devices only generate valid abs coords when BTN_TOOL_PEN is commit 9aea1c5fa09c25ad83bcf2fd4ee4bd853d889e5e Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 21 10:53:06 2010 +1000 Add use_proximity bit for BTN_TOOL handling. Touchpads send garbage data between BTN_TOOL_FINGER and BTN_TOUCH. This leads to cursor movement towards invalid positions (bottom left corner, usually). Add a new flag "use_proximity" as a delimiter for BTN_TOUCH handling. If unset, the actual proximity bits are ignored, no proximity events are sent and BTN_TOUCH is used for the tool handling. Example event stream for synaptics: Event: time 1292893041.002731, -------------- Report Sync ------------ Event: time 1292893041.015807, type 1 (Key), code 330 (Touch), value 0 Event: time 1292893041.015812, type 3 (Absolute), code 0 (X), value 4283 Event: time 1292893041.015813, type 3 (Absolute), code 1 (Y), value 4860 Event: time 1292893041.015815, type 3 (Absolute), code 24 (Pressure), value 23 Event: time 1292893041.015817, type 3 (Absolute), code 28 (Tool Width), value 5 Event: time 1292893041.027537, -------------- Report Sync ------------ Event: time 1292893041.038854, type 3 (Absolute), code 0 (X), value 1 Event: time 1292893041.038857, type 3 (Absolute), code 1 (Y), value 5855 Event: time 1292893041.038859, type 3 (Absolute), code 24 (Pressure), value 1 Event: time 1292893041.038861, type 3 (Absolute), code 28 (Tool Width), value 5 Event: time 1292893041.038864, -------------- Report Sync ------------ Event: time 1292893041.062432, type 3 (Absolute), code 24 (Pressure), value 0 Event: time 1292893041.062435, type 3 (Absolute), code 28 (Tool Width), value 0 Event: time 1292893041.062437, type 1 (Key), code 325 (ToolFinger), value 0 Event: time 1292893041.062438, -------------- Report Sync ------------ Reported-by: Dave Airlie <airl...@redhat.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Chris Bagwell <ch...@cnpbagwell.com> diff --git a/src/evdev.c b/src/evdev.c index b6591ce..50847a8 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -486,6 +486,9 @@ EvdevProcessProximityEvent(InputInfoPtr pInfo, struct input_event *ev) { EvdevPtr pEvdev = pInfo->private; + if (!pEvdev->use_proximity) + return; + pEvdev->prox_queued = 1; EvdevQueueProximityEvent(pInfo, ev->value); @@ -679,7 +682,10 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev) switch (ev->code) { case BTN_TOUCH: - pEvdev->in_proximity = value ? ev->code : 0; + /* For devices that have but don't use proximity, use + * BTN_TOUCH as the proximity notifier */ + if (!pEvdev->use_proximity) + pEvdev->in_proximity = value ? ev->code : 0; if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET))) break; /* Treat BTN_TOUCH from devices that only have BTN_TOUCH as @@ -1346,6 +1352,9 @@ EvdevAddAbsClass(DeviceIntPtr device) for (i = 0; i < ArrayLength(proximity_bits); i++) { + if (!pEvdev->use_proximity) + break; + if (TestBit(proximity_bits[i], pEvdev->key_bitmask)) { InitProximityClassDeviceStruct(device); @@ -2039,6 +2048,7 @@ EvdevProbe(InputInfoPtr pInfo) if (pEvdev->flags & EVDEV_TOUCHPAD) { xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name); pInfo->type_name = XI_TOUCHPAD; + pEvdev->use_proximity = 0; } else if (pEvdev->flags & EVDEV_TABLET) { xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name); pInfo->type_name = XI_TABLET; @@ -2205,6 +2215,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) * proximity will still report events. */ pEvdev->in_proximity = 1; + pEvdev->use_proximity = 1; /* Grabbing the event device stops in-kernel event forwarding. In other words, it disables rfkill and the "Macintosh mouse button emulation". diff --git a/src/evdev.h b/src/evdev.h index b04f961..f640fdd 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -126,6 +126,7 @@ typedef struct { int flags; int in_proximity; /* device in proximity */ + int use_proximity; /* using the proximity bit? */ int num_buttons; /* number of buttons */ BOOL swap_axes; BOOL invert_x; commit 0c987a929dd4c98d4a80d8b7f75286902eb572f2 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 21 10:45:11 2010 +1000 Revert "Don't count BTN_TOUCH as tool. (#29428)" Synaptics devices send garbage between BTN_TOUCH and BTN_TOOL_FINGER. By switching to use this as proximity data now, the pointer is reset to the garbage data position (usually around 1/5855). This reverts commit 899218e18120918138f6d7420465763422d5b3b7. Reported-by: Dave Airlie <airl...@redhat.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Chris Bagwell <ch...@cnpbagwell.com> diff --git a/src/evdev.c b/src/evdev.c index dbe167a..b6591ce 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -679,6 +679,7 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev) switch (ev->code) { case BTN_TOUCH: + pEvdev->in_proximity = value ? ev->code : 0; if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET))) break; /* Treat BTN_TOUCH from devices that only have BTN_TOUCH as commit 242a01eb0f2f9b56fb6d6f0b41fc6a899cadb857 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 21 10:40:45 2010 +1000 Rename proximity to in_proximity. No functional change, just making it a bit more obvious to read. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Dan Nicholson <dbn.li...@gmail.com> Reviewed-by: Chris Bagwell <ch...@cnpbagwell.com> diff --git a/src/evdev.c b/src/evdev.c index a1855bc..dbe167a 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -385,7 +385,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, /* convert to relative motion for touchpads */ if (pEvdev->abs_queued && (pEvdev->flags & EVDEV_RELATIVE_MODE)) { - if (pEvdev->proximity) { + if (pEvdev->in_proximity) { if (pEvdev->old_vals[0] != -1) pEvdev->delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0]; if (pEvdev->old_vals[1] != -1) @@ -436,11 +436,11 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, * pressed. On wacom tablets, this means that the pen is in * proximity of the tablet. After the pen is removed, BTN_TOOL_PEN is * released, and a (0, 0) absolute event is generated. Checking - * pEvdev->proximity here lets us ignore that event. pEvdev is + * pEvdev->in_proximity here lets us ignore that event. pEvdev is * initialized to 1 so devices that don't use this scheme still * just works. */ - else if (pEvdev->abs_queued && pEvdev->proximity) { + else if (pEvdev->abs_queued && pEvdev->in_proximity) { memcpy(v, pEvdev->vals, sizeof(int) * pEvdev->num_vals); if (pEvdev->swap_axes) { @@ -515,7 +515,7 @@ EvdevProcessProximityState(InputInfoPtr pInfo) /* no proximity change in the queue */ if (!pEvdev->prox_queued) { - if (pEvdev->abs_queued && !pEvdev->proximity) + if (pEvdev->abs_queued && !pEvdev->in_proximity) pEvdev->abs_prox = pEvdev->abs_queued; return 0; } @@ -529,8 +529,8 @@ EvdevProcessProximityState(InputInfoPtr pInfo) } } - if ((prox_state && !pEvdev->proximity) || - (!prox_state && pEvdev->proximity)) + if ((prox_state && !pEvdev->in_proximity) || + (!prox_state && pEvdev->in_proximity)) { /* We're about to go into/out of proximity but have no abs events * within the EV_SYN. Use the last coordinates we have. */ @@ -541,7 +541,7 @@ EvdevProcessProximityState(InputInfoPtr pInfo) } } - pEvdev->proximity = prox_state; + pEvdev->in_proximity = prox_state; return 1; } @@ -720,11 +720,11 @@ EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, * pressed. On wacom tablets, this means that the pen is in * proximity of the tablet. After the pen is removed, BTN_TOOL_PEN is * released, and a (0, 0) absolute event is generated. Checking - * pEvdev->proximity here lets us ignore that event. pEvdev->proximity is - * initialized to 1 so devices that don't use this scheme still - * just work. + * pEvdev->in_proximity here lets us ignore that event. + * pEvdev->in_proximity is initialized to 1 so devices that don't use + * this scheme still just work. */ - if (pEvdev->abs_queued && pEvdev->proximity) { + if (pEvdev->abs_queued && pEvdev->in_proximity) { xf86PostMotionEventP(pInfo->dev, TRUE, first_v, num_v, v + first_v); } } @@ -767,7 +767,7 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int num_v, int first_v, break; case EV_QUEUE_BTN: #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11 - if (pEvdev->abs_queued && pEvdev->proximity) { + if (pEvdev->abs_queued && pEvdev->in_proximity) { xf86PostButtonEventP(pInfo->dev, 1, pEvdev->queue[i].key, pEvdev->queue[i].val, first_v, num_v, v + first_v); @@ -2200,10 +2200,10 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) goto error; /* - * We initialize pEvdev->proximity to 1 so that device that doesn't use + * We initialize pEvdev->in_proximity to 1 so that device that doesn't use * proximity will still report events. */ - pEvdev->proximity = 1; + pEvdev->in_proximity = 1; /* Grabbing the event device stops in-kernel event forwarding. In other words, it disables rfkill and the "Macintosh mouse button emulation". diff --git a/src/evdev.h b/src/evdev.h index 7c17ca4..b04f961 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -125,7 +125,7 @@ typedef struct { int old_vals[MAX_VALUATORS]; /* Translate absolute inputs to relative */ int flags; - int proximity; + int in_proximity; /* device in proximity */ int num_buttons; /* number of buttons */ BOOL swap_axes; BOOL invert_x; commit 7415953b9afac3221d1bb834aadcc7c1917366fd Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 21 10:44:14 2010 +1000 Fix grammar typo in comment. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index f3afd31..a1855bc 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -437,7 +437,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, * proximity of the tablet. After the pen is removed, BTN_TOOL_PEN is * released, and a (0, 0) absolute event is generated. Checking * pEvdev->proximity here lets us ignore that event. pEvdev is - * initialized to 1 so devices that doesn't use this scheme still + * initialized to 1 so devices that don't use this scheme still * just works. */ else if (pEvdev->abs_queued && pEvdev->proximity) { commit 1ced7ec7e23c57c0e1aaddeb3c113e67a5cb7341 Author: Peter Korsgaard <jac...@sunsite.dk> Date: Fri Dec 10 16:16:59 2010 +0100 evdev: rename EvdevCacheCompare() to EvdevCache() Since 59056e656c64 (Remove the reopen timer logic) from last year, EvdevCacheCompare() is only used for caching ioctl values and not for comparing, so remove the unused compare logic and rename the function to EvdevCache(). Signed-off-by: Peter Korsgaard <jac...@sunsite.dk> Reviewed-by: Benjamin Tissoires <benjamin.tissoi...@enac.fr> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 71882ce..f3afd31 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -107,7 +107,7 @@ static int proximity_bits[] = { }; static int EvdevOn(DeviceIntPtr); -static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare); +static int EvdevCache(InputInfoPtr pInfo); static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode); static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab); @@ -1744,14 +1744,11 @@ EvdevProc(DeviceIntPtr device, int what) /** * Get as much information as we can from the fd and cache it. - * If compare is True, then the information retrieved will be compared to the - * one already cached. If the information does not match, then this function - * returns an error. * * @return Success if the information was cached, or !Success otherwise. */ static int -EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) +EvdevCache(InputInfoPtr pInfo) { EvdevPtr pEvdev = pInfo->private; int i, len; @@ -1768,13 +1765,7 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) goto error; } - if (!compare) { - strcpy(pEvdev->name, name); - } else if (strcmp(pEvdev->name, name)) { - xf86Msg(X_ERROR, "%s: device name changed: %s != %s\n", - pInfo->name, pEvdev->name, name); - goto error; - } + strcpy(pEvdev->name, name); len = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask); if (len < 0) { @@ -1783,12 +1774,7 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) goto error; } - if (!compare) { - memcpy(pEvdev->bitmask, bitmask, len); - } else if (memcmp(pEvdev->bitmask, bitmask, len)) { - xf86Msg(X_ERROR, "%s: device bitmask has changed\n", pInfo->name); - goto error; - } + memcpy(pEvdev->bitmask, bitmask, len); len = ioctl(pInfo->fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask); if (len < 0) { @@ -1797,12 +1783,7 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) goto error; } - if (!compare) { - memcpy(pEvdev->rel_bitmask, rel_bitmask, len); - } else if (memcmp(pEvdev->rel_bitmask, rel_bitmask, len)) { - xf86Msg(X_ERROR, "%s: device rel_bitmask has changed\n", pInfo->name); - goto error; - } + memcpy(pEvdev->rel_bitmask, rel_bitmask, len); len = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask); if (len < 0) { @@ -1811,12 +1792,7 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) goto error; } - if (!compare) { - memcpy(pEvdev->abs_bitmask, abs_bitmask, len); - } else if (memcmp(pEvdev->abs_bitmask, abs_bitmask, len)) { - xf86Msg(X_ERROR, "%s: device abs_bitmask has changed\n", pInfo->name); - goto error; - } + memcpy(pEvdev->abs_bitmask, abs_bitmask, len); len = ioctl(pInfo->fd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask); if (len < 0) { @@ -1825,12 +1801,7 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) goto error; } - if (!compare) { - memcpy(pEvdev->led_bitmask, led_bitmask, len); - } else if (memcmp(pEvdev->led_bitmask, led_bitmask, len)) { - xf86Msg(X_ERROR, "%s: device led_bitmask has changed\n", pInfo->name); - goto error; - } + memcpy(pEvdev->led_bitmask, led_bitmask, len); /* * Do not try to validate absinfo data since it is not expected @@ -1854,27 +1825,6 @@ EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare) goto error; } - if (compare) { - /* - * Keys are special as user can adjust keymap at any time (on - * devices that support EVIOCSKEYCODE. However we do not expect - * buttons reserved for mice/tablets/digitizers and so on to - * appear/disappear so we will check only those in - * [BTN_MISC, KEY_OK) range. - */ - size_t start_word = BTN_MISC / LONG_BITS; - size_t start_byte = start_word * sizeof(unsigned long); - size_t end_word = KEY_OK / LONG_BITS; - size_t end_byte = end_word * sizeof(unsigned long); - - if (len >= start_byte && - memcmp(&pEvdev->key_bitmask[start_word], &key_bitmask[start_word], - min(len, end_byte) - start_byte + 1)) { - xf86Msg(X_ERROR, "%s: device key_bitmask has changed\n", pInfo->name); - goto error; - } - } - /* Copy the data so we have reasonably up-to-date info */ memcpy(pEvdev->key_bitmask, key_bitmask, len); @@ -2273,8 +2223,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) EvdevInitButtonMapping(pInfo); - if (EvdevCacheCompare(pInfo, FALSE) || - EvdevProbe(pInfo)) { + if (EvdevCache(pInfo) || EvdevProbe(pInfo)) { rc = BadMatch; goto error; } commit 1c5ad6f8a0f098da89aa88102f424c667addf376 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Dec 8 12:40:49 2010 +1000 evdev 2.5.99.902 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index a0ff404..7b75618 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-evdev], - [2.5.99.901], + [2.5.99.902], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-evdev]) AC_CONFIG_SRCDIR([Makefile.am]) commit 6fd1d0860e71c644fa72b4b40872e0ced671726c Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Dec 6 11:41:11 2010 +1000 Return error codes from EvdevOpenDevice() The server's behaviour is to stop adding new devices when a BadAlloc occurs on any device (on the assumption that new devices won't magically have more memory). Change EvdevOpenDevice() to return an error code of BadValue when it fails (and thus to the server) to prevent other devices being ignored because of one misconfigured one. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Daniel Stone <dan...@fooishbar.org> diff --git a/src/evdev.c b/src/evdev.c index 040cfdc..71882ce 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -112,7 +112,7 @@ static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode); static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab); static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]); -static BOOL EvdevOpenDevice(InputInfoPtr pInfo); +static int EvdevOpenDevice(InputInfoPtr pInfo); #ifdef HAVE_PROPERTIES static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms); @@ -1675,12 +1675,14 @@ EvdevOn(DeviceIntPtr device) { InputInfoPtr pInfo; EvdevPtr pEvdev; + int rc = Success; pInfo = device->public.devicePrivate; pEvdev = pInfo->private; /* after PreInit fd is still open */ - if (!EvdevOpenDevice(pInfo)) - return !Success; + rc = EvdevOpenDevice(pInfo); + if (rc != Success) + return rc; EvdevGrabDevice(pInfo, 1, 0); @@ -2141,7 +2143,7 @@ EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]) } } -static BOOL +static int EvdevOpenDevice(InputInfoPtr pInfo) { EvdevPtr pEvdev = pInfo->private; @@ -2152,7 +2154,7 @@ EvdevOpenDevice(InputInfoPtr pInfo) device = xf86CheckStrOption(pInfo->options, "Device", NULL); if (!device) { xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name); - return FALSE; + return BadValue; } pEvdev->device = device; @@ -2167,7 +2169,7 @@ EvdevOpenDevice(InputInfoPtr pInfo) if (pInfo->fd < 0) { xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device); - return FALSE; + return BadValue; } } @@ -2178,10 +2180,10 @@ EvdevOpenDevice(InputInfoPtr pInfo) xf86Msg(X_WARNING, "%s: device file is duplicate. Ignoring.\n", pInfo->name); close(pInfo->fd); - return FALSE; + return BadMatch; } - return TRUE; + return Success; } #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 @@ -2243,7 +2245,8 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) pInfo->read_input = EvdevReadInput; pInfo->switch_mode = EvdevSwitchMode; - if (!EvdevOpenDevice(pInfo)) + rc = EvdevOpenDevice(pInfo); + if (rc != Success) goto error; /* commit 31ba99e9edd28ff81437e0167c5322b9f619c52a Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Nov 19 14:27:09 2010 +1000 evdev 2.5.99.901 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 07cd64e..a0ff404 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-evdev], - [2.5.99], + [2.5.99.901], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-evdev]) AC_CONFIG_SRCDIR([Makefile.am]) commit a4aefca2ed52e675e6151a0fb0742a9e19565a41 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Oct 25 11:05:18 2010 +1000 Reshuffle to avoid the need for XI86_CONFIGURED. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Benjamin Tissoires <tisso...@cena.fr> diff --git a/src/evdev.c b/src/evdev.c index 018843f..040cfdc 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -63,7 +63,6 @@ #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 /* removed from server, purge when dropping support for server 1.10 */ -#define XI86_CONFIGURED 0x02 #define XI86_SEND_DRAG_EVENTS 0x08 #endif @@ -1916,6 +1915,7 @@ EvdevProbe(InputInfoPtr pInfo) int has_lmr; /* left middle right */ int ignore_abs = 0, ignore_rel = 0; EvdevPtr pEvdev = pInfo->private; + int rc = 1; /* Trinary state for ignoring axes: - unset: do the normal thing. @@ -2082,7 +2082,7 @@ EvdevProbe(InputInfoPtr pInfo) } if (has_rel_axes || has_abs_axes || num_buttons) { - pInfo->flags |= XI86_SEND_DRAG_EVENTS | XI86_CONFIGURED; + pInfo->flags |= XI86_SEND_DRAG_EVENTS; if (pEvdev->flags & EVDEV_TOUCHPAD) { xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name); pInfo->type_name = XI_TOUCHPAD; @@ -2096,29 +2096,29 @@ EvdevProbe(InputInfoPtr pInfo) xf86Msg(X_INFO, "%s: Configuring as mouse\n", pInfo->name); pInfo->type_name = XI_MOUSE; } + + rc = 0; } if (has_keys) { xf86Msg(X_INFO, "%s: Configuring as keyboard\n", pInfo->name); - pInfo->flags |= XI86_CONFIGURED; pInfo->type_name = XI_KEYBOARD; + rc = 0; } - if (has_scroll && (pInfo->flags & XI86_CONFIGURED) && - (has_rel_axes || has_abs_axes)) + if (has_scroll && + (has_rel_axes || has_abs_axes || num_buttons || has_keys)) { xf86Msg(X_INFO, "%s: Adding scrollwheel support\n", pInfo->name); pEvdev->flags |= EVDEV_BUTTON_EVENTS; pEvdev->flags |= EVDEV_RELATIVE_EVENTS; } - if ((pInfo->flags & XI86_CONFIGURED) == 0) { + if (rc) xf86Msg(X_WARNING, "%s: Don't know how to use device\n", pInfo->name); - return 1; - } - return 0; + return rc; } static void @@ -2214,7 +2214,11 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86ProcessCommonOptions(pInfo, pInfo->options); if (NewEvdevPreInit(drv, pInfo, flags) == Success) + { + pInfo->flags |= XI86_CONFIGURED; return pInfo; + } + xf86DeleteInput(pInfo, 0); return NULL; commit 20d7a0a4aab64232712186811ae55c40d2b7d161 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Oct 25 10:38:21 2010 +1000 Input API 12 requires a valuator mode for each axis. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Benjamin Tissoires <tisso...@cena.fr> diff --git a/src/evdev.c b/src/evdev.c index 32253a2..018843f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1333,7 +1333,11 @@ EvdevAddAbsClass(DeviceIntPtr device) #endif pEvdev->absinfo[axis].minimum, pEvdev->absinfo[axis].maximum, - resolution, 0, resolution); + resolution, 0, resolution +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 + , Absolute +#endif + ); xf86InitValuatorDefaults(device, axnum); pEvdev->old_vals[axnum] = -1; } @@ -1449,7 +1453,11 @@ EvdevAddRelClass(DeviceIntPtr device) #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 atoms[axnum], #endif - -1, -1, 1, 0, 1); + -1, -1, 1, 0, 1 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 + , Relative +#endif + ); xf86InitValuatorDefaults(device, axnum); } commit 5e26ba8641809addc63e783e1cefac0f8524b020 Author: Nikolai Kondrashov <spbn...@gmail.com> Date: Wed Oct 20 23:31:30 2010 +0400 Extend button mapping to full ranges Extend button code to number mapping to cover full BTN_MOUSE and BTN_MISC ranges, including undefined codes. This extends mapping introduced with 0367e387 to the following: 1 BTN_LEFT BTN_0 BTN_TOUCH 2 BTN_MIDDLE BTN_1 BTN_STYLUS 3 BTN_RIGHT BTN_2 BTN_STYLUS2 8 BTN_SIDE BTN_3 9 BTN_EXTRA BTN_4 10 BTN_FORWARD BTN_5 11 BTN_BACK BTN_6 12 BTN_TASK BTN_7 13 0x118 BTN_8 14 0x119 BTN_9 15 0x11A 0x10A 16 0x11B 0x10B 17 0x11C 0x10C 18 0x11D 0x10D 19 0x11E 0x10E 20 0x11F 0x10F This should fix https://bugs.freedesktop.org/show_bug.cgi?id=30336 Signed-off-by: Nikolai Kondrashov <spbn...@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 3c5fa89..32253a2 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2345,13 +2345,13 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code) return 2; case BTN_RIGHT: return 3; - case BTN_SIDE ... BTN_TASK: + case BTN_SIDE ... BTN_JOYSTICK - 1: return 8 + code - BTN_SIDE; /* Generic buttons */ case BTN_0 ... BTN_2: return 1 + code - BTN_0; - case BTN_3 ... BTN_9: + case BTN_3 ... BTN_MOUSE - 1: return 8 + code - BTN_3; /* Tablet stylus buttons */ commit 71dd18f72889ef6998a1bd699630da583dcb775a Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Oct 19 10:22:55 2010 +1000 Rename CountBits to EvdevCountBits. Avoid name collision with the server. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Benjamin Tissoires <tisso...@cena.fr> Reviewed-by: Chase Douglas <chase.doug...@canonical.com> diff --git a/src/evdev.c b/src/evdev.c index 626bb43..3c5fa89 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -165,7 +165,7 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode) return Success; } -static size_t CountBits(unsigned long *array, size_t nlongs) +static size_t EvdevCountBits(unsigned long *array, size_t nlongs) { unsigned int i; size_t count = 0; @@ -1280,7 +1280,7 @@ EvdevAddAbsClass(DeviceIntPtr device) if (!TestBit(EV_ABS, pEvdev->bitmask)) return !Success; - num_axes = CountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX)); + num_axes = EvdevCountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX)); if (num_axes < 1) return !Success; @@ -1387,7 +1387,7 @@ EvdevAddRelClass(DeviceIntPtr device) if (!TestBit(EV_REL, pEvdev->bitmask)) return !Success; - num_axes = CountBits(pEvdev->rel_bitmask, NLONGS(REL_MAX)); + num_axes = EvdevCountBits(pEvdev->rel_bitmask, NLONGS(REL_MAX)); if (num_axes < 1) return !Success; commit c3e49f2b95d3e40f97d6bffdaf8a6c036093fa91 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Oct 20 10:33:39 2010 +1000 Use an array for the proximity bits. Instead of two lists that need to be kept in sync, just store the bits in an array and run through them. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Benjamin Tissoires <tisso...@cena.fr> Reviewed-by: Daniel Stone <dan...@fooishbar.org> diff --git a/src/evdev.c b/src/evdev.c index 0cf01ab..626bb43 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -95,6 +95,18 @@ static char *evdevDefaults[] = { NULL }; +/* Any of those triggers a proximity event */ +static int proximity_bits[] = { + BTN_TOOL_PEN, + BTN_TOOL_RUBBER, + BTN_TOOL_BRUSH, + BTN_TOOL_PENCIL, + BTN_TOOL_AIRBRUSH, + BTN_TOOL_FINGER, + BTN_TOOL_MOUSE, + BTN_TOOL_LENS, +}; + static int EvdevOn(DeviceIntPtr); static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare); static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); @@ -646,7 +658,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev) static void EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev) { - int value; + int value, i; EvdevPtr pEvdev = pInfo->private; /* Get the signed value, earlier kernels had this as unsigned */ @@ -657,19 +669,16 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev) if (value == 2) return; - switch (ev->code) { - /* keep this list in sync with InitProximityClassDeviceStruct */ - case BTN_TOOL_PEN: - case BTN_TOOL_RUBBER: - case BTN_TOOL_BRUSH: -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1rh34b-0004cv...@vasks.debian.org