History log of /src/sys/dev/usb/usb_generic.c (Results 1 – 25 of 191)
Revision Date Author Comments
# 37e3b664 17-Aug-2025 Vladimir Kondratyev <wulf@FreeBSD.org>

usbhid(4): Implement USB_GET_DEVICEINFO ioctl

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 string

usbhid(4): Implement USB_GET_DEVICEINFO ioctl

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

show more ...


# 8f374fa5 19-Feb-2024 Andriy Gapon <avg@FreeBSD.org>

ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver

Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached. That's because a device(9) still
remain

ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver

Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached. That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43960

show more ...


# 71625ec9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

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

Remove /^/[*/]\s*\$FreeBSD\$.*\n/


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

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

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

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

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

show more ...


# 9b077d72 31-Mar-2023 Hans Petter Selasky <hselasky@FreeBSD.org>

usb(4): Separate the fast path and the slow path to avoid races and use-after-free for the USB FS interface.

Bad behaving user-space USB applicatoins may crash the kernel by issuing
USB FS related i

usb(4): Separate the fast path and the slow path to avoid races and use-after-free for the USB FS interface.

Bad behaving user-space USB applicatoins may crash the kernel by issuing
USB FS related ioctl(2)'s out of their expected order. By default
the USB FS ioctl(2) interface is only available to the
administrator, root, and driver applications like webcamd(8) needs
to be hijacked in order for this to happen.

The issue is the fast-path code does not always see updates made
by the slow-path code, and may then work on freed memory.

This is easily fixed by using an EPOCH(9) type of synchronization
mechanism. A SX(9) lock will be used as a substitute for EPOCH(9),
due to the need for sleepability. In addition most calls going into
the fast-path originate from a single user-space process and the
need for multi-thread performance is not present.

Differential Revision: https://reviews.freebsd.org/D39373
Reviewed by: markj@
Reported by: C Turt <ecturt@gmail.com>
admbugs: 994
MFC after: 1 week
Sponsored by: NVIDIA Networking

show more ...


# 03a2e432 04-Apr-2023 Hans Petter Selasky <hselasky@FreeBSD.org>

usb(4): Code refactoring as a pre-step for adding missing synchronization mechanism.

Move code in switch cases into own functions to make later changes easier to track.

No functional change, except

usb(4): Code refactoring as a pre-step for adding missing synchronization mechanism.

Move code in switch cases into own functions to make later changes easier to track.

No functional change, except for removing a superfluous break statement when
range checking USB_FS_MAX_FRAMES, in the USB_FS_OPEN case.
It should not have been there at all.

Suggested by: emaste@
MFC after: 1 week
Sponsored by: NVIDIA Networking

show more ...


# 62d42655 07-Oct-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

usb(4): Substitute "unsigned int" using the equivalent and shorter "unsigned" keyword.

MFC after: 1 week
Sponsored by: NVIDIA Networking


# 8ed5bb59 03-Mar-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

usb(4): Factor out the usb_check_request() function.

No functional change.

MFC after: 1 week
Sponsored by: NVIDIA Networking


# 8b60419b 18-Dec-2021 Hans Petter Selasky <hselasky@FreeBSD.org>

usb(4): Fix build on 32-bit platforms after 0ec590d24e415dd36e38648630a0b963412ad87e.

Cast pointer to "long" for now, to match the fueword() prototype.

MFC after: 1 week
Sponsored by: NVIDIA Networ

usb(4): Fix build on 32-bit platforms after 0ec590d24e415dd36e38648630a0b963412ad87e.

Cast pointer to "long" for now, to match the fueword() prototype.

MFC after: 1 week
Sponsored by: NVIDIA Networking

show more ...


# 0ec590d2 17-Dec-2021 Brooks Davis <brooks@FreeBSD.org>

usb: add 32-bit compat for FIFOs

Unlike most 32-bit compatability code, this isn't just a simple thunk
in the ioctl code. An ioctl (USB_FS_INIT) is used to install a
pointer to an array of usb_fs_e

usb: add 32-bit compat for FIFOs

Unlike most 32-bit compatability code, this isn't just a simple thunk
in the ioctl code. An ioctl (USB_FS_INIT) is used to install a
pointer to an array of usb_fs_endpoint structs which are then used
by the ugen fifo code. These struct contains an array of pointers
which requires translation. We change the interfaces around
struct usb_fs_endpoint as follows:
- We store the size of struct usb_fs_endpoint in struct usb_fifo
in the USB_FS_INIT handler so we know the ABI of the userspace
array.
- APIs to manipulate userspace struct usb_fs_endpoint objects now
take a struct usb_fifo and an index rather than a pointer to
the object. This allows most code to remain oblivious to the
different struct usb_fs_endpoint sizes.
- Add ugen_fs_copyin() which copies the struct usb_fs_endpoint
from userspace, thunking it to the native size if required.
- Uses of struct usb_fs_endpoint's ppBuffer member are now
via ugen_fs_getbuffer() which produces a native pointer.
- Updates to userspace are now handled by ugen_fs_update().

For clarity, single, fixed-sized members now are accessed with
fueword/suword rather than copyin/copyout.

Reviewed by: hselasky, jrtc27 (prior version)

show more ...


# 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 sho

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)

show more ...


# 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


# c7aa572c 31-Jul-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# 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:

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

show more ...


# b33a8b38 16-Feb-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r357966 through r357999.


# 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 marke

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

show more ...


# 7082625d 27-Dec-2019 Hans Petter Selasky <hselasky@FreeBSD.org>

Make USB statistics per device instead of per bus.

Bump the FreeBSD version due to structure change to
force recompilation of external USB modules.

MFC after: 1 week
Sponsored by: Mellanox Technolo

Make USB statistics per device instead of per bus.

Bump the FreeBSD version due to structure change to
force recompilation of external USB modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

show more ...


# 0269ae4c 06-Jun-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @348740

Sponsored by: The FreeBSD Foundation


# 9ccaf221 04-Jun-2019 Hans Petter Selasky <hselasky@FreeBSD.org>

In usb(4) fix a lost completion event issue towards libusb(3). It may happen
if a USB transfer is cancelled that we need to fake a completion event.
Implement missing support in ugen_fs_copy_out() to

In usb(4) fix a lost completion event issue towards libusb(3). It may happen
if a USB transfer is cancelled that we need to fake a completion event.
Implement missing support in ugen_fs_copy_out() to handle this.

This fixes issues with webcamd(8) and firefox.

MFC after: 3 days
Sponsored by: Mellanox Technologies

show more ...


# fdb955f5 03-Jan-2019 Hans Petter Selasky <hselasky@FreeBSD.org>

Improve USB generic debug messages. Print process ID and name when opening
and closing usb/ugenX.Y character device nodes.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 37e3b664 17-Aug-2025 Vladimir Kondratyev <wulf@FreeBSD.org>

usbhid(4): Implement USB_GET_DEVICEINFO ioctl

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 string

usbhid(4): Implement USB_GET_DEVICEINFO ioctl

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

show more ...


# 8f374fa5 19-Feb-2024 Andriy Gapon <avg@FreeBSD.org>

ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver

Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached. That's because a device(9) still
remain

ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver

Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached. That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43960

show more ...


# 71625ec9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

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

Remove /^/[*/]\s*\$FreeBSD\$.*\n/


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

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

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

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

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

show more ...


12345678