<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libusb, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>libusb: don't treat EINVAL from USB_FS_COMPLETE as device detach</title>
<updated>2026-06-25T22:58:23+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2026-06-25T22:38:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=240330a85e5f7f5d448123902ebee4136ef221fd'/>
<id>240330a85e5f7f5d448123902ebee4136ef221fd</id>
<content type='text'>
ugen20_process() treats any non-EBUSY errno returned by USB_FS_COMPLETE
as device detach and returns LIBUSB20_ERROR_OTHER. This causes libusb10
to set device_is_gone and fail all subsequent transfer with
LIBUSB_ERROR_NO_DEVICE.

However, USB_FS_COMPLETE can also return EINVAL when a completion
references an endpoint that no longer exists, for example after
SET_INTERFACE or SET_CONFIG removes and recreates endpoints. This is a
transient condition and does not indicate device detach.

Treat EINVAL the same as EBUSY and stop draining completions. This
prevents a guest selecting an isochronous streaming altsetting from
permanently breaking the passed-through device.

Reviewed by:    bapt
Event:          Halifax Hackathon 202606
Location:       Peggy's Cove Rock
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57542
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ugen20_process() treats any non-EBUSY errno returned by USB_FS_COMPLETE
as device detach and returns LIBUSB20_ERROR_OTHER. This causes libusb10
to set device_is_gone and fail all subsequent transfer with
LIBUSB_ERROR_NO_DEVICE.

However, USB_FS_COMPLETE can also return EINVAL when a completion
references an endpoint that no longer exists, for example after
SET_INTERFACE or SET_CONFIG removes and recreates endpoints. This is a
transient condition and does not indicate device detach.

Treat EINVAL the same as EBUSY and stop draining completions. This
prevents a guest selecting an isochronous streaming altsetting from
permanently breaking the passed-through device.

Reviewed by:    bapt
Event:          Halifax Hackathon 202606
Location:       Peggy's Cove Rock
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57542
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: Add missing default in handling option switch</title>
<updated>2026-06-23T14:37:53+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2026-06-23T14:29:57+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=08dca5971b08b65f227883502d9bb9f59eebd578'/>
<id>08dca5971b08b65f227883502d9bb9f59eebd578</id>
<content type='text'>
This makes GCC happy

Fixes:  2879c818e553 ("implement libusb_set_option")
Event:  Halifax Hackathon 202606
Sponsored by:   The FreeBSD Foundation
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes GCC happy

Fixes:  2879c818e553 ("implement libusb_set_option")
Event:  Halifax Hackathon 202606
Sponsored by:   The FreeBSD Foundation
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: Implement libusb_set_log_cb</title>
<updated>2026-06-23T14:28:49+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2026-06-23T14:03:09+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=25c2251064752b0ced310b1ed3795c8a68849b1c'/>
<id>25c2251064752b0ced310b1ed3795c8a68849b1c</id>
<content type='text'>
Reviewed by:    adrian
Event:  Halifax Hackathon 202606
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57770
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:    adrian
Event:  Halifax Hackathon 202606
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57770
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: Implement libusb20_tr_get_flags</title>
<updated>2026-06-22T13:54:31+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2026-06-11T15:39:44+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1a8701e2e9a97cabb18ed58d236382796d7f7aa7'/>
<id>1a8701e2e9a97cabb18ed58d236382796d7f7aa7</id>
<content type='text'>
Reviewed by:    adrian, bapt
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57543
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:    adrian, bapt
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57543
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: Bump manual date for multiple changes</title>
<updated>2026-06-22T13:36:48+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2026-06-22T13:32:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d928113eaadaeb9ab821a2a5b6f08159f1ce8d76'/>
<id>d928113eaadaeb9ab821a2a5b6f08159f1ce8d76</id>
<content type='text'>
Sponsored by:   The FreeBSD Foundation
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:   The FreeBSD Foundation
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: implement zlp flag in libusb transfer</title>
<updated>2026-06-22T13:36:48+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2025-08-06T12:48:05+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d84b639a684e7e0640e7c24a1a6dbc09da4bc3d4'/>
<id>d84b639a684e7e0640e7c24a1a6dbc09da4bc3d4</id>
<content type='text'>
The USB protocol defines a Zero-Length Packet (ZLP) to signal the end of
a transfer when the data size is an exact multiple of the Maximum Packet
Size (MPS). Without a ZLP in such cases, the device may not be able to
determine that the transfer has completed.

This flag is added to libusb to allow the user send a ZLP in the end
of libusb_xfer.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundataion
Differential Revision: https://reviews.freebsd.org/D51759
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The USB protocol defines a Zero-Length Packet (ZLP) to signal the end of
a transfer when the data size is an exact multiple of the Maximum Packet
Size (MPS). Without a ZLP in such cases, the device may not be able to
determine that the transfer has completed.

This flag is added to libusb to allow the user send a ZLP in the end
of libusb_xfer.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundataion
Differential Revision: https://reviews.freebsd.org/D51759
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: implement libusb_get_max_alt_packet_size</title>
<updated>2026-06-22T13:36:47+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2025-07-09T10:49:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=964823a18e116e86c05e1d6a6fd80b1bb3274e57'/>
<id>964823a18e116e86c05e1d6a6fd80b1bb3274e57</id>
<content type='text'>
The libusb has a function to calculate the size from given interface,
alt_setting, endpoint. Implementing it by refactoring the calculating
function for libusb_get_max_iso_packet_size.

Reviewed by:    adrian
Sponsored By:   FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51225
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The libusb has a function to calculate the size from given interface,
alt_setting, endpoint. Implementing it by refactoring the calculating
function for libusb_get_max_iso_packet_size.

Reviewed by:    adrian
Sponsored By:   FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51225
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: refactor the process of setting option when init the context.</title>
<updated>2026-06-22T13:36:47+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2025-07-09T09:36:07+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=be95871347a85f6feac59d036f62182fce847f23'/>
<id>be95871347a85f6feac59d036f62182fce847f23</id>
<content type='text'>
From
https://github.com/libusb/libusb/commit/6622f386f52807dac76c8a260c98aa02c311bc93#diff-c1f9bc250077d41456a3e580fca0ddf5d8c25b741bff6d9b9505990a8b70b254R2358.
We are able to set all of the option from the init_context. To address
this, we modify the process of setting option in init_context to make it be more clear and then
adapat libusb_set_option inside to all other option.

Reviewed by:    adrian
Sponsored By:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51224
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
From
https://github.com/libusb/libusb/commit/6622f386f52807dac76c8a260c98aa02c311bc93#diff-c1f9bc250077d41456a3e580fca0ddf5d8c25b741bff6d9b9505990a8b70b254R2358.
We are able to set all of the option from the init_context. To address
this, we modify the process of setting option in init_context to make it be more clear and then
adapat libusb_set_option inside to all other option.

Reviewed by:    adrian
Sponsored By:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51224
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: implement libusb_set_option</title>
<updated>2026-06-22T13:36:47+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2025-06-11T19:07:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=2879c818e5535e9c9dc592714c7d4ef0c1c9e8c1'/>
<id>2879c818e5535e9c9dc592714c7d4ef0c1c9e8c1</id>
<content type='text'>
Implement libusb_set_option for API compatibility of libusb upstream
The implementation status of each option is as following:

LIBUSB_OPTION_LOG_LEVEL: just like libusb_set_debug
LIBUSB_OPTION_LOG_CB: add callback support for DPRINTF
LIBUSB_OPTION_NO_DEVICE_DISCOVERY: disable initialization of devd and
netlink when register. Also, create no thread when registration of
callback happens.
LIBUSB_OPTION_USE_USBDK: no needed as USBDK is for Windows

Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50818
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement libusb_set_option for API compatibility of libusb upstream
The implementation status of each option is as following:

LIBUSB_OPTION_LOG_LEVEL: just like libusb_set_debug
LIBUSB_OPTION_LOG_CB: add callback support for DPRINTF
LIBUSB_OPTION_NO_DEVICE_DISCOVERY: disable initialization of devd and
netlink when register. Also, create no thread when registration of
callback happens.
LIBUSB_OPTION_USE_USBDK: no needed as USBDK is for Windows

Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50818
</pre>
</div>
</content>
</entry>
<entry>
<title>libusb: implement IAD parser</title>
<updated>2026-06-22T13:36:47+00:00</updated>
<author>
<name>ShengYi Hung</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2025-06-11T17:24:04+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ae489991d1c0b550ead309abc1eade3b185e7499'/>
<id>ae489991d1c0b550ead309abc1eade3b185e7499</id>
<content type='text'>
libusb provide functions to parse interface association descriptor. This
descriptor indicates that a function is composed by multiple interface
and which interfaces is associate to the target function. This
descriptor is not a separate USB require, instead, it comes with the
config descriptor.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50958
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libusb provide functions to parse interface association descriptor. This
descriptor indicates that a function is composed by multiple interface
and which interfaces is associate to the target function. This
descriptor is not a separate USB require, instead, it comes with the
config descriptor.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50958
</pre>
</div>
</content>
</entry>
</feed>
