Rebased ref, commits from common ancestor: commit 5138cd2ff47a1a28db82688b932cb1ecd618778f Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 26 16:01:39 2013 +1000
evdev 2.8.0 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index f0d0a78..41d1017 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-input-evdev], - [2.7.0], + [2.8.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-input-evdev]) AC_CONFIG_SRCDIR([Makefile.am]) commit c085c8b6c1f8e95f6f4d91bc65268fe57154018c Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Feb 12 12:58:08 2013 +1000 Return BadValue if EvdevOpenMTDev fails FALSE == Success, so if we fail during EvdevOpenMTDev, the caller thinks that everything worked fine, proceeds to set up the fd, etc. This may later cause a crash, when a device comes back later as different device and posts axis events where we didn't configure axes in the first place. Note: Unclear why there was no udev event received for the device being removed and coming back as different device though. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index ea2410b..052e9f0 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2511,7 +2511,7 @@ EvdevOpenDevice(InputInfoPtr pInfo) if (!EvdevOpenMTDev(pInfo)) { xf86Msg(X_ERROR, "%s: Couldn't open mtdev device\n", pInfo->name); EvdevCloseDevice(pInfo); - return FALSE; + return BadValue; } #endif commit 2b675f85aef6df3bb3fb5e68648982e11b752764 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Feb 12 12:48:38 2013 +1000 Make errors on EVIOCGBIT more obvious Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 731ebb3..ea2410b 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2000,7 +2000,7 @@ EvdevCache(InputInfoPtr pInfo) len = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for bitmask failed: %s\n", strerror(errno)); goto error; } @@ -2009,7 +2009,7 @@ EvdevCache(InputInfoPtr pInfo) len = ioctl(pInfo->fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for EV_REL failed: %s\n", strerror(errno)); goto error; } @@ -2018,7 +2018,7 @@ EvdevCache(InputInfoPtr pInfo) len = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for EV_ABS failed: %s\n", strerror(errno)); goto error; } @@ -2027,7 +2027,7 @@ EvdevCache(InputInfoPtr pInfo) len = ioctl(pInfo->fd, EVIOCGBIT(EV_LED, sizeof(led_bitmask)), led_bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for EV_LED failed: %s\n", strerror(errno)); goto error; } @@ -2053,7 +2053,7 @@ EvdevCache(InputInfoPtr pInfo) len = ioctl(pInfo->fd, EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for EV_KEY failed: %s\n", strerror(errno)); goto error; } @@ -2435,8 +2435,8 @@ EvdevOpenMTDev(InputInfoPtr pInfo) /* Use ioctl here, this may be called before EvdevCache */ len = ioctl(pInfo->fd, EVIOCGBIT(0, sizeof(bitmask)), bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", - strerror(errno)); + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for bitmask in %s failed: %s\n", + __func__, strerror(errno)); return FALSE; } @@ -2445,8 +2445,8 @@ EvdevOpenMTDev(InputInfoPtr pInfo) len = ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask); if (len < 0) { - xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed: %s\n", - strerror(errno)); + xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT for EV_ABS in %s failed: %s\n", + __func__, strerror(errno)); return FALSE; } commit 2b8b0df62ec554952784f2820fb4143c495232b0 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Jan 24 16:18:48 2013 +1000 Always init axis mapping for the first two rel axes (#59784) Fixes regression introduced in 2f67509b53b27dd7f51ca2aadd19605aee613a61. If evdev is used for touchpads, the abs axis movement is converted to a rel movement. Without the two relative axes initialized, the events are discarded. Axes 0 and 1 are always x/y anyway unless specifically configured otherwise. X.Org Bug 59784 <http://bugs.freedesktop.org/show_bug.cgi?id=59784> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 570dd06..731ebb3 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2576,6 +2576,9 @@ EvdevAlloc(void) for (i = 0; i < ArrayLength(pEvdev->abs_axis_map); i++) pEvdev->abs_axis_map[i] = -1; + pEvdev->rel_axis_map[0] = 0; + pEvdev->rel_axis_map[1] = 1; + return pEvdev; } @@ -2740,6 +2743,8 @@ static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *ato memset(atoms, 0, natoms * sizeof(Atom)); + /* rel[0] and [1] are always mapped, so we get the rel labels. if we + have abs x/y, the labels will be overwritten with the right one */ for (axis = 0; axis < ArrayLength(rel_labels); axis++) EvdevInitOneAxisLabel(pEvdev, pEvdev->rel_axis_map[axis], rel_labels, axis, atoms); commit f5fe533f1bef0c636b98658aaf40748c219c9879 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 27 12:18:46 2012 +1000 Allow relative scroll valuators on absolute devices (#54387) Special-case RHEL_WHEEL, RHEL_HWHEEL and REL_DIAL to add scroll valuators for those axes in addition to the absolute axes. X.Org Bug 54387 <http://bugs.freedesktop.org/show_bug.cgi?id=54387> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 9741821..c25bea4 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -692,7 +692,9 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev) #endif default: /* Ignore EV_REL events if we never set up for them. */ - if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS)) + if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS) && + ev->code != REL_WHEEL && ev->code != REL_DIAL && + ev->code != REL_HWHEEL) return; /* Handle mouse wheel emulation */ @@ -1215,7 +1217,7 @@ is_blacklisted_axis(int axis) static int -EvdevAddAbsValuatorClass(DeviceIntPtr device) +EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes) { InputInfoPtr pInfo; EvdevPtr pEvdev; @@ -1224,6 +1226,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) num_mt_axes_total = 0; /* total number of MT axes, including double-counted ones, excluding blacklisted */ Atom *atoms; + int mapping = 0; pInfo = device->public.devicePrivate; pEvdev = pInfo->private; @@ -1263,6 +1266,19 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) } } #endif + +#ifdef HAVE_SMOOTH_SCROLLING + if (want_scroll_axes && EvdevBitIsSet(pEvdev->bitmask, EV_REL)) + { + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL)) + num_axes++; + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_HWHEEL)) + num_axes++; + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_DIAL)) + num_axes++; + } +#endif + if (num_axes + num_mt_axes > MAX_VALUATORS) { xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS); num_axes = MAX_VALUATORS; @@ -1329,7 +1345,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) #ifdef MULTITOUCH int j; #endif - int mapping; pEvdev->abs_axis_map[axis] = -1; if (!EvdevBitIsSet(pEvdev->abs_bitmask, axis) || is_blacklisted_axis(axis)) @@ -1352,6 +1367,20 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) i++; } +#ifdef HAVE_SMOOTH_SCROLLING + if (want_scroll_axes) + { + mapping++; /* continue from abs axis mapping */ + + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_HWHEEL)) + pEvdev->rel_axis_map[REL_HWHEEL] = mapping++; + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_DIAL)) + pEvdev->rel_axis_map[REL_DIAL] = mapping++; + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL)) + pEvdev->rel_axis_map[REL_WHEEL] = mapping++; + } +#endif + EvdevInitAxesLabels(pEvdev, Absolute, pEvdev->num_vals + num_mt_axes, atoms); if (!InitValuatorClassDeviceStruct(device, num_axes + num_mt_axes, atoms, @@ -1446,6 +1475,51 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) } #endif +#ifdef HAVE_SMOOTH_SCROLLING + if (want_scroll_axes) + { + int idx; + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL)) + { + idx = REL_WHEEL; + xf86InitValuatorAxisStruct(device, + pEvdev->rel_axis_map[idx], + atoms[pEvdev->rel_axis_map[idx]], + NO_AXIS_LIMITS, NO_AXIS_LIMITS, + 0, 0, 0, Relative); + SetScrollValuator(device, pEvdev->rel_axis_map[idx], + SCROLL_TYPE_VERTICAL, -1.0, + SCROLL_FLAG_PREFERRED); + } + + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_HWHEEL)) + { + idx = REL_HWHEEL; + xf86InitValuatorAxisStruct(device, + pEvdev->rel_axis_map[idx], + atoms[pEvdev->rel_axis_map[idx]], + NO_AXIS_LIMITS, NO_AXIS_LIMITS, + 0, 0, 0, Relative); + SetScrollValuator(device, pEvdev->rel_axis_map[idx], + SCROLL_TYPE_HORIZONTAL, 1.0, + SCROLL_FLAG_NONE); + } + + if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_DIAL)) + { + idx = REL_DIAL; + xf86InitValuatorAxisStruct(device, + pEvdev->rel_axis_map[idx], + atoms[pEvdev->rel_axis_map[idx]], + NO_AXIS_LIMITS, NO_AXIS_LIMITS, + 0, 0, 0, Relative); + SetScrollValuator(device, pEvdev->rel_axis_map[idx], + SCROLL_TYPE_HORIZONTAL, 1.0, + SCROLL_FLAG_NONE); + } + } +#endif + free(atoms); for (i = 0; i < ArrayLength(proximity_bits); i++) @@ -1675,12 +1749,16 @@ static void EvdevInitAnyValuators(DeviceIntPtr device, EvdevPtr pEvdev) { InputInfoPtr pInfo = device->public.devicePrivate; + int rel_success = FALSE; if (pEvdev->flags & EVDEV_RELATIVE_EVENTS && EvdevAddRelValuatorClass(device) == Success) + { + rel_success = TRUE; xf86IDrvMsg(pInfo, X_INFO, "initialized for relative axes.\n"); + } if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS && - EvdevAddAbsValuatorClass(device) == Success) + EvdevAddAbsValuatorClass(device, !rel_success) == Success) xf86IDrvMsg(pInfo, X_INFO, "initialized for absolute axes.\n"); } @@ -1689,7 +1767,7 @@ EvdevInitAbsValuators(DeviceIntPtr device, EvdevPtr pEvdev) { InputInfoPtr pInfo = device->public.devicePrivate; - if (EvdevAddAbsValuatorClass(device) == Success) { + if (EvdevAddAbsValuatorClass(device, TRUE) == Success) { xf86IDrvMsg(pInfo, X_INFO,"initialized for absolute axes.\n"); } else { xf86IDrvMsg(pInfo, X_ERROR,"failed to initialize for absolute axes.\n"); commit 2f67509b53b27dd7f51ca2aadd19605aee613a61 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Jan 16 08:38:52 2013 +1000 Split rel and abs axis mapping into two separate arrays This will enable a device to have relative scrolling axes in addition to absolute axes (required by the QEMU tablet). Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/emuWheel.c b/src/emuWheel.c index db989c5..5774930 100644 --- a/src/emuWheel.c +++ b/src/emuWheel.c @@ -117,7 +117,7 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv) /* We don't want to intercept real mouse wheel events */ if(pEv->type == EV_ABS) { - int axis = pEvdev->axis_map[pEv->code]; + int axis = pEvdev->abs_axis_map[pEv->code]; oldValue = valuator_mask_get(pEvdev->vals, axis); valuator_mask_set(pEvdev->vals, axis, value); value -= oldValue; /* make value into a differential measurement */ diff --git a/src/evdev.c b/src/evdev.c index a9b1fd2..9741821 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -123,7 +123,7 @@ static int EvdevOpenDevice(InputInfoPtr pInfo); static void EvdevCloseDevice(InputInfoPtr pInfo); static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms); -static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int axis, +static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int mapped_axis, const char **labels, int label_idx, Atom *atoms); static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms); static void EvdevInitProperty(DeviceIntPtr dev); @@ -479,7 +479,7 @@ EvdevProcessValuators(InputInfoPtr pInfo) for (i = 0; i < REL_CNT; i++) { - int map = pEvdev->axis_map[i]; + int map = pEvdev->rel_axis_map[i]; if (pEvdev->delta[i] && map != -1) valuator_mask_set(pEvdev->vals, map, pEvdev->delta[i]); } @@ -701,7 +701,7 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev) pEvdev->rel_queued = 1; pEvdev->delta[ev->code] += value; - map = pEvdev->axis_map[ev->code]; + map = pEvdev->rel_axis_map[ev->code]; valuator_mask_set(pEvdev->vals, map, value); break; } @@ -787,7 +787,7 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev) } else pEvdev->slot_state = SLOTSTATE_CLOSE; } else { - map = pEvdev->axis_map[ev->code]; + map = pEvdev->abs_axis_map[ev->code]; valuator_mask_set(pEvdev->mt_mask, map, ev->value); if (slot_index >= 0) valuator_mask_set(pEvdev->last_mt_vals[slot_index], map, @@ -827,7 +827,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev) EvdevProcessTouchEvent(pInfo, ev); pEvdev->abs_queued = 1; } else if (!pEvdev->mt_mask) { - map = pEvdev->axis_map[ev->code]; + map = pEvdev->abs_axis_map[ev->code]; valuator_mask_set(pEvdev->vals, map, value); pEvdev->abs_queued = 1; } @@ -1330,7 +1330,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) int j; #endif int mapping; - pEvdev->axis_map[axis] = -1; + pEvdev->abs_axis_map[axis] = -1; if (!EvdevBitIsSet(pEvdev->abs_bitmask, axis) || is_blacklisted_axis(axis)) continue; @@ -1347,7 +1347,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) mapping = mt_axis_mappings[j].mapping; } #endif - pEvdev->axis_map[axis] = mapping; + pEvdev->abs_axis_map[axis] = mapping; if (mapping == i) i++; } @@ -1380,11 +1380,11 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) for (i = 0; i < num_slots(pEvdev); i++) { for (axis = ABS_MT_TOUCH_MAJOR; axis < ABS_MAX; axis++) { - if (pEvdev->axis_map[axis] >= 0) { + if (pEvdev->abs_axis_map[axis] >= 0) { /* XXX: read initial values from mtdev when it adds support * for doing so. */ valuator_mask_set(pEvdev->last_mt_vals[i], - pEvdev->axis_map[axis], 0); + pEvdev->abs_axis_map[axis], 0); } } } @@ -1392,7 +1392,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) #endif for (axis = ABS_X; axis < ABS_MT_SLOT; axis++) { - int axnum = pEvdev->axis_map[axis]; + int axnum = pEvdev->abs_axis_map[axis]; int resolution = 0; if (axnum == -1) @@ -1414,7 +1414,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) #ifdef MULTITOUCH for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) { - int axnum = pEvdev->axis_map[axis]; + int axnum = pEvdev->abs_axis_map[axis]; int resolution = 0; int j; BOOL skip = FALSE; @@ -1544,7 +1544,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device) for (axis = REL_X; i < MAX_VALUATORS && axis <= REL_MAX; axis++) { - pEvdev->axis_map[axis] = -1; + pEvdev->rel_axis_map[axis] = -1; #ifndef HAVE_SMOOTH_SCROLLING /* We don't post wheel events, so ignore them here too */ if (axis == REL_WHEEL || axis == REL_HWHEEL || axis == REL_DIAL) @@ -1552,7 +1552,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device) #endif if (!EvdevBitIsSet(pEvdev->rel_bitmask, axis)) continue; - pEvdev->axis_map[axis] = i; + pEvdev->rel_axis_map[axis] = i; i++; } @@ -1572,7 +1572,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device) for (axis = REL_X; axis <= REL_MAX; axis++) { - int axnum = pEvdev->axis_map[axis]; + int axnum = pEvdev->rel_axis_map[axis]; if (axnum == -1) continue; @@ -1739,17 +1739,12 @@ EvdevInitTouchDevice(DeviceIntPtr device, EvdevPtr pEvdev) static int EvdevInit(DeviceIntPtr device) { - int i; InputInfoPtr pInfo; EvdevPtr pEvdev; pInfo = device->public.devicePrivate; 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) EvdevAddKeyClass(device); if (pEvdev->flags & EVDEV_BUTTON_EVENTS) @@ -2480,8 +2475,10 @@ EvdevAlloc(void) pEvdev->cur_slot = -1; #endif - for (i = 0; i < ArrayLength(pEvdev->axis_map); i++) - pEvdev->axis_map[i] = -1; + for (i = 0; i < ArrayLength(pEvdev->rel_axis_map); i++) + pEvdev->rel_axis_map[i] = -1; + for (i = 0; i < ArrayLength(pEvdev->abs_axis_map); i++) + pEvdev->abs_axis_map[i] = -1; return pEvdev; } @@ -2626,43 +2623,32 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code) } } -static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int axis, +static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int mapped_axis, const char **labels, int label_idx, Atom *atoms) { Atom atom; - if (pEvdev->axis_map[axis] == -1) + if (mapped_axis == -1) return; atom = XIGetKnownProperty(labels[label_idx]); if (!atom) /* Should not happen */ return; - atoms[pEvdev->axis_map[axis]] = atom; + atoms[mapped_axis] = atom; } static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms) { int axis; - const char **labels; - int labels_len = 0; - - if (mode == Absolute) - { - labels = abs_labels; - labels_len = ArrayLength(abs_labels); - } else if (mode == Relative) - { - labels = rel_labels; - labels_len = ArrayLength(rel_labels); - } else - return; memset(atoms, 0, natoms * sizeof(Atom)); - /* Now fill the ones we know */ - for (axis = 0; axis < labels_len; axis++) - EvdevInitOneAxisLabel(pEvdev, axis, labels, axis, atoms); + for (axis = 0; axis < ArrayLength(rel_labels); axis++) + EvdevInitOneAxisLabel(pEvdev, pEvdev->rel_axis_map[axis], rel_labels, axis, atoms); + + for (axis = 0; axis < ArrayLength(abs_labels); axis++) + EvdevInitOneAxisLabel(pEvdev, pEvdev->abs_axis_map[axis], abs_labels, axis, atoms); } static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms) diff --git a/src/evdev.h b/src/evdev.h index 51b7fa0..63c3bfa 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -158,7 +158,8 @@ typedef struct { int num_vals; /* number of valuators */ int num_mt_vals; /* number of multitouch valuators */ - int axis_map[max(ABS_CNT, REL_CNT)]; /* Map evdev <axis> to index */ + int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */ + int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */ ValuatorMask *vals; /* new values coming in */ ValuatorMask *old_vals; /* old values for calculating relative motion */ ValuatorMask *prox; /* last values set while not in proximity */ commit ffc0a34642d5ab573c2ae63c873a5befd8688493 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Jan 15 16:15:47 2013 +1000 Move some stuff into the new alloc function Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index baa7ac1..a9b1fd2 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2464,7 +2464,25 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) static EvdevPtr EvdevAlloc(void) { + int i; EvdevPtr pEvdev = calloc(sizeof(EvdevRec), 1); + + if (!pEvdev) + return NULL; + /* + * We initialize pEvdev->in_proximity to 1 so that device that doesn't use + * proximity will still report events. + */ + pEvdev->in_proximity = 1; + pEvdev->use_proximity = 1; + +#ifdef MULTITOUCH + pEvdev->cur_slot = -1; +#endif + + for (i = 0; i < ArrayLength(pEvdev->axis_map); i++) + pEvdev->axis_map[i] = -1; + return pEvdev; } @@ -2487,17 +2505,6 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) if (rc != Success) goto error; -#ifdef MULTITOUCH - pEvdev->cur_slot = -1; -#endif - - /* - * We initialize pEvdev->in_proximity to 1 so that device that doesn't use - * 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". Note that this needs a server that sets the console to RAW mode. */ commit 93de7b0b73d4c5f6f68e3a2ffe8f76b5212ee016 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Jan 15 16:11:16 2013 +1000 Move allocation of EvdevRec into a helper function Makes it easier to initialise everything to the right values. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 5667dc1..baa7ac1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2461,13 +2461,20 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xf86DeleteInput(pInfo, flags); } +static EvdevPtr +EvdevAlloc(void) +{ + EvdevPtr pEvdev = calloc(sizeof(EvdevRec), 1); + return pEvdev; +} + static int EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) { EvdevPtr pEvdev; int rc = BadAlloc; - if (!(pEvdev = calloc(sizeof(EvdevRec), 1))) + if (!(pEvdev = EvdevAlloc())) goto error; pInfo->private = pEvdev; commit 9ec9d214d072ef4aaffb65b5575eff58edcb62ed Author: Colin Walters <walt...@verbum.org> Date: Wed Jan 4 17:37:06 2012 -0500 autogen.sh: Implement GNOME Build API http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Adam Jackson <a...@redhat.com> diff --git a/autogen.sh b/autogen.sh index 904cd67..fc34bd5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,4 +9,6 @@ cd $srcdir autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? -$srcdir/configure --enable-maintainer-mode "$@" +if test -z "$NOCONFIGURE"; then + $srcdir/configure "$@" +fi commit 94e6df8f5f6048b8d0c7aa34efe1c0dc70b997d1 Author: Adam Jackson <a...@redhat.com> Date: Wed Jan 16 13:11:11 2013 -0500 configure: Drop AM_MAINTAINER_MODE Signed-off-by: Adam Jackson <a...@redhat.com> diff --git a/configure.ac b/configure.ac index dff2bcf..f0d0a78 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,6 @@ AC_CONFIG_AUX_DIR(.) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) -AM_MAINTAINER_MODE # Initialize libtool AC_DISABLE_STATIC commit 67e5376aaa62a1586fee37d610b3ad7e3b8bbcab Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Jan 14 14:45:58 2013 +1000 Handle axis swap, calibration, and inversion for touch events (#59340) X.Org Bug 59340 <http://bugs.freedesktop.org/show_bug.cgi?id=59340> Reported-by: Bastien Nocera <had...@hadess.net> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 1581d47..c689257 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -744,6 +744,9 @@ EvdevProcessTouch(InputInfoPtr pInfo) type = XI_TouchUpdate; + EvdevSwapAbsValuators(pEvdev, pEvdev->mt_mask); + EvdevApplyCalibration(pEvdev, pEvdev->mt_mask); + EvdevQueueTouchEvent(pInfo, pEvdev->cur_slot, pEvdev->mt_mask, type); pEvdev->slot_state = SLOTSTATE_EMPTY; commit 2432626b70b7f55a337bcfdc9ba415811634c062 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Jan 14 14:10:14 2013 +1000 Move calibration adjustments to helper function No functional changes. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index f061324..1581d47 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -448,6 +448,42 @@ EvdevSwapAbsValuators(EvdevPtr pEvdev, ValuatorMask *mask) } } +static void +EvdevApplyCalibration(EvdevPtr pEvdev, ValuatorMask *mask) +{ + int i; + + for (i = 0; i <= 1; i++) { + int val; + int calib_min; + int calib_max; + + if (!valuator_mask_isset(mask, i)) + continue; + + val = valuator_mask_get(mask, i); + + if (i == 0) { + calib_min = pEvdev->calibration.min_x; + calib_max = pEvdev->calibration.max_x; + } else { + calib_min = pEvdev->calibration.min_y; + calib_max = pEvdev->calibration.max_y; + } + + if (pEvdev->flags & EVDEV_CALIBRATED) + val = xf86ScaleAxis(val, pEvdev->absinfo[i].maximum, + pEvdev->absinfo[i].minimum, calib_max, + calib_min); + + if ((i == 0 && pEvdev->invert_x) || (i == 1 && pEvdev->invert_y)) + val = (pEvdev->absinfo[i].maximum - val + + pEvdev->absinfo[i].minimum); + + valuator_mask_set(mask, i, val); + } +} + /** * Take the valuators and process them accordingly. */ @@ -524,39 +560,8 @@ EvdevProcessValuators(InputInfoPtr pInfo) * just works. */ else if (pEvdev->abs_queued && pEvdev->in_proximity) { - int i; - EvdevSwapAbsValuators(pEvdev, pEvdev->vals); - - for (i = 0; i <= 1; i++) { - int val; - int calib_min; - int calib_max; - - if (!valuator_mask_isset(pEvdev->vals, i)) - continue; - - val = valuator_mask_get(pEvdev->vals, i); - - if (i == 0) { - calib_min = pEvdev->calibration.min_x; - calib_max = pEvdev->calibration.max_x; - } else { - calib_min = pEvdev->calibration.min_y; - calib_max = pEvdev->calibration.max_y; - } - - if (pEvdev->flags & EVDEV_CALIBRATED) - val = xf86ScaleAxis(val, pEvdev->absinfo[i].maximum, - pEvdev->absinfo[i].minimum, calib_max, - calib_min); - - if ((i == 0 && pEvdev->invert_x) || (i == 1 && pEvdev->invert_y)) - val = (pEvdev->absinfo[i].maximum - val + - pEvdev->absinfo[i].minimum); - - valuator_mask_set(pEvdev->vals, i, val); - } + EvdevApplyCalibration(pEvdev, pEvdev->vals); Evdev3BEmuProcessAbsMotion(pInfo, pEvdev->vals); } } commit 069c035ab0787e6841159929199ae58502d89c4b Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Jan 14 14:07:26 2013 +1000 Move valuator swapping into a helper function No functional changes. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index dfce8c4..f061324 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -418,6 +418,36 @@ EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count) } } +static void +EvdevSwapAbsValuators(EvdevPtr pEvdev, ValuatorMask *mask) +{ + int i; + int swapped_isset[2] = {0, 0}; + int swapped_values[2]; + + if (!pEvdev->swap_axes) + return; + + for(i = 0; i <= 1; i++) { + if (valuator_mask_isset(mask, i)) { + swapped_isset[1 - i] = 1; + swapped_values[1 - i] = + xf86ScaleAxis(valuator_mask_get(mask, i), + pEvdev->absinfo[1 - i].maximum, + pEvdev->absinfo[1 - i].minimum, + pEvdev->absinfo[i].maximum, + pEvdev->absinfo[i].minimum); + } + } + + for (i = 0; i <= 1; i++) { + if (swapped_isset[i]) + valuator_mask_set(mask, i, swapped_values[i]); + else + valuator_mask_unset(mask, i); + } +} + /** * Take the valuators and process them accordingly. */ @@ -496,27 +526,7 @@ EvdevProcessValuators(InputInfoPtr pInfo) else if (pEvdev->abs_queued && pEvdev->in_proximity) { int i; - if (pEvdev->swap_axes) { - int swapped_isset[2] = {0, 0}; - int swapped_values[2]; - - for(i = 0; i <= 1; i++) - if (valuator_mask_isset(pEvdev->vals, i)) { - swapped_isset[1 - i] = 1; - swapped_values[1 - i] = - xf86ScaleAxis(valuator_mask_get(pEvdev->vals, i), - pEvdev->absinfo[1 - i].maximum, - pEvdev->absinfo[1 - i].minimum, - pEvdev->absinfo[i].maximum, - pEvdev->absinfo[i].minimum); - } - - for (i = 0; i <= 1; i++) - if (swapped_isset[i]) - valuator_mask_set(pEvdev->vals, i, swapped_values[i]); - else - valuator_mask_unset(pEvdev->vals, i); - } + EvdevSwapAbsValuators(pEvdev, pEvdev->vals); for (i = 0; i <= 1; i++) { int val; commit 3b7ba39fcaf261f800205fd6cf45fea9998529e5 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Jan 14 14:03:54 2013 +1000 Localise tmp variable Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 5667dc1..dfce8c4 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -424,7 +424,6 @@ EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count) static void EvdevProcessValuators(InputInfoPtr pInfo) { - int tmp; EvdevPtr pEvdev = pInfo->private; int *delta = pEvdev->delta; @@ -456,6 +455,7 @@ EvdevProcessValuators(InputInfoPtr pInfo) } if (pEvdev->rel_queued) { + int tmp; int i; if (pEvdev->swap_axes) { commit 454194f4b530af5d7f92a3b28c28495b4faac547 Author: Mauro Carvalho Chehab <mche...@redhat.com> Date: Tue Jan 8 15:04:07 2013 +1000 Force a button if MT axes are present and it is not a gamepad We expect at least BTN_TOUCH for anything with MT axes, but devices that don't have that need a button class regardless. Some gamepads define MT axes but no buttons, causing a bug in the server when they post a TouchBegin. [ 97436.293] (EE) BUG: triggered 'if (!b || !v)' [ 97436.293] (EE) BUG: exevents.c:929 in UpdateDeviceState() So, ignore it, if it is a joystick (e. g. if it have BTN_JOYSTICK defined). Otherwise, fake a button. This patch basically merges two patches written by Peter Hutterer <peter.hutte...@who-t.net>. Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev.c b/src/evdev.c index 7b355d7..5667dc1 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2160,8 +2160,20 @@ EvdevProbe(InputInfoPtr pInfo) -- 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/e1upoxm-0003kf...@vasks.debian.org