Home | History | Annotate | Download | only in hid
History log of /src/sys/dev/hid/hid.c
RevisionDateAuthorComments
 1.8  19-Dec-2024  jmcneill fixup! Fix parsing keyboard HID descriptor on ThinkPad T14s Gen6.

The previous change broke detection of some devices. Rework the change
in hopes to fix this.
 1.7  09-Dec-2024  jmcneill Fix parsing keyboard HID descriptor on ThinkPad T14s Gen6.

Undo a change made 18 years ago when the bluetooth stack was imported. The
commit message didn't describe why the change was made, and it breaks
detection of the keyboard device on this laptop.

OpenBSD's hid parser looks like the original code here.
 1.6  17-Oct-2023  nat branches: 1.6.6;
Improve hid matching.

It now matches all kinds (application/physical/logical) in the hid
collection.

Patch from PR applied.

Addresses PR/46868.

Ok skrll@
 1.5  13-Mar-2022  riastradh hid: Avoid arithmetic overflow by rearranging inequalities.
 1.4  01-Jan-2020  maxv Fix small read overflows when parsing HID tables. Noticed by kASan the
other day while I was playing with vHCI.
 1.3  15-Nov-2018  jakllsch branches: 1.3.4;
Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.
 1.2  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.1  10-Dec-2017  bouyer branches: 1.1.2; 1.1.4;
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
 1.1.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.4.1  10-Jun-2019  christos Sync with HEAD
 1.1.2.2  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.4.1  05-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #605):

sys/dev/hid/hid.c: revision 1.4

Fix small read overflows when parsing HID tables. Noticed by kASan the
other day while I was playing with vHCI.
 1.6.6.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed