mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Add network via usb (#119)
This commit is contained in:
36
board/miyoo/main/apps/usb-mtd/remove.sh
Normal file
36
board/miyoo/main/apps/usb-mtd/remove.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
SYSDIR=/sys/kernel/config/usb_gadget/
|
||||
DEVDIR=$SYSDIR/$1
|
||||
|
||||
[ -d $DEVDIR ] || exit
|
||||
|
||||
echo '' > $DEVDIR/UDC
|
||||
|
||||
echo "Removing strings from configurations"
|
||||
for dir in $DEVDIR/configs/*/strings/*; do
|
||||
[ -d $dir ] && rmdir $dir
|
||||
done
|
||||
|
||||
echo "Removing functions from configurations"
|
||||
for func in $DEVDIR/configs/*.*/*.*; do
|
||||
[ -e $func ] && rm $func
|
||||
done
|
||||
|
||||
echo "Removing configurations"
|
||||
for conf in $DEVDIR/configs/*; do
|
||||
[ -d $conf ] && rmdir $conf
|
||||
done
|
||||
|
||||
echo "Removing functions"
|
||||
for func in $DEVDIR/functions/*.*; do
|
||||
[ -d $func ] && rmdir $func
|
||||
done
|
||||
|
||||
echo "Removing strings"
|
||||
for str in $DEVDIR/strings/*; do
|
||||
[ -d $str ] && rmdir $str
|
||||
done
|
||||
|
||||
echo "Removing gadget"
|
||||
rmdir $DEVDIR
|
||||
@@ -3,4 +3,27 @@
|
||||
echo peripheral > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
|
||||
modprobe -r g_serial
|
||||
killall umtprd
|
||||
/mnt/apps/usb-mtd/remove.sh g2
|
||||
mount none /sys/kernel/config -t configfs
|
||||
mkdir /sys/kernel/config/usb_gadget/g2
|
||||
cd /sys/kernel/config/usb_gadget/g2
|
||||
mkdir configs/c.1
|
||||
mkdir functions/ffs.mtp
|
||||
mkdir strings/0x409
|
||||
mkdir configs/c.1/strings/0x409
|
||||
|
||||
echo 0x0100 > idProduct
|
||||
echo 0x1D6B > idVendor
|
||||
|
||||
echo "Miyoo Handheld" > strings/0x409/manufacturer
|
||||
echo "Miyoo CFW 2.0" > strings/0x409/product
|
||||
|
||||
echo "Conf 1" > configs/c.1/strings/0x409/configuration
|
||||
echo 120 > configs/c.1/MaxPower
|
||||
ln -s functions/ffs.mtp configs/c.1
|
||||
mkdir /dev/ffs-mtp
|
||||
mount -t functionfs mtp /dev/ffs-mtp
|
||||
umtprd &
|
||||
sleep 1
|
||||
ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/g2/UDC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user