History log of /src/lib/libusb/libusb10.c (Results 1 – 25 of 325)
Revision Date Author Comments
# 38c18332 15-Feb-2026 Baptiste Daroussin <bapt@FreeBSD.org>

libusb: dequeue next transfer on completion to prevent stalls

The transfer proxy callbacks (bulk/interrupt, control, isochronous)
only called libusb10_submit_transfer_sub() in the START path to
pipe

libusb: dequeue next transfer on completion to prevent stalls

The transfer proxy callbacks (bulk/interrupt, control, isochronous)
only called libusb10_submit_transfer_sub() in the START path to
pipeline the second kernel transfer slot. On completion or error,
no attempt was made to dequeue the next pending transfer from
tr_head onto the now-free slot.

When more than two async transfers were submitted on the same
endpoint, the third (and subsequent) transfers would remain stuck
on tr_head indefinitely, since no completion ever triggered their
submission. This caused a protocol-level deadlock in applications
like adb that submit header + payload + zero-length terminator as
three separate bulk transfers in sequence.

Fix by calling libusb10_submit_transfer_sub() after every
libusb10_complete_transfer() in all three proxy callbacks.

MFC After: 2 weeks
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D55289

show more ...


# 87206568 05-Aug-2025 ShengYi Hung <aokblast@FreeBSD.org>

libusb: implement libusb_wrap_sys_device

The libusb_wrap_sys_device function can wrap an opened fd from the
system into a libusb handler. However, in FreeBSD's libusb implementation, a
USB device co

libusb: implement libusb_wrap_sys_device

The libusb_wrap_sys_device function can wrap an opened fd from the
system into a libusb handler. However, in FreeBSD's libusb implementation, a
USB device contains two fds: one for control transfers and another for
normal (bulk, interrupt, isochronous) transfers.

This design makes it impossible for FreeBSD to implement this function
without exposing a different structure in libusb.h to provide two fds.
Therefore, we return LIBUSB_ERROR_NOT_SUPPORTED to maintain API
compatibility.

Approved by: makrj (mentor), lwhsu (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51739

show more ...


# 3eda3493 09-Jul-2025 ShengYi Hung <aokblast@FreeBSD.org>

libusb: implement libusb_fill_bulk_stream_transfer

Bulk streams are essentially bulk transfers with a stream ID. All
requirements from both libusb20 and the kernel are already handled; we
just need

libusb: implement libusb_fill_bulk_stream_transfer

Bulk streams are essentially bulk transfers with a stream ID. All
requirements from both libusb20 and the kernel are already handled; we
just need to set the stream ID.

Approved by: markj (mentor), lwhsu(mentor)
Differential Revision: https://reviews.freebsd.org/D51226

show more ...


# 776e26f5 09-Jul-2025 ShengYi Hung <aokblast@FreeBSD.org>

libusb: implement libusb_dev_mem_{alloc,free}

libusb provides an API to create DMA buffers for USB packets from the
kernel. However, this feature is only available on Linux. On unsupported
platforms

libusb: implement libusb_dev_mem_{alloc,free}

libusb provides an API to create DMA buffers for USB packets from the
kernel. However, this feature is only available on Linux. On unsupported
platforms, the allocation function returns NULL, and the free function
returns 'not supported'.

Approved by: markj (mentor), lwhsu(mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51222

show more ...


# 99d5cf25 12-Jun-2025 ShengYi Hung <aokblast@FreeBSD.org>

libusb: implement libusb_setlocale to support different locale of error message

Upstream libusb identifies languages using only the first two
characters of the language code.
We adopt the same appro

libusb: implement libusb_setlocale to support different locale of error message

Upstream libusb identifies languages using only the first two
characters of the language code.
We adopt the same approach to maintain API compatibility.

Currently, only English and Mandarin are supported,
as other languages are not yet implemented.

Reviewed by: kevans
Approved by: markj (mentor)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50820

show more ...


# bca5df45 04-Jun-2025 ShengYi Hung <aokblast@FreeBSD.org>

libusb: replace LOG_LEVEL with DEBUG_LEVEL

The libusb set debug level by libusb_log_level instead of
libusb_debug_level. We switch to libusb_log_level for better
compatibility with the upstream libu

libusb: replace LOG_LEVEL with DEBUG_LEVEL

The libusb set debug level by libusb_log_level instead of
libusb_debug_level. We switch to libusb_log_level for better
compatibility with the upstream libusb.

Additionally, The upstream libusb has an option allows user to override the log
function with a user-defined callback.
To support the callback function with a single string without va_arg, we
refactor the log facility as a function instead of a macro and parse all
va_args inside.

The legacy debug_level enum has been removed to enforce maintainer migrate from their
deprecated source code.

Reviewed by: kevans
Approved by: markj (mentor), lwhsu (mentor)
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50680

show more ...


# 4c556a4e 12-Jun-2025 Aymeric Wibo <obiwac@gmail.com>

libusb: implement `libusb_get_parent`

Newer versions of drivers such as libwacom (graphics tablets) or
libfprint (fingerprint scanners) call g_usb_device_get_parent. This in
turn calls libusb_get_p

libusb: implement `libusb_get_parent`

Newer versions of drivers such as libwacom (graphics tablets) or
libfprint (fingerprint scanners) call g_usb_device_get_parent. This in
turn calls libusb_get_parent on platforms which implement it, and
returns NULL on platforms that don't. This patch implements this
function on FreeBSD.

Reviewed by: bapt, kevans
Differential Revision: https://reviews.freebsd.org/D46992

show more ...


# f938c0a9 15-May-2025 SHENGYI HUNG <aokblast@FreeBSD.org>

libusb: add SUPER_PLUS in speed enum.

Summary:
Some application(like usbmuxd) start to use LIBUSB_SPEED_SUPER_PLUS now.
Though we don't have the corresponding infra in kernel right now, it is
harmle

libusb: add SUPER_PLUS in speed enum.

Summary:
Some application(like usbmuxd) start to use LIBUSB_SPEED_SUPER_PLUS now.
Though we don't have the corresponding infra in kernel right now, it is
harmless to have this enum value in userspace to prevent the compile error

Reviewed By: bapt
Sponsored By: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50359

show more ...


# ae28929b 15-May-2025 Baptiste Daroussin <bapt@FreeBSD.org>

libusb: use eventfd

Simplify libusb code by replacing pipe(2) inter thread event mecanism
with eventfd(2).

MFC After: 3 weeks
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/

libusb: use eventfd

Simplify libusb code by replacing pipe(2) inter thread event mecanism
with eventfd(2).

MFC After: 3 weeks
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D50360

show more ...


# 9dc96d8b 04-Jan-2025 Baptiste Daroussin <bapt@FreeBSD.org>

libusb: hotplug, use events instead of a timer when possible

Try to fetch events from nlsysevent or devd to determine when
to scan the usb bus for devices addition or removal.
if none are available

libusb: hotplug, use events instead of a timer when possible

Try to fetch events from nlsysevent or devd to determine when
to scan the usb bus for devices addition or removal.
if none are available fallback on the regular timer based (4s)
scanner

if devd socket or netlink socket is closed or error fallback on the
timer based method.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D48300

show more ...


# 2a63c3be 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

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 ...


# 4c6bcffd 26-Jan-2023 Hans Petter Selasky <hselasky@FreeBSD.org>

libusb(3): Implement libusb_init_context() and the needed structures and definitions.

Differential Revision: https://reviews.freebsd.org/D38212
MFC after: 1 week
Sponsored by: NVIDIA Networking


# aa87aa52 02-Oct-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

libusb(3): Implement libusb_interrupt_event_handler() by exposing existing function.

MFC after: 1 week
Sponsored by: NVIDIA Networking


# d94d94e2 02-Mar-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.

The LibUSB v1.0 emulation layer uses pipes internally to signal between
threads. When USB devices are reset, as part of loading firmw

libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.

The LibUSB v1.0 emulation layer uses pipes internally to signal between
threads. When USB devices are reset, as part of loading firmware, SIGPIPE
may happen, and that is expected and should be ignored.

PR: 261891
MFC after: 1 week
Sponsored by: NVIDIA Networking

show more ...


# 6847ea50 11-Jun-2021 Hans Petter Selasky <hselasky@FreeBSD.org>

Improve handling of USB device re-open in the LibUSB v1.x API.

Make sure the "device_is_gone" flag is cleared after every successful open,
so that the "device_is_gone" flag doesn't persist forever.

Improve handling of USB device re-open in the LibUSB v1.x API.

Make sure the "device_is_gone" flag is cleared after every successful open,
so that the "device_is_gone" flag doesn't persist forever.

Found by: sergii.dmytruk@3mdeb.com
PR: 256296
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

show more ...


# 04391da3 09-Jun-2020 Kyle Evans <kevans@FreeBSD.org>

libusb: improve compatibility

Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API.
Descriptions and functionality for these derived from the
documentation at [0]. The current

libusb: improve compatibility

Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API.
Descriptions and functionality for these derived from the
documentation at [0]. The current set of capabilities are all supported by
libusb.

These were detected as missing after updating net/freerdp to 2.1.1, which
attempted to use both.

[0] http://libusb.sourceforge.net/api-1.0/group__libusb__misc.html

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25194

show more ...


# 8b3bc70a 08-Oct-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r352764 through r353315.


# 8495fa08 02-Oct-2019 Kyle Evans <kevans@FreeBSD.org>

libusb: LIBUSB_DEBUG environment variable override of libusb_set_debug

The debug level generally just controls verbosity of libusb for debugging
libusb devices/usage. We allow the environment to set

libusb: LIBUSB_DEBUG environment variable override of libusb_set_debug

The debug level generally just controls verbosity of libusb for debugging
libusb devices/usage. We allow the environment to set the debug level
independent of the application, but the application will always override
this if it explicitly sets the debug level.

Changing the environment is easy, but patching the software to change the
debug level isn't necessarily easy or possible. Further, there's this
write-only debug_fixed variable that would seem to imply that the debug
level should be fixed, but it isn't currently used. Change the logic to use
strtol() so we can detect real 0 vs. conversion failure, then honor
debug_fixed in libusb_set_debug.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21877

show more ...


# 2aaf9152 18-Mar-2019 Alan Somers <asomers@FreeBSD.org>

MFHead@r345275


# ff511f1f 11-Mar-2019 Enji Cooper <ngie@FreeBSD.org>

MFhead@r344996


# 1efeb40d 05-Mar-2019 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix typos in libusb.

Found by: Denis Ahrens <denis@h3q.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies


# c0b5e991 14-Sep-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r338595 through r338689, and resolve conflicts.


# 540c7229 12-Sep-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix issues about cancelling USB transfers in LibUSB when the USB device has
been detached. When a USB device has been detached the kernel file handle
stops responding to commands. USB applications wh

Fix issues about cancelling USB transfers in LibUSB when the USB device has
been detached. When a USB device has been detached the kernel file handle
stops responding to commands. USB applications which continue to run after
the USB device has been detached, depend on LibUSB generated events to tear
down its pending USB transfers. Add code to handle the needed cleanup when
processing the USB transfer(s) fails and prevent new USB transfer(s) from
being submitted.

Found by: Ludovic Rousseau <ludovic.rousseau+freebsd@gmail.com>
PR: 231076
MFC after: 1 week
Approved by: re (gjb)
Sponsored by: Mellanox Technologies

show more ...


# 87206568 05-Aug-2025 ShengYi Hung <aokblast@FreeBSD.org>

libusb: implement libusb_wrap_sys_device

The libusb_wrap_sys_device function can wrap an opened fd from the
system into a libusb handler. However, in FreeBSD's libusb implementation, a
USB device co

libusb: implement libusb_wrap_sys_device

The libusb_wrap_sys_device function can wrap an opened fd from the
system into a libusb handler. However, in FreeBSD's libusb implementation, a
USB device contains two fds: one for control transfers and another for
normal (bulk, interrupt, isochronous) transfers.

This design makes it impossible for FreeBSD to implement this function
without exposing a different structure in libusb.h to provide two fds.
Therefore, we return LIBUSB_ERROR_NOT_SUPPORTED to maintain API
compatibility.

Approved by: makrj (mentor), lwhsu (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51739

show more ...


12345678910>>...13