aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/input
Commit message (Collapse)AuthorAgeFilesLines
* usbhid(4): Implement USB_GET_DEVICEINFO ioctlVladimir Kondratyev2025-08-171-0/+4
| | | | | | | | | | 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
* hidraw(4): Rename to uhid if HIDRAW_MAKE_UHID_ALIAS is specifiedVladimir Kondratyev2025-08-171-6/+0
| | | | | | | 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
* hid: Add HQ_NO_READAHEAD quirk and implement it in usbhid(4)Vladimir Kondratyev2025-08-171-1/+3
| | | | | | | | | | | 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
* usbhid: Enable by defaultEd Maste2025-07-301-1/+1
| | | | | | | | | 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
* wsp: Fix whitespacesJoshua Rogers2025-03-071-9/+11
| | | | Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
* wsp: Rename max_finger_area sysctl to max_finger_diameterJoshua Rogers2025-03-071-9/+9
| | | | | | The value of this sysctl is not an area, but a maximum diameter. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
* wsp: Handle horizontal scrolling and create tunable for swipe/scroll.Joshua Rogers2025-03-071-31/+82
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* wsp: Fix typo in function name.Joshua Rogers2025-03-071-2/+2
| | | | Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu>
* wsp: Add hw.usb.wsp.max_scroll_finger_distance for two-finger scrollingJoshua Rogers2025-03-071-2/+7
| | | | | | | | | | | | | | | 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>
* wsp: Raise the default scr_hor_threshold sysctl.Joshua Rogers2025-03-071-1/+1
| | | | | | | 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>
* usb: Kill left-over cdefs.h includesWarner Losh2025-03-047-7/+0
| | | | | | | | | 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
* Use bus_generic_detach instead of device_delete_children in detachJohn Baldwin2025-01-021-1/+5
| | | | | | | 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
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-061-6/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* uhid(4): update ugd_actlen in USB_GET_REPORT ioctlMatthew Nygard Dodd2024-11-181-1/+3
| | | | | | | | | 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
* ukbd: Enable ukbd_apple_swap for all Apple ISO keyboardsFrank Hilgendorf2024-11-071-6/+66
| | | | | | | | | | | | | | 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
* wsp: Use already-calculated distance of fingers for comparison.Joshua Rogers2024-09-061-3/+1
| | | | | | | | | 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
* wsp: Improve multi-finger touchpad usage and allow more configurationsJoshua Rogers2024-09-061-29/+56
| | | | | | | | | | | | | | | | | | | | 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
* wsp: Allow the trackpad to be used after a partially unreleased click.Joshua Rogers2024-09-061-2/+8
| | | | | | | | | | 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
* newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh2024-07-251-1/+1
| | | | Sponsored by: Netflix
* ums(4): fix incorrect mouse button reporting via evdevNiko Sonack2024-07-021-2/+3
| | | | | | | | | | 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
* uhid: Check for errors from copyin() in ioctl handlersMark Johnston2023-12-262-12/+16
| | | | | | | | | 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
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-167-14/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* hid: Add child device parameter to HID methodsVladimir Kondratyev2023-08-031-16/+21
| | | | | | | | | 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
* kbd: consolidate kb interfaces (phase one)Michael2023-07-071-8/+2
| | | | | | | | | | | | | | 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
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-05-123-3/+3
| | | | | | | | | 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
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-126-6/+6
| | | | | | | | | 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
* sys/kbio.h: make pre-unicode keymap support optionalStefan Eßer2023-02-141-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Support Unicode characters in keymap dead key tablesStefan Eßer2023-02-061-0/+1
| | | | | | | | | | | | | | | | | | | 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
* wmt: purge EOL release compatibilityElliott Mitchell2023-02-041-12/+0
| | | | | | | | Remove FreeBSD 11 support Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/603 Differential Revision: https://reviews.freebsd.org/D35560
* ums(4): Disable vendor usage page button supportVladimir Kondratyev2022-12-241-6/+12
| | | | | | | | | | | 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
* atp: Fix mismatch in array bounds.John Baldwin2022-12-071-1/+2
| | | | | | Reported by: GCC -Warray-parameter Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D37552
* evdev: Extend EVIOCGRAB ioctl scope to cover kbd interfaceVladimir Kondratyev2022-11-181-0/+4
| | | | | | | | | | | | | | 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
* evdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interfaceVladimir Kondratyev2022-11-171-0/+4
| | | | | | | | | | | | | 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
* usbhid(4): Increase probe priority to BUS_PROBE_DEFAULT + 1Vladimir Kondratyev2022-09-111-1/+1
| | | | | | | | | | | | 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
* Fix unused variable warning in usb's atp.cDimitry Andric2022-07-261-3/+0
| | | | | | | | | | | | | 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
* uhid(4): Don't read-ahead from the USB IN endpoint.Hans Petter Selasky2022-06-231-0/+6
| | | | | | | | | 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
* usb: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-069-32/+8
|
* Remove unused hidraw_devclass.John Baldwin2022-05-061-1/+1
|
* uhid_snes: Remove USB_ST_TRANSFERRED handling for the status request.John Baldwin2022-04-181-9/+0
| | | | | | | | | | | | | | | | 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
* usb: Add a __usbdebug_used for variables only used under #ifdef USB_DEBUG.John Baldwin2022-04-131-1/+1
| | | | | Use it for various variables only used in DPRINTF debug traces conditional on USB_DEBUG.
* atp: Remove unused variable.John Baldwin2022-04-081-2/+0
|
* wsp_intr_callback: eliminate write only variable hWarner Losh2022-04-051-3/+0
| | | | Sponsored by: Netflix
* usbhid(4): Be more restrictive about what requests are allowed from user-space.Hans Petter Selasky2022-03-031-1/+4
| | | | | MFC after: 1 month Sponsored by: NVIDIA Networking
* usbhid(4): Implement USB_REQUEST command in hid_ioctl methodVladimir Kondratyev2022-03-021-0/+31
| | | | | | | | 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
* usb: real freebsd32 support for most ioctlsBrooks Davis2021-12-172-6/+45
| | | | | | | | | | | | 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)
* wmt(4): Adapt to recent KPI changesVladimir Kondratyev2021-09-021-75/+61
| | | | MFC after: 2 weeks
* Fix a common typo in man pages and src commentsGordon Bergling2021-08-281-1/+1
| | | | | | - s/desciptor/descriptor/ MFC after: 5 days
* wsp(4): Add evdev support.Vladimir Kondratyev2021-08-241-20/+285
| | | | | | | | 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
* wsp(4): Compact parameter structure.Vladimir Kondratyev2021-08-241-199/+96
| | | | MFC after: 2 weeks