Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F141027027
D47640.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47640.id.diff
View Options
diff --git a/sys/dev/hid/hms.c b/sys/dev/hid/hms.c
--- a/sys/dev/hid/hms.c
+++ b/sys/dev/hid/hms.c
@@ -122,6 +122,7 @@
hid_size_t isize;
uint32_t drift_cnt;
uint32_t drift_thresh;
+ struct hid_location wheel_loc;
#endif
};
@@ -131,6 +132,7 @@
{
struct hidmap *hm = context;
struct hms_softc *sc = device_get_softc(hm->dev);
+ int32_t wheel;
if (len > sc->isize)
len = sc->isize;
@@ -140,8 +142,18 @@
* to return last report data in sampling mode even after touch has
* been ended. That results in cursor drift. Filter out such a
* reports through comparing with previous one.
+ *
+ * Except this results in dropping consecutive mouse wheel events,
+ * because differently from cursor movement they always move by the
+ * same amount. So, don't do it when there's mouse wheel movement.
*/
- if (len == sc->last_irsize && memcmp(buf, sc->last_ir, len) == 0) {
+ if (sc->wheel_loc.size != 0)
+ wheel = hid_get_data(buf, len, &sc->wheel_loc);
+ else
+ wheel = 0;
+
+ if (len == sc->last_irsize && memcmp(buf, sc->last_ir, len) == 0 &&
+ wheel == 0) {
sc->drift_cnt++;
if (sc->drift_thresh != 0 && sc->drift_cnt >= sc->drift_thresh)
return;
@@ -285,9 +297,25 @@
/* Count number of input usages of variable type mapped to buttons */
for (hi = sc->hm.hid_items;
hi < sc->hm.hid_items + sc->hm.nhid_items;
- hi++)
+ hi++) {
if (hi->type == HIDMAP_TYPE_VARIABLE && hi->evtype == EV_KEY)
nbuttons++;
+#ifdef IICHID_SAMPLING
+ /*
+ * Make note of which part of the report descriptor is the wheel.
+ */
+ if (hi->type == HIDMAP_TYPE_VARIABLE &&
+ hi->evtype == EV_REL && hi->code == REL_WHEEL) {
+ sc->wheel_loc = hi->loc;
+ /*
+ * Account for the leading Report ID byte
+ * if it is a multi-report device.
+ */
+ if (hi->id != 0)
+ sc->wheel_loc.pos += 8;
+ }
+#endif
+ }
/* announce information about the mouse */
device_printf(dev, "%d buttons and [%s%s%s%s%s] coordinates ID=%u\n",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 31, 10:31 PM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27408683
Default Alt Text
D47640.id.diff (1 KB)
Attached To
Mode
D47640: RFC: hms(4): improve scroll with IICHID_SAMPLING
Attached
Detach File
Event Timeline
Log In to Comment