LIBUSB20(3) Library Functions Manual LIBUSB20(3) NAME libusb20_be_device_foreach -- iterate connected USB devices SYNOPSIS libusb #include <libusb20.h> struct libusb20_device * libusb20_be_device_foreach(struct libusb20_backend *pbe, struct libusb20_device *pdev); DESCRIPTION The libusb20_be_device_foreach function iterates connected USB devices, one device at a time. A backend pointer for pbe may be obtained by calling libusb20_be_alloc_default(3). The starting value of pdev is NULL. Calling libusb20_be_device_foreach again with pdev set to the return value of the previous call yields the next device. To begin interacting with a USB de- vice, pass the pointer in a call to libusb20_dev_open(3). RETURN VALUES libusb20_be_device_foreach returns NULL for end of list. Otherwise this is a pointer to the next device. EXAMPLES #include <libusb20.h> struct libusb20_backend *be = libusb20_be_alloc_default(); struct libusb20_device *device = NULL; while ( (device = libusb20_be_device_foreach(be, device)) != NULL ) { if (libusb20_dev_open(device, 0) == LIBUSB20_SUCCESS) { /* do something */ libusb20_dev_close(device); } } libusb20_be_free(be); SEE ALSO libusb20(3), libusb20_be_alloc_default(3), libusb20_be_free(3), libusb20_dev_open(3) FreeBSD 15.1 December 14, 2025 LIBUSB20(3)
NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | EXAMPLES | SEE ALSO
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=libusb20_be_device_foreach&sektion=3&manpath=FreeBSD+15.1-RELEASE+and+Ports.quarterly>
