usb-gadget package!

This commit is contained in:
Miguel Fuertes committed 2025-09-15 09:55:23 +02:00
1 parent 362dca6ddf
commit abf27acb05
8 files changed
+27 -44

No files matched your search

+2
View File
@@ -15,7 +15,9 @@ CONFIG_PACKAGE_default-settings=y
CONFIG_PACKAGE_glib2=y
CONFIG_PACKAGE_kmod-mii=y
CONFIG_PACKAGE_kmod-usb-core=y
CONFIG_PACKAGE_kmod-usb-gadget-mass-storage=y
CONFIG_PACKAGE_kmod-usb-gadget-ncm=y
CONFIG_PACKAGE_kmod-usb-gadget-serial=y
CONFIG_PACKAGE_kmod-usb-net=y
CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y
CONFIG_PACKAGE_kmod-usb-net-cdc-mbim=y
+2 -2
View File
@@ -2873,9 +2873,9 @@ CONFIG_PACKAGE_kmod-usb-gadget=y
CONFIG_PACKAGE_kmod-usb-gadget-eth=y
# CONFIG_PACKAGE_kmod-usb-gadget-functionfs is not set
# CONFIG_PACKAGE_kmod-usb-gadget-hid is not set
# CONFIG_PACKAGE_kmod-usb-gadget-mass-storage is not set
CONFIG_PACKAGE_kmod-usb-gadget-mass-storage=y
CONFIG_PACKAGE_kmod-usb-gadget-ncm=y
# CONFIG_PACKAGE_kmod-usb-gadget-serial is not set
CONFIG_PACKAGE_kmod-usb-gadget-serial=y
# CONFIG_PACKAGE_kmod-usb-hid is not set
# CONFIG_PACKAGE_kmod-usb-hid-cp2112 is not set
# CONFIG_PACKAGE_kmod-usb-hid-mcp2221 is not set
-19
View File
@@ -1,19 +0,0 @@
#
# Copyright (C) 2014-2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
*)
ucidef_set_interface_lan "usb0"
;;
esac
board_config_flush
exit 0
+1 -1
View File
@@ -11,7 +11,7 @@ define Package/$(PKG_NAME)
SECTION:=Utilities
CATEGORY:=Utilities
TITLE:=USB Gadget with config for msm8916 chipsets
DEPENDS:=@USB_GADGET_SUPPORT +kmod-fs-configfs +kmod-usb-gadget +kmod-usb-lib-composite
DEPENDS:=@USB_GADGET_SUPPORT +kmod-fs-configfs +kmod-usb-gadget +kmod-usb-lib-composite +kmod-usb-gadget-serial +kmod-usb-gadget-mass-storage
endef
define Build/Configure
@@ -10,16 +10,12 @@
###
# USB Functions Enable/Disable
ENABLE_RNDIS=1 # MS-Windows compatible ethernet
ENABLE_RNDIS=10 # MS-Windows compatible ethernet
ENABLE_ECM=0 # CDC ECM ethernet
ENABLE_NCM=0 # CDC NCM ethernet (Best Performance)
ENABLE_NCM=1 # CDC NCM ethernet (Best Performance)
ENABLE_UMS=1 # Mass storage
ENABLE_ACM=1 # Serial console
# Network Configuration
# Bridge to attach USB Ethernet interfaces to
NETWORK_BRIDGE="br0"
# UMS Configuration (if enabled)
UMS_IMAGE="/var/lib/msm8916-gadget/usb_mass_storage.img"
UMS_IMAGE_SIZE="100M" # Size to create if image doesn't exist (M/G suffix supported)
@@ -7,7 +7,6 @@ start_service() {
procd_set_param command /bin/sh /etc/msm8916-usb-gadget.sh start
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param respawn 1 5 5
procd_close_instance
}
@@ -15,7 +15,6 @@ GADGET_PATH="/sys/kernel/config/usb_gadget/msm8916"
: ${USB_DEVICE_VERSION:="0x0100"}
: ${USB_MANUFACTURER:="MSM8916"}
: ${USB_PRODUCT:="USB Gadget"}
: ${NETWORK_BRIDGE:="br0"}
# Helper functions
log() {
@@ -248,7 +247,6 @@ setup_gadget() {
}
setup_network() {
. /lib/functions/uci-defaults.sh
log "Configuring network interfaces"
# Wait for interfaces to appear
@@ -258,20 +256,26 @@ setup_network() {
if [ "${ENABLE_RNDIS}" = "1" ] && [ -f functions/rndis.usb0/ifname ]; then
rndis_if="$(cat functions/rndis.usb0/ifname)"
log "Adding ${rndis_if} to LAN"
ucidef_set_interface_lan "${rndis_if}"
uci del_list network.@device[0].ports="${rndis_if}"
uci add_list network.@device[0].ports="${rndis_if}"
fi
if [ "${ENABLE_ECM}" = "1" ] && [ -f functions/ecm.usb0/ifname ]; then
ecm_if="$(cat functions/ecm.usb0/ifname)"
log "Adding ${ecm_if} to LAN"
ucidef_set_interface_lan "${ecm_if}"
uci del_list network.@device[0].ports="${ecm_if}"
uci add_list network.@device[0].ports="${ecm_if}"
fi
if [ "${ENABLE_NCM}" = "1" ] && [ -f functions/ncm.usb0/ifname ]; then
ncm_if="$(cat functions/ncm.usb0/ifname)"
log "Adding ${ncm_if} to LAN"
ucidef_set_interface_lan "${ncm_if}"
uci del_list network.@device[0].ports="${ncm_if}"
uci add_list network.@device[0].ports="${ncm_if}"
fi
uci commit network
/etc/init.d/network reload
}
teardown_gadget() {
@@ -300,15 +304,16 @@ teardown_gadget() {
# Disable gadget
echo "" > UDC || true
#TODO: Remove from uci!
# Remove network interfaces from bridge
# for func in functions/*/ifname; do
# if [ -f "${func}" ]; then
# iface="$(cat "${func}")"
# ip link set "${iface}" nomaster || true
# ip link set "${iface}" down || true
# fi
# done
# Remove network interfaces from LAN
for func in functions/*/ifname; do
if [ -f "${func}" ]; then
iface="$(cat "${func}")"
uci del_list network.@device[0].ports="${iface}"
fi
done
uci commit network
/etc/init.d/network reload
# Remove configuration - use wildcard to catch all links
rm -f configs/c.1/* 2>/dev/null || true
+1 -1
View File
@@ -35,7 +35,7 @@ These are my attempts at building the os... my end goal is to build a working mo
- ~~Use `msm-firmware-loader` instead of bundling firmware.~~
- There is no easy way to load the partitions before kernel looks for them... so dumps instead of ln `msm-firmware-dumper` and then restart...
- msm8916-usb-gadget:
- Add interface(s) to br-lan via uci_functions... see files/board.d
- Check serial and ums!
- _**ucify**_ the uz801-tweaks... see `usb0` network setup!
- Recover GHA build pipeline
- Use built dtb from openstick-builder?