summaryrefslogtreecommitdiff
path: root/sys/dev/usb/input
AgeCommit message (Collapse)Author
2025-08-18usbhid(4): Implement USB_GET_DEVICEINFO ioctlVladimir Kondratyev
With factoring out of supporting code from ugen(4) driver. The ioctl is used in FIDO/U2F security key drivers to get USB product and manufacturer strings. PR: 264843 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51609
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: 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-07-30usbhid: Enable by defaultEd Maste
Co-authored-by: Emmanuel Vadot <manu@FreeBSD.org> Reviewed by: bapt, wulf Relnotes: Yes Sponsored by: Beckhoff Automation GmbH & Co. KG Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45659
2025-03-07wsp: Fix whitespacesJoshua Rogers
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07wsp: Rename max_finger_area sysctl to max_finger_diameterJoshua Rogers
The value of this sysctl is not an area, but a maximum diameter. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07wsp: Handle horizontal scrolling and create tunable for swipe/scroll.Joshua Rogers
Previously, a two-finger horizontal scroll would result in a forwards/backwards keyboard event being performed. This patch changes that functionality to be specified via two new sysctls: horizontal_swipe_finger_count and scroll_finger_count. The former specifies how many fingers are used to perform the aforementioned forwards/backwards keyboard event, while the latter specifies how many fingers are used to perform horizontal scrolling. 0 disables each of them. The threshold for scrolling has been coupled into a single tunable: scr_threshold. This tunable is used for both scrolling and the horizontal swipe. t_factor and t_invert tunables have been created in the same manner as their z-axis counterparts. Horizontal scrolling is disabled by default, as it requires the sysctl hw.usb.wsp.t_factor to 3 (wsp mode). Horizontal swiping is enabled by default with a three-finger tap. Also rewrite much of, and improve, documentation. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07wsp: Fix typo in function name.Joshua Rogers
Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07wsp: Add hw.usb.wsp.max_scroll_finger_distance for two-finger scrollingJoshua Rogers
The hw.usb.wsp.max_scroll_finger_distance sysctl may be used to specify the maximum distance between two fingers which are registered as a z-axis (vertical scroll with mousepad) movement. Previously, this was shared with the tunable hw.usb.wsp.max_double_tap_distance which is used to specify the maximum distance between two fingers which register as a right-click. This patch also cleans up and add new information to the manpage for wsp(4). Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-07wsp: Raise the default scr_hor_threshold sysctl.Joshua Rogers
The previous value caused nearly every horizontal movement to be classed as a left/right-keyboard button-click. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
2025-03-04usb: Kill left-over cdefs.h includesWarner Losh
These includes were for __FBSD_RCSID() macro. They weren't formatted like the rest of the tree so weren't trimmed automatically when that script was run. Trim them now. MFC After: 1 week Sponsored by: Netflix
2025-01-02Use bus_generic_detach instead of device_delete_children in detachJohn Baldwin
While here, check for errors from bus_generic_detach and move it to the start of detach if necessary. Differential Revision: https://reviews.freebsd.org/D47969
2024-12-06Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
2024-11-18uhid(4): update ugd_actlen in USB_GET_REPORT ioctlMatthew Nygard Dodd
USB_GET_REPORT ioctl is documented to update ugd_actlen on return with the number of bytes copied. It does not do this. Reviewed by: wulf PR: 282790 MFC after: 1 week
2024-11-07ukbd: Enable ukbd_apple_swap for all Apple ISO keyboardsFrank Hilgendorf
Key code swapping between [<>] and [^°] key is enabled for all Apple ISO type keyboards. Before, swapping was enabled when the Eject key was detected in HID usage. This did not correlate well with the swapped keys presence. usbdevs file is extended by several Apple keyboard models to support ISO model identification. Reviewed by: markj MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1506
2024-09-06wsp: Use already-calculated distance of fingers for comparison.Joshua Rogers
Also correctly use tun.max_double_tap_distance for maximum distance of fingers for vertical scrolling. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu> Reviewed by: imp, wulf Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
2024-09-06wsp: Improve multi-finger touchpad usage and allow more configurationsJoshua Rogers
This patch allows scrolling with multiple fingers simultaneously, in line with how wsp trackpads function on MacOS. Two new tunables are added: hw.usb.wsp.max_finger_area and hw.usb.wsp.max_double_tap_distance. max_finger_area defines the maximum size which the driver registered an object on trackpad as a finger. Previously, this value was hardcoded as 1200, which was too low to register thumb-clicks. max_double_tap_distance defines the maximum distance between two fingers which will register as a double-click. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu> Reviewed by: imp, wulf Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
2024-09-06wsp: Allow the trackpad to be used after a partially unreleased click.Joshua Rogers
This provides functionality for a click which is partially unreleased and then allows the user to continue moving the mousepad as if were not invoked as a full click Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu> Reviewed by: imp, wulf Pull Request: https://github.com/freebsd/freebsd-src/pull/1365
2024-07-24newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-07-03ums(4): fix incorrect mouse button reporting via evdevNiko Sonack
when ums driver receives non-mouse HID report. This results in unexpected button release event. Reuse existing sysmouse logic to keep button pressed. Reviewed by: imp, wulf MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45838
2023-12-25uhid: Check for errors from copyin() in ioctl handlersMark Johnston
This is in preparation for annotating copyin() and related functions with __result_use_check. Reviewed by: wulf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43103
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
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-02-14sys/kbio.h: make pre-unicode keymap support optionalStefan Eßer
FreeBSD-9 had introduced support for the full set of Unicode characters to the parsing and processing of keymap character tables. This support has been extended to cover the table for accented characters that are reached via dead key combinations in FreeBSD-13.2. New ioctls have been introduced to support both the pre-Unicode and the Unicode formats and keyboard drivers have been extended to support those ioctls. This commit makes the ABI compatibility functions in the kernel optional and dependent on COMPAT_FREEBSD13 in -CURRENT. The kbdcontrol command in -CURRENT and 13-STABLE (before 13.2) has been made ABI compatible with old kernels to allow a new world to be run on an old kernel (that does not have full Unicode support for keymaps). This commit is not to merged back to 12-STABLE or 13-STABLE. It is part of review D38465, which has been split into 3 separate commits due to different MFC and life-time requirements of either commit. Approved by: imp Differential Revision: https://reviews.freebsd.org/D38465
2023-02-06Support Unicode characters in keymap dead key tablesStefan Eßer
Support for Unicode characters had been added to the keyboard code, but there are keymaps that have accented characters accessed via dead key combinations, and those were still restricted to 8 bit codes. This update to kbd.c adds support for Unicode characters and compatibility code that allows a kbdcontrol command built from kbio.h without these patches to work on a new kernel. Compatibility code that allows a new kbdcontrol binary running on an old kernel to load and display the dead key map will be committed in a separate commit. Reviewed by: imp, brooks Approved by: brooks MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D38381
2023-02-04wmt: purge EOL release compatibilityElliott Mitchell
Remove FreeBSD 11 support Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/603 Differential Revision: https://reviews.freebsd.org/D35560
2022-12-24ums(4): Disable vendor usage page button supportVladimir Kondratyev
for all devices except Kensington Slimblade Trackball as it brokes some other devices like Contour Rollermouse Red Add a quirk for it as well. Reported by: Atte Peltomäki <koston_AT_iki_DOT_fi> PR: 267922 MFC after: 2 weeks
2022-12-07atp: Fix mismatch in array bounds.John Baldwin
Reported by: GCC -Warray-parameter Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D37552
2022-11-19evdev: Extend EVIOCGRAB ioctl scope to cover kbd interfaceVladimir Kondratyev
of various keyboard drivers. EVIOCGRAB ioctl execution on /dev/input/event# device node gains exclusive access to this device to caller. It is used mostly for development purposes and remote control software. See e.g. https://reviews.freebsd.org/D30020 which is the reason of creation of this change. Keyboard grabbing is disabled in KDB and during panics. MFC with: 4a0db5e2920c Tested by: corvink Differential revision: https://reviews.freebsd.org/D30542
2022-11-18evdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interfaceVladimir Kondratyev
of psm(4), ums(4) and sysmouse(4) drivers. EVIOCGRAB ioctl execution on /dev/input/event# device node gains exclusive access to this device to caller. It is used mostly for development purposes and remote control software. See e.g. https://reviews.freebsd.org/D30020 which is the reason of creation of this change. MFC after: 2 weeks Tested by: corvink Differential revision: https://reviews.freebsd.org/D30542
2022-09-11usbhid(4): Increase probe priority to BUS_PROBE_DEFAULT + 1Vladimir Kondratyev
usbhid(4) vs other USB HID drivers precedence is determined by hw.usb.usbhid.enable loader tunable and HID quirk subsystem rather than by device_probe() return value. Raise priority high enough to always give usbhid(4) a possible chance to attach. Fixes usbhid(4) attachment on USB device hotplug. Reported by: Ivan Quitschal <tezeka_AT_hotmail_DOT_com> MFC after: 1 week
2022-07-26Fix unused variable warning in usb's atp.cDimitry Andric
With clang 15, the following -Werror warning is produced: sys/dev/usb/input/atp.c:2018:11: error: variable 'n_vertical_scrolls' set but not used [-Werror,-Wunused-but-set-variable] u_int8_t n_vertical_scrolls = 0; ^ The 'n_vertical_scrolls' variable is no longer used after 197b9a2ef003, so remove it. MFC after: 3 days
2022-06-23uhid(4): Don't read-ahead from the USB IN endpoint.Hans Petter Selasky
This avoids an issue where IN endpoint data received from the device right before the file handle is closed, gets lost. PR: 263995 MFC after: 1 week Sponsored by: NVIDIA Networking
2022-05-06usb: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin
2022-05-06Remove unused hidraw_devclass.John Baldwin
2022-04-18uhid_snes: Remove USB_ST_TRANSFERRED handling for the status request.John Baldwin
The result of the request computed in new_status was never returned to the caller leaving new_status as a set-but-unused variable. Removing new_status leaves sc->previous_status as a write-only variable. Removing sc->previous_status leaves current_status as a write-only variable, so it collapses down to removing the entire USB_ST_TRANSFERRED case. Arguably, all of the support for UHID_SNES_STATUS_DT_RD should be removed as it doesn't return anything to the caller. If the request should be fixed instead then this commit should be reverted and new_status should be returned to whoever submitted the request. Differential Revision: https://reviews.freebsd.org/D34840
2022-04-13usb: Add a __usbdebug_used for variables only used under #ifdef USB_DEBUG.John Baldwin
Use it for various variables only used in DPRINTF debug traces conditional on USB_DEBUG.
2022-04-07atp: Remove unused variable.John Baldwin
2022-04-04wsp_intr_callback: eliminate write only variable hWarner Losh
Sponsored by: Netflix
2022-03-03usbhid(4): Be more restrictive about what requests are allowed from user-space.Hans Petter Selasky
MFC after: 1 month Sponsored by: NVIDIA Networking
2022-03-03usbhid(4): Implement USB_REQUEST command in hid_ioctl methodVladimir Kondratyev
This command is intended to be compatible with USB_REQUEST ioctl. It is required to perform arbitrary control endpoint requests by device drivers which can switch between HID and native non-HID modes. MFC after: 2 month
2021-12-17usb: real freebsd32 support for most ioctlsBrooks Davis
Use thunks or alternative access methods to support ioctls without the COMPAT_32BIT hacks that store pointers in uint64_t's on 32-bit platforms. This should allow a normal i386 libusb to work. On CheriBSD, the sizes of the structs will differ between CheriABI (the default) and freebsd64 no matter what so we need proper compat support there. This change paves the way. Reviewed by: hselasky, jrtc27 (prior version)
2021-09-02wmt(4): Adapt to recent KPI changesVladimir Kondratyev
MFC after: 2 weeks
2021-08-28Fix a common typo in man pages and src commentsGordon Bergling
- s/desciptor/descriptor/ MFC after: 5 days
2021-08-25wsp(4): Add evdev support.Vladimir Kondratyev
Reviewed by: hselasky Tested by: Greg V, Constantin Furst<constantin_AT_fuersten_DOT_info> MFC after: 2 weeks PR: 252236 Differential revision: https://reviews.freebsd.org/D31653
2021-08-25wsp(4): Compact parameter structure.Vladimir Kondratyev
MFC after: 2 weeks