History log of /freebsd-current/sys/dev/usb/input/uhid.c
Revision Date Author Comments
# b2caed2f 25-Dec-2023 Mark Johnston <markj@FreeBSD.org>

uhid: Check for errors from copyin() in ioctl handlers

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


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# b61a5730 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD

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


# b6f61525 23-Jun-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

uhid(4): Don't read-ahead from the USB IN endpoint.

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


# bc9372d7 06-May-2022 John Baldwin <jhb@FreeBSD.org>

usb: Remove unused devclass arguments to DRIVER_MODULE.


# a4777bb4 06-May-2022 John Baldwin <jhb@FreeBSD.org>

Remove unused hidraw_devclass.


# 45b48cbc 17-Dec-2021 Brooks Davis <brooks@FreeBSD.org>

usb: real freebsd32 support for most ioctls

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)


# b62f6dfa 12-Jan-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

hid: Replace USBHID_ENABLED kernel config option with loader tunable

usbhid(4) is disabled by default to avoid conflicts with existing USB HID
drivers. To enable it place following lines to /boot/loader.conf:

hw.usb.usbhid.enable=1
usbhid_load="YES"

Suggested by: jhb
Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D28124


# 9be6b22d 12-Dec-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

hidraw(4): Add HIDRAW_MAKE_UHID_ALIAS kernel option

which installs /dev/uhid# alias to hidraw character device for
compatibility with some existing uhid(4) users like Firefox.
As side effect it renames traditional uhid(4) driver to hidraw
to make possible using of common unit number allocator.

Requested by: Greg V <greg_unrelenting.technology>
Reviewed by: hselasky (as part of D27992)


# 01f2e864 08-Oct-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

hid: Import usbhid - USB transport backend for HID subsystem.

This change implements hid_if.m methods for HID-over-USB protocol [1].

Also, this change adds USBHID_ENABLED kernel option which changes
device_probe() priority and adds/removes PnP records to prefer usbhid
over ums, ukbd, wmt and other USB HID device drivers and vice-versa.

The module is based on uhid(4) driver. It is disabled by default for
now due to conflicts with existing USB HID drivers.

[1] https://www.usb.org/sites/default/files/hid1_11.pdf

Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D27893


# eead9017 01-Jan-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

hid: Chase for HID function name changes in existing USB HID drivers

Also hide shim code added in a previous commit under COMPAT_USBHID12.

Note: it is enough to add -DCOMPAT_USBHID12 to CFLAGS to compile old
code with new HID subsystem, but it is not enough to link it at runtime.
HID dependency has to be added explicitly with MODULE_DEPEND macro.

Reviewed by: manu, hselasky (as part of D27887)


# 67de2db2 04-Oct-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

Factor-out hardware-independent part of USB HID support to new module

It will be used by the upcoming HID-over-i2C implementation. Should be
no-op, except hid.ko module dependency is to be added to affected drivers.

Reviewed by: hselasky, manu
Differential revision: https://reviews.freebsd.org/D27867


# c77bfaa7 31-Oct-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).

Submitted by: pedro martelletto <pedro@ambientworks.net>
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking


# 9dd3156e 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

usb: clean up empty lines in .c and .h files


# 94140f47 22-Jul-2020 Mark Johnston <markj@FreeBSD.org>

usb(4): Stop checking for failures from malloc(M_WAITOK).

Handle the fact that parts of usb(4) can be compiled into the boot
loader, where M_WAITOK does not guarantee a successful allocation.

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org> (original version)
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25706


# f8d2b1f3 15-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (2 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked). Use it in
preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Reviewed by: hselasky, kib
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D23632


# 236e308a 10-Nov-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

wmt(4): Add PNP record so it could be picked by devd/devmatch.

Fix uhid(4) conflict with blacklisting of multitouch HID-usages
in uhid(4) probe handler.

Reviewed by: imp
No objections from: hps
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17689


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# f809f280 10-Dec-2015 Warner Losh <imp@FreeBSD.org>

Create a USB_PNP_INFO and use it to export the existing PNP
tables. Some drivers needed some slight re-arrangement of declarations
to accommodate this. Change the USB pnp tables slightly to allow
better compatibility with the system by moving linux driver info from
start of each entry to the end. All other PNP tables in the system
have the per-device flags and such at the end of the elements rather
that at the beginning.

Differential Review: https://reviews.freebsd.org/D3458


# 996f8471 10-Mar-2015 Hans Petter Selasky <hselasky@FreeBSD.org>

Lock softc before clearing bits.

Found by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week


# 620d4f3c 31-Jan-2015 Dimitry Andric <dim@FreeBSD.org>

Fix a bunch of -Wcast-qual warnings in sys/dev/usb/input/uhid.c, by
using __DECONST. No functional change.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D1743


# ece4b0bd 05-Jan-2015 Hans Petter Selasky <hselasky@FreeBSD.org>

Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can
be set before the USB device(s) are probed.


# 817a8cac 13-Jul-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

Turn off blinking device leds at attach.

MFC after: 3 days
PR: 183735


# 61bfd867 30-Jan-2013 Sofian Brabez <sbz@FreeBSD.org>

Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays

Reviewed by: cognet
Approved by: cognet


# 68ea9fd7 21-Oct-2012 Eitan Adler <eadler@FreeBSD.org>

Make uhid attach to devices that look like keyboards
or mice if the quirk which prevents higher level
drivers from attaching is set.

PR: usb/172458
Submitted by: Vitaly Magerya <vmagerya@gmail.com>
Reviewed by: hselasky
Approved by: cperciva
MFC after: 1 week


# 3dfe1a8e 17-May-2012 Alexander Motin <mav@FreeBSD.org>

Fix for the r235558: interrupt output pipe is optional, so fix the driver
attach and operation when it is absent.

Sponsored by: iXsystems, Inc.
MFC after: 1 week


# 3a38def3 17-May-2012 Alexander Motin <mav@FreeBSD.org>

Add support for writing to HID devices through the interrupt output pipe.
Supermicro LCD screen modules seem to not support accessing reports through
the control pipes, but working fine with the interrupt pipes.

Sponsored by: iXsystems, Inc.
MFC after: 1 week


# 6d917491 02-Apr-2012 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after: 1 weeks


# 6472ac3d 07-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# 7778ab7e 28-Sep-2011 Alexander Motin <mav@FreeBSD.org>

MFprojects/hid:
Import the rest of HID improvements from the branch:
- improve report descriptor parser in libusbhid to handle several kinds of
reports same time;
- add to the libusbhid API two functions wrapping respective kernel IOCTLs
for reading and writing reports;
- tune uhid IOCTL interface to allow reading and writing arbitrary report,
when multiple supported by the device;
- teach usbhidctl to set output and feature reports;
- make usbhidaction support all the same item names as bhidctl.

Sponsored by: iXsystems, inc.


# 34e5f64b 02-Jul-2011 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix for "nomatch" event for ums and ukbd drivers when uhid is loaded.

MFC after: 3 days


# f1a16106 23-Jun-2011 Hans Petter Selasky <hselasky@FreeBSD.org>

- Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
host, device or dual mode
- Add generic tool to extract these data:
tools/bus_autoconf

Discussed with: imp
Suggested by: Robert Millan <rmh@debian.org>
PR: misc/157903
MFC after: 14 days


# cd10bffa 18-May-2011 Andriy Gapon <avg@FreeBSD.org>

usb: change to one-pass probing of device drivers

This brings USB bus more in line with how newbus is supposed to be used.
Also, because of the two-pass probing the following message was produced
by devd in default configuration when almost any USB device was
connected:
Unknown USB device: vendor <> product <> bus <>
This should be fixed now.

Note that many USB device drivers pass some information from probe
method to attach method via ivars. For this to continue working we rely
on the fact that the subr_bus code calls probe method of a winning driver
again before calling its attach method in the case where multiple
drivers claim to support a device. This is done because device
description is set in successful probe methods and we want to get a correct
device description from a winning driver. So now this logic is re-used
for setting ivars too.

Reviewed by: hselasky
MFC after: 1 month


# 58ccf5b4 11-Jan-2011 John Baldwin <jhb@FreeBSD.org>

Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by: bde


# 876cab6f 13-Nov-2010 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix compiler warnings.

Submitted by: Alexander Best (arundel)
Approved by: thompsa (mentor)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 910cb8fe 01-Sep-2010 Andrew Thompson <thompsa@FreeBSD.org>

Add missing MODULE_VERSION() definitions, this resolves problems around
duplicate module loads.

PR: usb/125736
Submitted by: danger, mm
Reviewed by: hselasky


# ad658060 29-Apr-2010 Andrew Thompson <thompsa@FreeBSD.org>

MFC r207077

Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.


# b850ecc1 22-Apr-2010 Andrew Thompson <thompsa@FreeBSD.org>

Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after: 1 week


# 7e4b1c06 03-Mar-2010 Joel Dahl <joel@FreeBSD.org>

The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from: NetBSD


# cd3192b3 30-Dec-2009 Andrew Thompson <thompsa@FreeBSD.org>

MFC r200304

If the ID byte is non zero then we allow descriptors having multiple sizes.


# a4ca3864 09-Dec-2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

MFC r199169:

Reduce probe priority of USB input devices to BUS_PROBE_GENERIC from
BUS_PROBE_SPECIFIC. This allows device-specific drivers like atp to
attach reliably.


# 0ca80d71 09-Dec-2009 Andrew Thompson <thompsa@FreeBSD.org>

If the ID byte is non zero then we allow descriptors having multiple sizes.

Submitted by: HPS
Reported by: daichi


# b201cde6 10-Nov-2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Reduce probe priority of USB input devices to BUS_PROBE_GENERIC from
BUS_PROBE_SPECIFIC. This allows device-specific drivers like atp to
attach reliably.

Reviewed by: hps


# ed6d949a 22-Jun-2009 Andrew Thompson <thompsa@FreeBSD.org>

- Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h


# a593f6b8 14-Jun-2009 Andrew Thompson <thompsa@FreeBSD.org>

s/usb2_/usb_|usbd_/ on all function names for the USB stack.


# e0a69b51 29-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

s/usb2_/usb_/ on all typedefs for the USB stack.


# 760bc48e 28-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

s/usb2_/usb_/ on all C structs for the USB stack.


# 9360ae40 20-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

Rename the usb sysctl tree from hw.usb2.* back to hw.usb.*.

Submitted by: Hans Petter Selasky


# f29a0724 20-May-2009 Andrew Thompson <thompsa@FreeBSD.org>

- rename usb2_mode to usb_mode [1]
- change variable types to use the enum

Submitted by: Hans Petter Selasky [1]


# 4eae601e 05-Apr-2009 Andrew Thompson <thompsa@FreeBSD.org>

MFp4 //depot/projects/usb@159909

- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
"usb2_config" has a new field called "usb_mode" which select for which mode
the current xfer entry is active. Options are: a) Device mode only b) Host
mode only (default-by-zero) c) Both modes. This change was scripted using
the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
the code for the function uses less memory than the table itself.

Submitted by: Hans Petter Selasky


# 296ade60 20-Mar-2009 Andrew Thompson <thompsa@FreeBSD.org>

MFp4 //depot/projects/usb @159375,159376,159377

Further remove dependancy towards Giant.

Submitted by: Hans Petter Selasky


# 9aef556d 01-Mar-2009 Andrew Thompson <thompsa@FreeBSD.org>

Rename the ushub device class back to uhub as it was in the old usb stack,
moused(8) looks for "uhub/ums" to decide if needs to load the module.

Reported by: Garrett Cooper


# ee3e3ff5 27-Feb-2009 Andrew Thompson <thompsa@FreeBSD.org>

Change USB over to make_dev() for all device nodes, previously it hooked into
the devfs clone handler to open the (invisible) devices on the fly.

The /dev entries are layed out as follows,

/dev/usbctl = master device
/dev/usb/0.1.0.5 = usb device, (<bus>.<dev>.<iface>.<endpoint>)
/dev/ugen0.1 -> usb/0.1.0.0 = ugen link to ctrl endpoint

This also removes the custom permissions model from USB. Bump
__FreeBSD_version to 800066.

Submitted by: rink (earlier version)


# 02ac6454 23-Feb-2009 Andrew Thompson <thompsa@FreeBSD.org>

Move the new USB stack into its new home.