Index: usr.sbin/bluetooth/bthidd/hid.c =================================================================== --- usr.sbin/bluetooth/bthidd/hid.c +++ usr.sbin/bluetooth/bthidd/hid.c @@ -131,6 +131,7 @@ int32_t report_id, usage, page, val, mouse_x, mouse_y, mouse_z, mouse_butt, mevents, kevents, i; + uint32_t usage_offset; assert(s != NULL); assert(s->srv != NULL); @@ -165,9 +166,21 @@ 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_offset = val - h.logical_minimum; + usage = HID_USAGE(h.usage_minimum + usage_offset); + } else { + usage = HID_USAGE(h.usage); + } + switch (page) { case HUP_GENERIC_DESKTOP: switch (usage) {