diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-08-19 18:46:23 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-08-19 18:46:23 +0000 |
commit | 2132ea7d89e2d70989131689128847a576e576df (patch) | |
tree | 31d2563288680845203387ea3e2ae293f45aef75 /sys/dev | |
parent | 7dd075985acafa118657ef592334593204e3b135 (diff) |
Let ums probe bounds of absolute devices if available.
ok shadchin@ some weeks ago.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/hidms.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/dev/usb/hidms.c b/sys/dev/usb/hidms.c index 261a56514c4..1a17cfa7a2d 100644 --- a/sys/dev/usb/hidms.c +++ b/sys/dev/usb/hidms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidms.c,v 1.3 2011/04/07 15:30:16 miod Exp $ */ +/* $OpenBSD: hidms.c,v 1.4 2011/08/19 18:46:22 matthieu Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -70,6 +70,8 @@ int hidms_setup(struct device *self, struct hidms *ms, uint32_t quirks, int id, void *desc, int dlen) { + struct hid_item h; + struct hid_data *d; uint32_t flags; int i, wheel, twheel; @@ -211,7 +213,24 @@ hidms_setup(struct device *self, struct hidms *ms, uint32_t quirks, ms->sc_loc_btn[1].pos = 9; ms->sc_loc_btn[2].pos = 10; } - + /* Parse descriptors to get touch panel bounds */ + d = hid_start_parse(desc, dlen, hid_input); + while (hid_get_item(d, &h)) { + switch (HID_GET_USAGE(h.usage)) { + case HUG_X: + if (ms->sc_flags & HIDMS_ABSX) { + ms->sc_tsscale.minx = h.logical_minimum; + ms->sc_tsscale.maxx = h.logical_maximum; + } + break; + case HUG_Y: + if (ms->sc_flags & HIDMS_ABSY) { + ms->sc_tsscale.miny = h.logical_minimum; + ms->sc_tsscale.maxy = h.logical_maximum; + } + break; + } + } return 0; } |