From nobody Tue Feb 18 18:39:39 2025 X-Original-To: dev-commits-src-branches@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 4Yy7bv2hGBz5p19G; Tue, 18 Feb 2025 18:39:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yy7bv1zlhz3GS9; Tue, 18 Feb 2025 18:39:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739903979; 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=XBWp+EIhyZNcmEvVDD/NVC2rBlNHUKORzPlCqGoVtgs=; b=UVdovC0Fx/lasYmGN8iXZz35IjNAAW3YW4nrxKAsSp4nVAFOGa/gCI3q3rZzP6LeJyM5Jx qDPDt1J+uLeam0z4vKsrkE+9UILzdEjgREgeeSn/TC7esvowAqBLpFh04k1UoYKyIfzntV gvBHDLcPjcy84GC+NCLcLGEY8CIzUcbnCaJYWmPty3P/NF8WtFD9S0hloYtMBh7BVXkqDZ v7ZZpna03digXTm2T2miqLgxKKw57wdrdGRBMSmpWMx/YsOfvnHdVjZh3oAdFs5x8Ag4LR Fo2lEhfXrn7GkpqTMwQ2QKvPIyrAGOHLufFPO5yapMs+HepqHJeE6ElLs2RIfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739903979; a=rsa-sha256; cv=none; b=NLb78pjSUXWyg1eS6roCUSFHSkMiDV2AVijQ7xrcVg6DnLf0yPw6jpsRfe5UtzvkpXvZIn SuyStKaYQjDsix7ipIQFyP8G+OPt/3cRTkZUTzBINxCF1R9sAftLGmmOR2wXvGxkuhT2Qz GBBqXKfQDbU2zkmap/Ajb9scHIehSDLO6cqbo+t+tcF8K2fYSWJ3MYO+RnyLSHNRMp0mN3 b7fKoWCh5L+PFGxTfZWxGi9tpboposuPcTtJ7B5+6xVAxEGBnNbR98lfVDV9e7KVgffKzZ YN+UfH37JHHdXQCfxdgKuGliEReRKNee6MUTJOBpYSTYOp7/Per0P6JKrVnITw== 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=1739903979; 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=XBWp+EIhyZNcmEvVDD/NVC2rBlNHUKORzPlCqGoVtgs=; b=tYN73/WqQeV0ilnmY/21v4gszN8V1T8jQj9Q2OSMfR/C6n9/KxZlCj3VbYNBBpRLV2Q8R9 /bqIo9Oyz7C8dZue33QHth7iShigb3qQ9weCAqA0Av7gikrJDVMEa+QtiWpu7gcV3on2Zu ACvKX/NMT739DEqlCh3AUoz3NxYupTmmyO4CwWsYBROxgLMeTYc+FS2kuu4vdfR++fObFI +nfJJI2eimnXYxIiS7xbyuvqegfevI94ajOobsmSoUguPpnu7mJy5EWQjWj/ssO1lViuCh UjA8T9Nmyv+4u3AVnbUyxw6BXbAfVzOTtIaagFTFoVlfUWrgp0DrCe5CNiT1TQ== 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 4Yy7bv1V6dzXV3; Tue, 18 Feb 2025 18:39:39 +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 51IIddFb017510; Tue, 18 Feb 2025 18:39:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51IIddiT017507; Tue, 18 Feb 2025 18:39:39 GMT (envelope-from git) Date: Tue, 18 Feb 2025 18:39:39 GMT Message-Id: <202502181839.51IIddiT017507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: cbb7dbbde25d - stable/14 - iwmbtfw: Check firmware exists before trying to upload it List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cbb7dbbde25daa89718a7d8b36be782776bcaabb Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cbb7dbbde25daa89718a7d8b36be782776bcaabb commit cbb7dbbde25daa89718a7d8b36be782776bcaabb Author: Gavin Atkinson AuthorDate: 2025-01-07 00:02:20 +0000 Commit: Ed Maste CommitDate: 2025-02-18 18:39:18 +0000 iwmbtfw: Check firmware exists before trying to upload it In the case of an Intel 7260 device, the device needs to be put into something called "manufacturer mode" before the firmware is uploaded. The firmware is then upladed, and the card is taken out of this mode, at which point it disconnects and reconnects to the USB bus, and is at that point usable. However, iwmbtfw(8) puts the device into manufacturer mode before verifying that there exists a copy of the firmware to upload. As a result, in the case where there is no firmware available on disk, the device is put into manufacturer mode, the firmware can't be found so isn't uploaded, and the card is brought out of manufacturer mode, so it disconnects and reconnects to the USB bus. Enter devd(8). There are rules in /etc/devd/iwmbtfw.conf to call iwmbtfw(8) when the device appears. When there's no firmware on disk, devd will call iwmbtfw, iwmbtfw will try to do its thing and fail, the device will dis/reconnect, and devd will notice the device reappear and start the whole loop again. Fix is to verify that the firmware exists before putting the device into its special mode. The fix only changes things for the 7260 and not the other chips supported, I don't believe the issue exists with other chips as those do not need to be switched into manufacturer mode before uploading. PR: 283896 Reviewed by: emaste (cherry picked from commit b8cdbe1852ef5df4ba3c7a021d9632bde2e61327) --- usr.sbin/bluetooth/iwmbtfw/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c index c2b67ce01906..9c899d374e92 100644 --- a/usr.sbin/bluetooth/iwmbtfw/main.c +++ b/usr.sbin/bluetooth/iwmbtfw/main.c @@ -518,6 +518,13 @@ main(int argc, char *argv[]) iwmbt_debug("firmware_path = %s", firmware_path); + /* Check firmware file exists before changing HW mode */ + r = access(firmware_path, R_OK); + if (r) { + perror("Failed to open firmware"); + goto shutdown; + } + /* Enter manufacturer mode */ r = iwmbt_enter_manufacturer(hdl); if (r < 0) {