diff options
| author | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2015-04-05 18:53:48 +0000 |
|---|---|---|
| committer | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2015-04-05 18:53:48 +0000 |
| commit | 822a51b3968f95a7bb8bf0facac9e48d82fc1b69 (patch) | |
| tree | 55a3f03b20bea9df1f74e5150e01a021296a3a35 /usr.sbin/bluetooth/bthidd/hid.c | |
| parent | 947d2519e3ad3fb8b2926902e6c08b0db866dc21 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/bluetooth/bthidd/hid.c')
| -rw-r--r-- | usr.sbin/bluetooth/bthidd/hid.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/bluetooth/bthidd/hid.c b/usr.sbin/bluetooth/bthidd/hid.c index c68865b0a3db7..5eb7592da5c92 100644 --- a/usr.sbin/bluetooth/bthidd/hid.c +++ b/usr.sbin/bluetooth/bthidd/hid.c @@ -165,9 +165,21 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_t len) continue; page = HID_PAGE(h.usage); - usage = HID_USAGE(h.usage); val = hid_get_data(data, &h); + /* + * When the input field is an array and the usage is specified + * with a range instead of an ID, we have to derive the actual + * usage by using the item value as an index in the usage range + * list. + */ + if ((h.flags & HIO_VARIABLE)) { + usage = HID_USAGE(h.usage); + } else { + const uint32_t usage_offset = val - h.logical_minimum; + usage = HID_USAGE(h.usage_minimum + usage_offset); + } + switch (page) { case HUP_GENERIC_DESKTOP: switch (usage) { |
