<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libusb/libusb10_hotplug.c, branch release/14.4.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2025-05-14T14:23:38Z</updated>
<entry>
<title>libusb: Emit event after deregistering hotplug handler</title>
<updated>2025-05-14T14:23:38Z</updated>
<author>
<name>SHENGYI HUNG</name>
<email>aokblast@FreeBSD.org</email>
</author>
<published>2025-05-05T17:52:45Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=641bb44d8538c66446aea556baa22bbf5bd14255'/>
<id>urn:sha1:641bb44d8538c66446aea556baa22bbf5bd14255</id>
<content type='text'>
The original implementation did not emit an event when a hotplug handler
was deregistered. This omission causes issues for programs that follow
the best practices recommended by libusb—particularly those that use
`libusb_hotplug_register_callback()` or similar functions in a loop
while managing hotplug handlers dynamically.

Without emitting an event after deregistration, these programs can
become stuck waiting indefinitely for an event that will never come,
as the condition to break out of the wait loop is never satisfied.

See: https://github.com/libusb/libusb/blob/6c0ae1ab456da49e7805115e77ce0428ace4ea41/libusb/hotplug.c#L459

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

(cherry picked from commit d2852659180307475a8376ce86aa587cccbb10bf)
</content>
</entry>
<entry>
<title>libusb: fix hotplug sigbus</title>
<updated>2025-01-07T09:02:57Z</updated>
<author>
<name>Baptiste Daroussin</name>
<email>bapt@FreeBSD.org</email>
</author>
<published>2025-01-03T09:50:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=58734b18794b772a2f964bf08863808680f0c81a'/>
<id>urn:sha1:58734b18794b772a2f964bf08863808680f0c81a</id>
<content type='text'>
When a hotplug callback has been registered, and the program using
libusb is calling libusb_exit then the thread handler is set to
NO_THREAD which result in the variable controlling the loop the be set
to 0, it does a last pass through device available without having done
a scan, which result in a sigbus after it tried to unregister all the
devices.

directly break the loop instead and cleanup the list of devices

this fixes the tests with LGPLed libusb's hotplugtest program

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

(cherry picked from commit ba5834b8e11fd002a663d083a464e397e76cb3a9)
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line .c comment pattern</title>
<updated>2023-08-16T17:54:29Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=2a63c3be158216222d89a073dcbd6a72ee4aab5a'/>
<id>urn:sha1:2a63c3be158216222d89a073dcbd6a72ee4aab5a</id>
<content type='text'>
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
</content>
</entry>
<entry>
<title>Add missing mutex unlock in failure case.</title>
<updated>2020-01-30T17:30:04Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2020-01-30T17:30:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=cca46c5e6923f0cc869c9263b0a89cb176997a04'/>
<id>urn:sha1:cca46c5e6923f0cc869c9263b0a89cb176997a04</id>
<content type='text'>
Differential Revision:	https://reviews.freebsd.org/D23430
Submitted by:	cem
Reported by:	Coverity
Coverity CID:	1368773
MFC after:	3 days
Sponsored by:	Mellanox Technologies
</content>
</entry>
<entry>
<title>Only call libusb_hotplug_enumerate() once from libusb_hotplug_register_callback().</title>
<updated>2019-06-26T12:04:54Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2019-06-26T12:04:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a5b24a2b65b945f8688ae677e816b1a2c632a39a'/>
<id>urn:sha1:a5b24a2b65b945f8688ae677e816b1a2c632a39a</id>
<content type='text'>
Else when registering multiple filters the same USB device may appear twice in
the list.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
</content>
</entry>
<entry>
<title>Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all</title>
<updated>2019-06-26T11:28:08Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2019-06-26T11:28:08Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a41b0ec1439e4395216539d4ed03eff6760e1e1b'/>
<id>urn:sha1:a41b0ec1439e4395216539d4ed03eff6760e1e1b</id>
<content type='text'>
devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE
flag. Make sure when the flag is not specified no arrival events are
generated for currently enumerated devices.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
</content>
</entry>
<entry>
<title>Implement libusb_hotplug_register_callback() and</title>
<updated>2016-06-22T10:38:41Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2016-06-22T10:38:41Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=7bdc064b0b644d15bd9614d9e7db5c4279736d75'/>
<id>urn:sha1:7bdc064b0b644d15bd9614d9e7db5c4279736d75</id>
<content type='text'>
libusb_hotplug_deregister_callback() for the LibUSB v1.0 API and
update the libusb(3) manual page.

Approved by:	re (kib)
Requested by:	swills
MFC after:	1 week
</content>
</entry>
</feed>
