Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115654324
D48678.id149955.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D48678.id149955.diff
View Options
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.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
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,64 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright 2023 Beckhoff Automation GmbH & Co. KG
+# Copyright 2023 Bjoern A. Zeeb
+# Copyright 2025 Jesper Schmitz Mouridsen
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted providing that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+usb_get_vendor()
+{
+ local hexvendor=$(echo $1 | sed 's/.*idVendor[[:space:]]*=[[:space:]]*\(0x[0-9a-z]*\).*/\1/')
+ case "${hexvendor}" in
+ 0x148f) echo "ralink" ;;
+ 0x7372) echo "realteak" ;;
+ esac
+}
+
+usb_get_device()
+{
+ local hexdevice=$(echo $1 | sed 's/.*idProduct[[:space:]]*=[[:space:]]*\(0x[0-9a-z]*\).*/\1/')
+ echo "${hexdevice}"
+
+}
+
+usb_search_packages()
+{
+ local IFS
+
+ oldifs=$IFS
+ IFS=$'\n'
+ for fulldevice in $(usbconfig dump_device_desc | awk '/id(Vendor|Product)/ { if( $3 != "0x0000") { print $0}}' | paste -d " " - -); 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} ${fulldevice}
+ 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,39 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright 2023 Bjoern A. Zeeb
+# Copyright (c) 2024 The FreeBSD Foundation
+# Copyright 2025 Jesper Schmitz Mouridsen
+#
+# Portions of this software were developed by Björn Zeeb
+# under sponsorship from the FreeBSD Foundation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+usb_ralink()
+{
+
+ case "$1" in
+ 0x7601) addpkg "wifi-firmware-mediatek-kmod-mt7601u"; return 1 ;;
+ esac
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 3:18 PM (15 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17819179
Default Alt Text
D48678.id149955.diff (5 KB)
Attached To
Mode
D48678: preliminary usb support for fwget
Attached
Detach File
Event Timeline
Log In to Comment