summaryrefslogtreecommitdiff
path: root/sys/dev/hid
AgeCommit message (Collapse)Author
2025-12-01hid: Make game controllers accessible to members of the game groupVladimir Kondratyev
Their events have to be accessible by unprivileged users via e.g. libsdl. MFC after: 1 month
2025-10-18Match style in 3613896David E. O'Brien
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D53193
2025-10-18knotes: kqueue: handle copy for trivial filtersKonstantin Belousov
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D52045
2025-09-25u2f(4): Invert U2F_MAKE_UHID_ALIAS kernel build optionVladimir Kondratyev
This makes non-GENERIC kernel configs easier to maintain. Requested by: glebius MFC after: 2 days
2025-09-25u2f(4): Use taskqueue to start USB transfers from kqueue contextVladimir Kondratyev
to avoid recursion on u2f mutex and taking of hidbus sleepable lock. Tested by: emaste PR: 289494 MFC after: 2 days
2025-09-22ietp(4): Always overload HID report descriptorVladimir Kondratyev
It is required since "iichid(4): Always use wMaxInputLength bytes as input report length" commit. MFC after: 1 week
2025-08-23hkbd: fix compliation error for GENERICShengYi Hung
Reported by: gbe Approved by: lwhsu (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52135
2025-08-23hkbd: remove erorr detection in KDSKBSTATE ioctlShengYi Hung
The KDSKBSTATE ioctl brings the LED up. However, some keyboards (like qemu keyboard) may not have LED or failed to set the LED due to unexpected reason. Therefore, removing the error check as ukbd(4) does allow the keyboard works correctly with kbdcontrol(4). Also move hw.hid.hkbd.no_leds sysctl out of HID_BUG thus users can disable setting LEDs PR: 288968 Reviewed by: wulf Tested by: trashcan@ellael.org, marklmi26-fbsd@yahoo.com, trkellers@gmail.coom Approved by: lwsu (mentor), markj (mentor) MFC after 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52101 mvalsmva
2025-08-18u2f(4): a HID driver for FIDO/U2F security keysVladimir Kondratyev
While FIDO/U2F keys were already supported by the generic uhid(4) and hidraw(4) drivers, this driver adds some additional features an does steps to tighten the security of FIDO/U2F access. - It automatically loads through devd. - Automatically enables HQ_NO_READAHEAD for FIDO/U2F devices. - Implements only miminum set of features. - Do not requires external devfs configuration to set character device permissions. - Names character device as u2f/# to make possible capsicum or any other pledge()-style sandboxing. PR: 265528 Differential Revision: https://reviews.freebsd.org/D51612
2025-08-18hidraw(4): Rename to uhid if HIDRAW_MAKE_UHID_ALIAS is specifiedVladimir Kondratyev
instead of renaming uhid(4) to hidraw to make easier import of coming u2f(4) driver which has similar option. Differential Revision: https://reviews.freebsd.org/D51608
2025-08-18hid: Allow serial execution of HID_INTR_START method.Vladimir Kondratyev
It is required to implement HQ_NO_READAHEAD HID quirk. Differential revision: https://reviews.freebsd.org/D51606
2025-08-18hid: Add HQ_NO_READAHEAD quirk and implement it in usbhid(4)Vladimir Kondratyev
It disables interrupt emulation on poll-driven buses like USB and forces aquiring of only one USB frame per read(2) operation. This avoids an FIDO/U2F issue where IN endpoint data received from the device right before the file handle is closed, gets lost. PR: 263995 Reviewed by: aokblast Differential revision: https://reviews.freebsd.org/D51605
2025-06-21newbus: replace leftover device unit wildcardsAhmad Khalifa
Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
2025-05-30hid.h: Add U2F usage tables constantsVladimir Kondratyev
Per "HID Usage Tables for Universal Serial Bus (USB)" Version 1.6. Page ID F1D0 FIDO Alliance Page Usage ID 01 U2F Authenticator Device - A device that provides 2nd factor authentication using the FIDO U2FHID protocol. Reviewed by: wulf Differential Revision: https://reviews.freebsd.org/D50549
2025-05-14Added identifiers for additional PS4 DualShock controller variantsKevin Reinholz
PR: 285215 MFC after: 1 week
2025-04-27hidraw(4): Force switch to hidraw mode on HIDIOCGRDESC ioctlVladimir Kondratyev
To match documentation. Reported by: Ihor Dutchak <ihor.youw@gmail.com> PR: 286155 MFC after: 3 days
2025-04-27hidraw(4): Return actual length of read data from HIDIOCG* ioctlsVladimir Kondratyev
To match Linux. MFC after: 3 days
2025-04-27hidraw(4): Return length of written data from HIDIOCS* ioctlsVladimir Kondratyev
To match Linux. MFC after: 3 days
2025-04-27hidraw(4): Add additional hidraw input/output report ioctlsVladimir Kondratyev
to Linux hidraw compatibility API. Respective Linux commit f43d3870cafa made by Dean Camera message is: Currently the hidraw module can only read and write feature HID reports on demand, via dedicated ioctls. Input reports are read from the device through the read() interface, while output reports are written through the write interface(). This is insufficient; it is desirable in many situations to be able to read and write input and output reports through the control interface to cover additional scenarios: - Reading an input report by its report ID, to get initial state - Writing an input report, to set initial input state in the device - Reading an output report by its report ID, to obtain current state - Writing an output report by its report ID, out of band This patch adds these missing ioctl requests to read and write the remaining HID report types. Note that not all HID backends will neccesarily support this (e.g. while the USB link layer supports setting Input reports, others may not). FreeBSD native uhid(4) compatible API already has similar ioctls. MFC after: 3 days
2025-01-02Remove now-redundant calls to device_delete_childrenJohn Baldwin
Earlier calls to bus_generic_detach now take care of deleting children. Differential Revision: https://reviews.freebsd.org/D47962
2024-12-22hid: Correctly handle signed/unsigned quantities in kernel HID parser.Vladimir Kondratyev
Wrong signedness of usage value results in inverted range check in hmt(4) driver that allows out of bound array access leading to panic. Reported by: many Sponsored by: Future Crew, LLC Obtained from: NetBSD NetBSD PR: kern/53605 PR: 274014, 282592
2024-12-06bus_delayed_attach_children: Switch return type to voidJohn Baldwin
This function never fails similar to bus_attach_children. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47677
2024-12-06Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
2024-12-06Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
2024-11-26kern: Make fileops and filterops tables const where possibleMark Johnston
No functional change intended. MFC after: 1 week
2024-11-26hms(4): improve scroll with IICHID_SAMPLINGEdward Tomasz Napierala
The current quirk is designed to discard duplicated data read from the chip. Problem is, it also discards real events when they happen to be identical, which is the case with scroll wheel events; differently from X/Y they always move by fixed offset. This results in two-finger scroll that would stop mid-way that could be fixed by manually setting dev.hms.0.drift_thresh to 0. To fix that, don't discard duplicates when there's wheel movement. For users with actual duplicates problem this will result in scroll suddenly becoming quite inertial, but it will stop moving at any touch, so shouldn't be terrible. PR: kern/276709 Reviewed By: wulf Differential Revision: https://reviews.freebsd.org/D47640
2024-11-18hidraw(4): update hgd_actlen in HIDRAW_GET_REPORT ioctlMatthew Nygard Dodd
HIDRAW_GET_REPORT ioctl is documented to update hgd_actlen on return with the number of bytes copied. It does not do this. Reviewed by: wulf PR: 282790 MFC after: 1 week
2024-07-24newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-06-16hidbus: Use device_set_descf()Mark Johnston
No functional change intended. MFC after: 1 week
2024-06-05hidbus(4): Fix wrong assertion of busZhenlei Huang
Reviewed by: wulf Fixes: 4151ac9f1292 hidbus(4): Use generic hid methods to ... MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45496
2024-02-21bcm5974(4): Properly assign MT-slot on Apple Magic TrackpadVladimir Kondratyev
Assign multi-touch slot number based on internal evdev MT state and reported tracking ID of contact rather than on sequentional number of contact in report. Sponsored by: Serenity Cyber Security Fixes: ef8397c28e98 ("add Magic Trackpad 2 (USB only) support") MFC after: 1 month
2024-02-21bcm5974(4): Respect HID_DEBUG option and fix debugging printfVladimir Kondratyev
Sponsored by: Serenity Cyber Security MFC after: 1 month
2024-02-21bcm5974(4): Report proper width and depth for Apple Magic TrackpadsVladimir Kondratyev
The size of modern Apple Magic Trackpad is about 160x110mm Sponsored by: Serenity Cyber Security MFC after: 1 month
2023-12-25hid: Handle errors from copyin() in ioctl handlersMark Johnston
If copyin() fails, the driver will proceed blindly with a zeroed buffer, which is not what we want. In preparation for annotating copyin() with __result_use_check, start checking for errors. Reviewed by: wulf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43102
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-11-02hmt(4): Do not require input report HID usages to be a member of TLCVladimir Kondratyev
Some touchpads places button usages (in HID report descriptor) in to the 2-nd level collection rather than in to the top level one. That confuses current code. Remove collection level check in HID report descriptor parser to fix device detection. Reported by: Peter Much <pmc@citylink.dinoex.sub.org> PR: 267094 MFC after: 1 week
2023-08-20Add atopcase, the Apple HID over SPI input driverVal Packett
The driver provides support for Human Interface Devices (HID) on Serial Peripheral Interface (SPI) buses on Apple Intel Macs produced in 2015-2018. The driver appears to work more stable after installation of Darwin OSI in acpi(4) driver. To install Darwin OSI insert following lines into /boot/loader.conf: hw.acpi.install_interface="Darwin" hw.acpi.remove_interface="Windows 2009, Windows 2012" Reviewed by: wulf Differential revision: https://reviews.freebsd.org/D39863
2023-08-20bcm5974(4): add support for devices attached over SPI busVal Packett
Reviewed by: wulf
2023-08-16sys: Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-06hidraw(4): Implement HIDRAW_GET_DEVICEINFO ioctlVladimir Kondratyev
In commit c77bfaa75051 uhid(4) gained support for ioctl from USB_GET_DEVICEINFO. This is used in libraries like libfido2 to retrieve information about a device. This commit adds binary compatible version to hidraw(4). PR: 264843 MFC after: 1 month Requested by: grembo
2023-08-03hidbus(4): Use generic hid methods to start and stop interruptsVladimir Kondratyev
2023-08-03hid: Add child device parameter to HID methodsVladimir Kondratyev
Some devices like Apple HID-over-SPI may contain more than one report descriptors necessitating creation of multiple hidbus children. Add indentificator of child devices to distinct them. No functional changes intended. Differential Revision: https://reviews.freebsd.org/D41246
2023-07-06kbd: consolidate kb interfaces (phase one)Michael
Refactor to eliminate duplicated rate and delay tables, with minor style tweaks for changed lines. Remove an obsolete comment about needing to convert from microseconds to ticks (that's done elsewhere). Remove traiing whitespace in kbdcontrol.c. Except for the new warning, no change in behavior Sponsored by: DSS GmbH Reviewed by: imp [minor style tweaks as well] Pull Request: https://github.com/freebsd/pull/683 Differential Revision: https://reviews.freebsd.org/D38818
2023-05-12spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-04-25bcm5974(4): Make Magic Trackpad 2 support endian-safe.Vladimir Kondratyev
While here make touch orientation event matching with Linux MFC after: 1 month
2023-04-25bcm5974(4): add Magic Trackpad 2 (USB only) supportVal Packett
The MT2 uses a compact report format, but otherwise is similar in many ways to the internal trackpads, it even uses the same mode switching commands. Reviewed by: wulf MFC after: 1 month Differential revision: https://reviews.freebsd.org/D34437