From 7e7150bc7e540fc1240ca7052308a6f869e987f3 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Tue, 14 Aug 2012 21:59:03 +0200 Subject: [PATCH 1/2] Slow down scrolling on 04b3:3108 IBM Corp. 800dpi Optical Mouse w/ Scroll Point --- src/evdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/evdev.c b/src/evdev.c index 54772c7..cb884ef 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -33,6 +33,9 @@ #include "evdev.h" +/* 04b3:3108 IBM Corp. 800dpi Optical Mouse w/ Scroll Point */ +#define SCROLLPOINT (pEvdev->id_vendor == 0x4b3 && pEvdev->id_product == 0x3108) + #include #include @@ -1598,7 +1601,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device) xf86InitValuatorDefaults(device, axnum); #ifdef HAVE_SMOOTH_SCROLLING if (axis == REL_WHEEL) - SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED); + SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, SCROLLPOINT ? -6.0 : -1.0, SCROLL_FLAG_PREFERRED); else if (axis == REL_DIAL) SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_NONE); else if (axis == REL_HWHEEL) -- 1.7.11.4 From ce30c59856c54a4b7bc8e8495d2fecdbc6b7b0e2 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Tue, 14 Aug 2012 21:59:35 +0200 Subject: [PATCH 2/2] Add horizontal scroll on 04b3:3108 IBM Corp. 800dpi Optical Mouse w/ Scroll Point The driver emits REL_Z as of Kernel 3.4.8-1-ARCH, we just rewrite these events to REL_HWHEEL. Again we slow down since there are many events, and even a bit more than REL_WHEEL since horizontal scrolling is not used that often, and the hardware forces to press harder anyway. --- src/evdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/evdev.c b/src/evdev.c index cb884ef..a729d39 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -686,6 +686,9 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev) /* Get the signed value, earlier kernels had this as unsigned */ value = ev->value; + if (SCROLLPOINT && ev->code == REL_Z) + ev->code = REL_HWHEEL; + switch (ev->code) { #ifndef HAVE_SMOOTH_SCROLLING case REL_WHEEL: @@ -1531,6 +1534,9 @@ EvdevAddRelValuatorClass(DeviceIntPtr device) if (!EvdevBitIsSet(pEvdev->bitmask, EV_REL)) goto out; + if (SCROLLPOINT) + EvdevSetBit(pEvdev->rel_bitmask, REL_HWHEEL); + num_axes = EvdevCountBits(pEvdev->rel_bitmask, NLONGS(REL_MAX)); if (num_axes < 1) goto out; @@ -1605,7 +1611,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device) else if (axis == REL_DIAL) SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_NONE); else if (axis == REL_HWHEEL) - SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE); + SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, SCROLLPOINT ? 12.0 : 1.0, SCROLL_FLAG_NONE); #endif } -- 1.7.11.4