From nobody Sun Feb 15 18:01:41 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fDYd20gLdz6S0lk for ; Sun, 15 Feb 2026 18:01:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fDYd16kxxz3t26 for ; Sun, 15 Feb 2026 18:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771178502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7IobuN25zvkRmlpYo5QR7/yM3J5612t9qYA+SWPVl/0=; b=YRS7spxgjXjRjGuZdbzHPOM/bGbF6bZ7uBQ238xfU5FaKKj2uMIyS9hy3Txkdvbjdr8apg xtIh7zpcUx7vN1N8OhwdOS6Y0vfBkxVj2DRRRxwTU1179HMB+hOXNn5F2L9Ichix65YS5w W7x9vcMfP5trYk7DD0wj1S6dnq+capNTE7kGbm11/J2kWHQyfAaReKoE835vkeIT/xhPWV ODcHKkuMw0cgJwanBb0RLs5MMfiTWreZTgrAsj85jjRpPjzuRl7zMhdGU4OQK4hvmX2Uo/ 8Sh9BPKZaD7W8M5Ogw0udo8F+y4lWN9XrPad7NcWlM/NTPiv2tqL/HWYEF9J1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771178502; a=rsa-sha256; cv=none; b=voMjTY6DRpiUe3uuP0d3aA/Xmg5bOMJQKbxQrfLylKIVo1zGK0XRDjUUOAfCf57eWiKYLz LdJ9HC0Cr2xwn0oDI188iZwj+WNYYmUUt1HGQJN7I+kdBE/usE7pgRplMq9F0U4pGUe4f4 Xa3n8mCG4UlfiP595nrEdCGOJy4cwYiXYAJIJU0CHDHoAnK59H5DKfZMlxRGmpoNGSsoPm GbiXMtm7auDqL9C0nSWyY1GFoV/eGXpx4B7stNxckxajrPT+7SajNoTyhg7HTXLG7X9OhJ rM895V4Gog2fwXqHh3p1QP45/jcGXmDpdlj4mgcLYKpQOJs4+AbJGk23vJATFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771178502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7IobuN25zvkRmlpYo5QR7/yM3J5612t9qYA+SWPVl/0=; b=jRhQNSfJJzE1M1OrfG7CsO406wGnzbg2qjTfCcUIji8eMyJ8Te+s5sIqUT5J5YF49fd044 0mAiqo8d2XaEalMFDvM39mjpPx7TkqzILg1hmlJlkoph18nlB0e2B8vVhD5OYtN40wYBIf IEfmOUs3e9pkTmRNC5aI8r/WIWqyehM3OOqWOI6O2oAdBRCnl89MIYjQ40S6DqiCnQlVMz PRLUgyHz6vakSxnw31fiqUmBSJKUQSPWp5aHMItSrlYJ89ZV8K0y1tWoFSwaNcQ4NcbC/N OyaKXBb94Agfmv90HOlouURYFYiaLvIzYevvU2onFY0VKAvIjmnf71MSqBIQRQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fDYd167lFz143M for ; Sun, 15 Feb 2026 18:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 363ba by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 15 Feb 2026 18:01:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Rick Parrish From: Alexander Ziaee Subject: git: caf23c8e0b79 - main - libusb20: Add dev_open + be_device_foreach manuals List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: caf23c8e0b7981dd022c52feaf6edfef232f7e27 Auto-Submitted: auto-generated Date: Sun, 15 Feb 2026 18:01:41 +0000 Message-Id: <69920a05.363ba.36f95e1@gitrepo.freebsd.org> The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=caf23c8e0b7981dd022c52feaf6edfef232f7e27 commit caf23c8e0b7981dd022c52feaf6edfef232f7e27 Author: Rick Parrish AuthorDate: 2026-02-15 17:45:21 +0000 Commit: Alexander Ziaee CommitDate: 2026-02-15 18:00:28 +0000 libusb20: Add dev_open + be_device_foreach manuals Manual pages for libusb20_open(3) and libusb20_be_device_foreach(3). PR: 291675 MFC after: 3 days Reviewed by: adrian (usb), ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D54231 --- lib/libusb/Makefile | 6 +-- lib/libusb/libusb20_be_device_foreach.3 | 56 ++++++++++++++++++++++++++ lib/libusb/libusb20_dev_open.3 | 69 +++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 4 deletions(-) diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index 4a0c392f0d8f..b3ef5a061584 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -1,5 +1,4 @@ # -# # Makefile for the FreeBSD specific LibUSB 2.0 # @@ -11,7 +10,8 @@ SRCS+= libusb20_desc.c SRCS+= libusb20_ugen20.c INCS+= libusb20.h INCS+= libusb20_desc.h -MAN= libusb.3 libusb20.3 +MAN= libusb.3 libusb20.3 libusb20_be_device_foreach.3 \ + libusb20_dev_open.3 MKLINT= no NOGCCERROR= PTHREAD_LIBS?= -lpthread @@ -229,7 +229,6 @@ MLINKS += libusb20.3 libusb20_dev_set_config_index.3 MLINKS += libusb20.3 libusb20_dev_get_debug.3 MLINKS += libusb20.3 libusb20_dev_get_fd.3 MLINKS += libusb20.3 libusb20_dev_kernel_driver_active.3 -MLINKS += libusb20.3 libusb20_dev_open.3 MLINKS += libusb20.3 libusb20_dev_process.3 MLINKS += libusb20.3 libusb20_dev_request_sync.3 MLINKS += libusb20.3 libusb20_dev_req_string_sync.3 @@ -261,7 +260,6 @@ MLINKS += libusb20.3 libusb20_be_get_quirk_name.3 MLINKS += libusb20.3 libusb20_be_add_dev_quirk.3 MLINKS += libusb20.3 libusb20_be_remove_dev_quirk.3 MLINKS += libusb20.3 libusb20_be_alloc_default.3 -MLINKS += libusb20.3 libusb20_be_device_foreach.3 MLINKS += libusb20.3 libusb20_be_dequeue_device.3 MLINKS += libusb20.3 libusb20_be_enqueue_device.3 MLINKS += libusb20.3 libusb20_be_free.3 diff --git a/lib/libusb/libusb20_be_device_foreach.3 b/lib/libusb/libusb20_be_device_foreach.3 new file mode 100644 index 000000000000..bc741813ddb0 --- /dev/null +++ b/lib/libusb/libusb20_be_device_foreach.3 @@ -0,0 +1,56 @@ +.\" +.\" Copyright (c) 2025 Rick Parrish +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd December 14, 2025 +.Dt LIBUSB20 3 +.Os +.Sh NAME +.Nm libusb20_be_device_foreach +.Nd iterate connected USB devices +.Sh SYNOPSIS +.Lb libusb +.In libusb20.h +.Ft struct libusb20_device * +.Fn libusb20_be_device_foreach "struct libusb20_backend *pbe" "struct libusb20_device *pdev" +.Sh DESCRIPTION +The +.Nm +function iterates connected USB devices, one device at a time. +A backend pointer for +.Fa pbe +may be obtained by calling +.Xr libusb20_be_alloc_default 3 . +The starting value of +.Fa pdev +is NULL. +Calling +.Nm libusb20_be_device_foreach +again with +.Fa pdev +set to the return value of the previous call yields the next device. +To begin interacting with a USB device, pass the pointer in a call to +.Xr libusb20_dev_open 3 . +.Sh RETURN VALUES +.Nm +returns NULL for end of list. +Otherwise this is a pointer to the next device. +.Sh EXAMPLES +.Bd -literal + #include + 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); +.Ed +.Sh SEE ALSO +.Xr libusb20 3 , +.Xr libusb20_be_alloc_default 3 , +.Xr libusb20_be_free 3 , +.Xr libusb20_dev_open 3 diff --git a/lib/libusb/libusb20_dev_open.3 b/lib/libusb/libusb20_dev_open.3 new file mode 100644 index 000000000000..fa5d1746ff23 --- /dev/null +++ b/lib/libusb/libusb20_dev_open.3 @@ -0,0 +1,69 @@ +.\" +.\" Copyright (c) 2025 Rick Parrish +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd December 14, 2025 +.Dt LIBUSB20 3 +.Os +.Sh NAME +.Nm libusb20_dev_open +.Nd open a USB device to retrieve descriptors and initiate transfers +.Sh SYNOPSIS +.Lb libusb +.In libusb20.h +.Ft int +.Fn libusb20_dev_open "struct libusb20_device *pdev" "uin16_t transfer_max" +.Sh DESCRIPTION +The +.Nm +function opens a USB device to retrieve descriptors and initiate transfers. +.Nm +accepts a pointer as +.Fa pdev +to a libusb20_device obtained from +.Nm libusb20_be_device_foreach . +A zero for +.Fa transfer_max +limits the device to only control transfers. +Call +.Xr libusb20_dev_close 3 +to free resources taken by the open device handle. +.Sh RETURN VALUES +.Nm +returns one of the following to report success or failure: +.Pp +.Bl -tag -width "LIBUSB20_ERROR_NO_DEVICE," -compact +.It Er LIBUSB20_SUCCESS , +The operation succeeds. +.It Er LIBUSB20_ERROR_BUSY , +The device is in use elsewhere. +.It Er LIBUSB20_ERROR_ACCESS , +A permissions issue. +.It Er LIBUSB20_ERROR_NO_DEVICE , +The device detached. +.It Er LIBUSB20_ERROR_NO_MEM +The library couldn't allocate memory. +.El +.Pp +Errors not listed here may be found in +.Xr libusb20 3 +and +.In libusb20.h . +.Sh EXAMPLES +.Bd -literal + #include + 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); +.Ed +.Sh SEE ALSO +.Xr libusb20 3 , +.Xr libusb20_be_device_foreach 3 , +.Xr libusb20_dev_close 3