微電腦 - iRiver Dicple D88 - 如何使用USB Gadget GSerial



gserial.sh

# Author: River <zwang@ingenic.cn>
#!/bin/sh

if [ "$1" == "start" ]; then
    insmod /lib/modules/jz4740_udc.ko
    insmod /lib/modules/g_serial.ko

    #Bypass udc_hotplug

    rmmod /lib/modules/g_serial.ko
    rmmod /lib/modules/jz4740_udc.ko

    insmod /lib/modules/jz4740_udc.ko
    insmod /lib/modules/g_serial.ko

    sleep 3
    setsid getty 115200 /dev/ttygs0 &

elif [ "$1" == "stop" ]; then
    rmmod g_serial.ko
else
    waitkey 22 3 # Wait 'U' in 3s

    if [ $? -eq 0 ]; then
        insmod /lib/modules/jz4740_udc.ko
        insmod /lib/modules/g_serial.ko

        rmmod /lib/modules/g_serial.ko
        rmmod /lib/modules/jz4740_udc.ko

        insmod /lib/modules/jz4740_udc.ko
        insmod /lib/modules/g_serial.ko

        sleep 3
        setsid getty 115200 /dev/ttygs0 &
    fi
fi