aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/libusb10_hotplug.c
Commit message (Collapse)AuthorAgeFilesLines
* libusb: implement libusb_hotplug_get_user_dataShengYi Hung2025-07-211-0/+18
| | | | | | | | | | libusb provides a function to get the callback userdata for a given callback since this structure is opaque to libusb user. Approved by: markj (mentor), lwhsu (mentor) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51223
* libusb: consider bad fd as a broken eventSHENGYI HUNG2025-06-251-0/+2
| | | | | | | | | | | Application can use libusb_get_pollfds to get pollfds from libusb then close the fd themselves. This cause the hotplug thread unable to leave because it will be consider as a invalid event then loop forever instead of a broken event that should be quit immediately. Reviewed by: bapt Sponsored by: FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50959
* libusb: Fix netlink sysevent multicast group nameSHENGYI HUNG2025-06-121-1/+1
| | | | | Reviewed by: hrs Differential Revision: https://reviews.freebsd.org/D50739
* libusb: Emit event after deregistering hotplug handlerSHENGYI HUNG2025-05-081-0/+1
| | | | | | | | | | | | | | | | | | 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
* libusb: use the new snl_get_genl_mcast_groupBaptiste Daroussin2025-01-161-15/+5
|
* libusb: hotplug, use events instead of a timer when possibleBaptiste Daroussin2025-01-161-1/+172
| | | | | | | | | | | | | 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
* libusb: fix hotplug sigbusBaptiste Daroussin2025-01-041-9/+12
| | | | | | | | | | | | | | | | | 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
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Add missing mutex unlock in failure case.Hans Petter Selasky2020-01-301-1/+3
| | | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D23430 Submitted by: cem Reported by: Coverity Coverity CID: 1368773 MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=357298
* Only call libusb_hotplug_enumerate() once from ↵Hans Petter Selasky2019-06-261-3/+3
| | | | | | | | | | | | | libusb_hotplug_register_callback(). Else when registering multiple filters the same USB device may appear twice in the list. MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=349410
* Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently allHans Petter Selasky2019-06-261-11/+22
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=349409
* Implement libusb_hotplug_register_callback() andHans Petter Selasky2016-06-221-0/+237
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 Notes: svn path=/head/; revision=302080