M350b版本

This commit is contained in:
xin
2026-01-08 16:00:08 +08:00
parent 7396728ea7
commit a76d4b77e9
213 changed files with 8883 additions and 7196579 deletions

37
rasp.sh
View File

@ -6,8 +6,8 @@ net_ip=192.168.42.120
net_mask=255.255.0.0
enable_vcom=0
enable_rndis=1
enable_bulk=0
enable_rndis=0
enable_bulk=1
startup_bulk_dir=$(dirname "$0")
startup_bulk_exe=${startup_bulk_dir}/build/startup_bulk
@ -30,12 +30,43 @@ startup_bulk_exe=${startup_bulk_dir}/build/startup_bulk
#
# exit 1
#fi
# 卸载 g_mass_storage
if lsmod | grep -q g_mass_storage; then
echo "Unloading g_mass_storage module..."
modprobe -r g_mass_storage || { echo "WARNING: Failed to unload g_mass_storage. This might cause issues."; }
sleep 1
fi
# 卸载 g_ether
if lsmod | grep -q g_ether; then
echo "Unloading g_ether module..."
modprobe -r g_ether || { echo "WARNING: Failed to unload g_ether. This might cause issues."; }
sleep 1
fi
rmmod g_mass_storage
sleep 1
GADGET_NAME="pi4"
GADGET_ROOT="/sys/kernel/config/usb_gadget/${GADGET_NAME}"
# 2. 卸载并清理旧的 gadget 配置 (可选,但推荐在测试时使用以确保干净状态)
if [ -d "${GADGET_ROOT}" ]; then
echo "Disabling existing gadget '${GADGET_NAME}'..."
# 尝试解绑当前的 UDC (如果已经绑定)
if [ -f "${GADGET_ROOT}/UDC" ]; then
current_udc=$(cat "${GADGET_ROOT}/UDC")
if [ -n "$current_udc" ]; then
echo "Unbinding ${current_udc} from previous gadget..."
echo "" > "${GADGET_ROOT}/UDC" # 解绑 UDC
sleep 1
fi
fi
rm -rf "${GADGET_ROOT}" # 删除所有旧的配置
echo "Old gadget configuration removed."
sleep 1
fi
if [ ! -d /sys/kernel/config/usb_gadget/pi4 ]; then
if [ 1 ]; then
echo "Creating gadget..."
mkdir -p /sys/kernel/config/usb_gadget/pi4
cd /sys/kernel/config/usb_gadget/pi4
echo 0x2ca3 > idVendor # Linux Foundation