From nobody Tue Jul 8 15:12:40 2025 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 4bc4NS6nskz6175L; Tue, 08 Jul 2025 15:12:40 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bc4NS54r1z3JTw; Tue, 08 Jul 2025 15:12:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751987560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vu/IZjMMnpzDYYMqaAHjuV6erZj/FIILVmMjHRYMSoM=; b=qYrUA5lpJljEqmkz1O95cxlodvwKoT7b63ORkxAAcH2InXWAaQfIlAuftzyTX7VQZAD+2B XCzgP58ShaR8GR3vY/HQZEdUFbnfOojmntd5I4BpO8hPhr75lykKckE+x5uo/e5k7obC2t sMHiwHaDOeDRnP3cdjJByd0w2Dx/FJfd+lRqFvLkXJeVlsn4Erv7hGaX+EFZ2O6vyiW0ju 0wbKGoQsuXuank8opqLSCCYcNBkQPX51ureWrtmo3zlzR+J0wvQ3eaZ6RFhbztAY2cCjsR rw5b0FE7Yn6MAlUaX7dc6d3gR8I6t8V4vPokl/fKpK3KOw6IT4ErMdmJDTe+hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751987560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vu/IZjMMnpzDYYMqaAHjuV6erZj/FIILVmMjHRYMSoM=; b=WLLztq2hehoSem8Os9WSBgqKsWbuJg7GyLJJecNf2f8WsQy3PFeF0XPoCNTFG3Wqsi2kvq DAMH6H7x5yNxPJzBJ/1jyqgly1JxrgHwAoyOtov68ZkV7Vec0OdgWCUIWnDE+1T9u67lkW G5QgukiWXaQ/qD+VX9KgdYFAoMasu78aRWhLfLlL8hEZ0G9OWR6W1NnK+NN1NBkZk1ElR5 SqZ5hiVDwOkZghMv4aM1o+Bia4BUhW/TsEJg4Ono4S6EpPEyZpxXgJpeLACBmKyT9XrAZw WA9aSzfqsTbZ6x1g5XfHd4gDpD1br2zVVYCE0qPxKaCpnZaCvz84sPQTom2erg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751987560; a=rsa-sha256; cv=none; b=cz5z6a6DTB5HQ3F2oXBFIrw3hVZNJxxbg/tOPLuZlCmOcqSpH8hNZ/09+AYqWJhAtNJaV3 umAfdf7ie8m+KVtaAJtaT6dEaIdXRfhHHjCLyW3XSsNI4PVdCmMAforxvFc6NTu5QYlEDO PeJ07OJocPAjn0ES9CwqMCkW+OTx5fcNZ94zGpxntw9OUWQPsav+thNfaWuMo1rclnHDUZ go3o/EgSdexkanLV9YO+3Ki+WbxhNkm8Op9iapKhzxl+BbQOY7LGS77ChksqiF4MsPE+eq TjqefESFDs6QW3SKnxPuvmH09WAnncXGswFUvi9LpWwb7jizHwWDVb1A7onjAg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bc4NS4Vrtzj8k; Tue, 08 Jul 2025 15:12:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 568FCe6g049410; Tue, 8 Jul 2025 15:12:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 568FCeX8049407; Tue, 8 Jul 2025 15:12:40 GMT (envelope-from git) Date: Tue, 8 Jul 2025 15:12:40 GMT Message-Id: <202507081512.568FCeX8049407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: f84a0da4e060 - main - libusb: rename bNumDeviceCapabilities to bNumDeviceCaps for compatibility with libusb 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: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f84a0da4e0608a970c775f3d605f8de2b0b8d322 Auto-Submitted: auto-generated The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=f84a0da4e0608a970c775f3d605f8de2b0b8d322 commit f84a0da4e0608a970c775f3d605f8de2b0b8d322 Author: ShengYi Hung AuthorDate: 2025-06-07 19:43:15 +0000 Commit: ShengYi Hung CommitDate: 2025-07-08 15:11:41 +0000 libusb: rename bNumDeviceCapabilities to bNumDeviceCaps for compatibility with libusb THe member bNumDeviceCapabilities is referred to as bNumDeviceCaps in the upstream libusb project. To improve compatibility, we are renaming the member accordingly. For backward compatibility, a mocro will be defined to map bNumDeviceCapabilities to bNumDeviceCaps. See: https://github.com/libusb/libusb/commit/02ebafc85d3f219842cbabaf78abc8100b6656e5 Reviewed by: kevans Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50740 --- lib/libusb/libusb.h | 5 ++++- lib/libusb/libusb10_desc.c | 11 ++++++----- lib/libusb/libusb20_desc.h | 6 +++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index 0aad29aa4ecc..491af3d0a5ec 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -418,7 +418,10 @@ typedef struct libusb_bos_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wTotalLength; - uint8_t bNumDeviceCapabilities; +#ifndef bNumDeviceCapabilities +#define bNumDeviceCapabilities bNumDeviceCaps +#endif + uint8_t bNumDeviceCaps; struct libusb_usb_2_0_device_capability_descriptor *usb_2_0_ext_cap; struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap; struct libusb_bos_dev_capability_descriptor **dev_capability; diff --git a/lib/libusb/libusb10_desc.c b/lib/libusb/libusb10_desc.c index 3e36009cbb3a..5f4c46740688 100644 --- a/lib/libusb/libusb10_desc.c +++ b/lib/libusb/libusb10_desc.c @@ -470,10 +470,11 @@ libusb_parse_bos_descriptor(const void *buf, int len, ptr->bDescriptorType = dtype; ptr->wTotalLength = ((const uint8_t *)buf)[2] | (((const uint8_t *)buf)[3] << 8); - ptr->bNumDeviceCapabilities = ((const uint8_t *)buf)[4]; + ptr->bNumDeviceCaps = ((const uint8_t *)buf)[4]; ptr->usb_2_0_ext_cap = NULL; ptr->ss_usb_cap = NULL; - ptr->dev_capability = calloc(ptr->bNumDeviceCapabilities, sizeof(void *)); + ptr->dev_capability = calloc(ptr->bNumDeviceCaps, + sizeof(void *)); if (ptr->dev_capability == NULL) { free(ptr); return (LIBUSB_ERROR_NO_MEM); @@ -485,7 +486,7 @@ libusb_parse_bos_descriptor(const void *buf, int len, if (dlen >= 3 && ptr != NULL && dtype == LIBUSB_DT_DEVICE_CAPABILITY) { - if (index != ptr->bNumDeviceCapabilities) { + if (index != ptr->bNumDeviceCaps) { ptr->dev_capability[index] = malloc(dlen); if (ptr->dev_capability[index] == NULL) { libusb_free_bos_descriptor(ptr); @@ -542,7 +543,7 @@ libusb_parse_bos_descriptor(const void *buf, int len, } if (ptr != NULL) { - ptr->bNumDeviceCapabilities = index; + ptr->bNumDeviceCaps = index; return (0); /* success */ } @@ -557,7 +558,7 @@ libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos) if (bos == NULL) return; - for (i = 0; i != bos->bNumDeviceCapabilities; i++) + for (i = 0; i != bos->bNumDeviceCaps; i++) free(bos->dev_capability[i]); free(bos->dev_capability); free(bos); diff --git a/lib/libusb/libusb20_desc.h b/lib/libusb/libusb20_desc.h index 017148a34b1c..0f7c9294ebc8 100644 --- a/lib/libusb/libusb20_desc.h +++ b/lib/libusb/libusb20_desc.h @@ -298,11 +298,15 @@ LIBUSB20_MAKE_STRUCT(LIBUSB20_USB_20_DEVCAP_DESC); LIBUSB20_MAKE_STRUCT(LIBUSB20_SS_USB_DEVCAP_DESC); +#ifndef bNumDeviceCapabilities +#define bNumDeviceCapabilities bNumDeviceCaps +#endif + #define LIBUSB20_BOS_DESCRIPTOR(m,n) \ m(n, UINT8_T, bLength, ) \ m(n, UINT8_T, bDescriptorType, ) \ m(n, UINT16_T, wTotalLength, ) \ - m(n, UINT8_T, bNumDeviceCapabilities, ) \ + m(n, UINT8_T, bNumDeviceCaps, ) \ LIBUSB20_MAKE_STRUCT(LIBUSB20_BOS_DESCRIPTOR);