HomeFreeBSD

libusb: Emit event after deregistering hotplug handler

Description

libusb: Emit event after deregistering hotplug handler

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)

Details

Provenance
aokblastAuthored on May 5 2025, 5:52 PM
emasteCommitted on May 14 2025, 2:23 PM
Reviewer
bapt
Differential Revision
D50170: libusb: emit event when deregister event
Parents
rG3de66f369c1e: sound: Call PCM_RELEASE() if pcm_addchan() fails
Branches
Unknown
Tags
Unknown