enable usb rndis

Signed-off-by: carbon <carbon@milkv.io>
This commit is contained in:
carbon
2024-06-21 18:34:15 +08:00
parent 5299ef1f1f
commit bdc4a8a27a
6 changed files with 111 additions and 0 deletions

View File

@ -23,6 +23,10 @@ case "$1" in
. $SYSTEMPATH/blink.sh &
fi
if [ -f $SYSTEMPATH/usb.sh ]; then
. $SYSTEMPATH/usb.sh &
fi
if [ -f $USERDATAPATH/auto.sh ]; then
usleep 30000
. $USERDATAPATH/auto.sh &

View File

@ -0,0 +1 @@
usb-rndis.sh

View File

@ -0,0 +1,14 @@
#!/bin/sh
/etc/uhubon.sh device >> /tmp/rndis.log 2>&1
/etc/run_usb.sh probe rndis >> /tmp/rndis.log 2>&1
/etc/run_usb.sh start rndis >> /tmp/rndis.log 2>&1
sleep 0.5
ifconfig usb0 192.168.42.1
count=`ps | grep dnsmasq | grep -v grep | wc -l`
if [ ${count} -lt 1 ] ;then
echo "/etc/init.d/S80dnsmasq start" >> /tmp/rndis.log 2>&1
/etc/init.d/S80dnsmasq start >> /tmp/rndis.log 2>&1
fi

View File

@ -0,0 +1,14 @@
#!/bin/sh
/etc/uhubon.sh device >> /tmp/rndis.log 2>&1
/etc/run_usb.sh probe rndis >> /tmp/rndis.log 2>&1
/etc/run_usb.sh start rndis >> /tmp/rndis.log 2>&1
sleep 0.5
ifconfig usb0 192.168.42.1
count=`ps | grep dnsmasq | grep -v grep | wc -l`
if [ ${count} -lt 1 ] ;then
echo "/etc/init.d/S80dnsmasq start" >> /tmp/rndis.log 2>&1
/etc/init.d/S80dnsmasq start >> /tmp/rndis.log 2>&1
fi

View File

@ -0,0 +1,39 @@
#!/bin/sh
usb_en=453
usb_select=510
function set_gpio()
{
local gpio_num=$1
local gpio_val=$2
local gpio_path="/sys/class/gpio/gpio${gpio_num}"
if test -d ${gpio_path}; then
echo "GPIO ${gpio_num} already exported" >> /tmp/rndis.log 2>&1
else
echo ${gpio_num} > /sys/class/gpio/export
fi
echo out > ${gpio_path}/direction
sleep 0.1
echo ${gpio_val} > ${gpio_path}/value
}
set_gpio ${usb_en} 0
sleep 0.5
set_gpio ${usb_select} 0
sleep 0.5
/etc/uhubon.sh device >> /tmp/rndis.log 2>&1
/etc/run_usb.sh probe rndis >> /tmp/rndis.log 2>&1
/etc/run_usb.sh start rndis >> /tmp/rndis.log 2>&1
sleep 0.5
ifconfig usb0 192.168.42.1
count=`ps | grep dnsmasq | grep -v grep | wc -l`
if [ ${count} -lt 1 ] ;then
echo "/etc/init.d/S80dnsmasq start" >> /tmp/rndis.log 2>&1
/etc/init.d/S80dnsmasq start >> /tmp/rndis.log 2>&1
fi

View File

@ -0,0 +1,39 @@
#!/bin/sh
usb_en=453
usb_select=510
function set_gpio()
{
local gpio_num=$1
local gpio_val=$2
local gpio_path="/sys/class/gpio/gpio${gpio_num}"
if test -d ${gpio_path}; then
echo "GPIO ${gpio_num} already exported" >> /tmp/rndis.log 2>&1
else
echo ${gpio_num} > /sys/class/gpio/export
fi
echo out > ${gpio_path}/direction
sleep 0.1
echo ${gpio_val} > ${gpio_path}/value
}
set_gpio ${usb_en} 0
sleep 0.5
set_gpio ${usb_select} 0
sleep 0.5
/etc/uhubon.sh device >> /tmp/rndis.log 2>&1
/etc/run_usb.sh probe rndis >> /tmp/rndis.log 2>&1
/etc/run_usb.sh start rndis >> /tmp/rndis.log 2>&1
sleep 0.5
ifconfig usb0 192.168.42.1
count=`ps | grep dnsmasq | grep -v grep | wc -l`
if [ ${count} -lt 1 ] ;then
echo "/etc/init.d/S80dnsmasq start" >> /tmp/rndis.log 2>&1
/etc/init.d/S80dnsmasq start >> /tmp/rndis.log 2>&1
fi