Page MenuHomeFreeBSD

D48678.diff
No OneTemporary

D48678.diff

diff --git a/usr.sbin/fwget/Makefile b/usr.sbin/fwget/Makefile
--- a/usr.sbin/fwget/Makefile
+++ b/usr.sbin/fwget/Makefile
@@ -2,6 +2,6 @@
SCRIPTS= fwget
MAN= fwget.8
-SUBDIR= pci
+SUBDIR= pci usb
.include <bsd.prog.mk>
diff --git a/usr.sbin/fwget/fwget.8 b/usr.sbin/fwget/fwget.8
--- a/usr.sbin/fwget/fwget.8
+++ b/usr.sbin/fwget/fwget.8
@@ -23,7 +23,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd June 27, 2024
+.Dd July 7, 2025
.Dt FWGET 8
.Os
.Sh NAME
@@ -47,7 +47,11 @@
.It Fl v
Be more verbose
.It Ar subsystem
-Hardware subsystem, default pci
+Hardware subsystem(s), default is all supported subsystems.
+Space separated hardware subsystems, accepts
+.Cm pci
+and
+.Cm usb
.El
.Sh SEE ALSO
.Xr firmware 9
@@ -64,4 +68,8 @@
.An Emmanuel Vadot Aq Mt manu@FreeBSD.org
for Beckhoff Automation GmbH & Co\. KG.
.Sh CAVEATS
-This utility currently only supports the pci subsystem.
+This utility currently only supports the
+.Xr pci 4
+and
+.Xr usb 4
+subsystems.
diff --git a/usr.sbin/fwget/fwget.sh b/usr.sbin/fwget/fwget.sh
--- a/usr.sbin/fwget/fwget.sh
+++ b/usr.sbin/fwget/fwget.sh
@@ -35,7 +35,7 @@
Usage: $(basename "$0") [options] [subsystem]
Supported subsystems
- pci
+ pci, usb
Options:
-n -- Do not install packages, only print the results
@@ -100,9 +100,9 @@
shift $(($OPTIND - 1))
subsystems="$@"
-# Default searching PCI subsystem
+# Default searching PCI and USB subsystem
if [ -z "${subsystems}" ]; then
- subsystems="pci"
+ subsystems="pci usb"
fi
# Fail early on unsupported subsystem
diff --git a/usr.sbin/fwget/usb/Makefile b/usr.sbin/fwget/usb/Makefile
new file mode 100644
--- /dev/null
+++ b/usr.sbin/fwget/usb/Makefile
@@ -0,0 +1,10 @@
+PACKAGE= fwget
+
+SCRIPTS=usb \
+ usb_ralink
+
+BINDIR= ${LIBEXECDIR}/fwget
+
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/fwget/usb/usb b/usr.sbin/fwget/usb/usb
new file mode 100755
--- /dev/null
+++ b/usr.sbin/fwget/usb/usb
@@ -0,0 +1,43 @@
+#
+# Copyright 2023 Beckhoff Automation GmbH & Co. KG
+# Copyright 2023 Bjoern A. Zeeb
+# Copyright 2025 Jesper Schmitz Mouridsen
+
+# SPDX-License-Identifier: BSD-2-Clause
+
+
+usb_get_vendor()
+{
+ local hexvendor=$(echo $1 | sed 's/.*idVendor=\(0x[0-9a-z]*\).*/\1/')
+ case "${hexvendor}" in
+ 0x148f) echo "ralink" ;;
+ esac
+}
+
+usb_get_device()
+{
+ local hexdevice=$(echo $1 | sed 's/.*idProduct=\(0x[0-9a-z]*\).*/\1/')
+ echo "${hexdevice}"
+
+}
+
+usb_search_packages()
+{
+ local IFS
+
+ oldifs=$IFS
+ IFS=$'\n'
+ for fulldevice in $(usbconfig -l dump_device_desc); do
+ vendor=$(usb_get_vendor "${fulldevice}")
+ if [ -z "${vendor}" ]; then
+ continue
+ fi
+ device=$(usb_get_device "${fulldevice}")
+ log_verbose "Trying to match device ${device} and vendor ${vendor} with usb_${vendor}"
+ if [ -f ${LIBEXEC_PATH}/usb_${vendor} ]; then
+ . ${LIBEXEC_PATH}/usb_${vendor}
+ usb_${vendor} ${device}
+ fi
+ done
+ IFS=${oldifs}
+}
diff --git a/usr.sbin/fwget/usb/usb_ralink b/usr.sbin/fwget/usb/usb_ralink
new file mode 100755
--- /dev/null
+++ b/usr.sbin/fwget/usb/usb_ralink
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 2025 Jesper Schmitz Mouridsen
+#
+# SPDX-License-Identifier: BSD-2-Clause
+
+usb_ralink()
+{
+
+ case "$1" in
+ 0x7601) addpkg "wifi-firmware-mt7601u-kmod"; return 1 ;;
+ esac
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 6, 3:25 PM (3 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30980565
Default Alt Text
D48678.diff (3 KB)

Event Timeline