new sbin script to detect if usb_data is connected, share with new arg to check if sharing in course, retrofe to the latest version using these scripts

This commit is contained in:
vincent 2020-09-29 23:51:11 +02:00
parent d7bcbad041
commit 9a98be88df
3 changed files with 44 additions and 5 deletions

View File

@ -0,0 +1,20 @@
#!/bin/sh
# Uncomment the following line to get debug info
#set -x
# Get USB state
usb_present=$(cat /sys/class/power_supply/axp20x-usb/present)
# Get udc state
udc_state=$(cat /sys/class/udc/musb-hdrc.1.auto/state)
if [[ x"$udc_state" == "xconfigured" -a "$usb_present" == "1" ]]; then
# Connected succesfully to a host
echo "yes"
exit 0
else
echo "no"
exit 1
fi

View File

@ -48,7 +48,7 @@ mount_share () {
fi
# Create the directory structure if required
(cd /mnt; mkdir -p "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan")
(cd /mnt; mkdir -p "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan")
return 0
}
@ -81,6 +81,20 @@ stop_share () {
return 0
}
# Return if currently sharing
is_share_started () {
cat $BACKING_STORE_FILE | egrep -q ^/dev/mmcblk0p3
local res=$?
if [ "$res" == "0" ]; then
echo "yes"
else
echo "no"
fi
return $res
}
# Start sharing the backing store partition
start_share () {
@ -104,7 +118,7 @@ start_share () {
sleep 1
let trials=$trials+1
# Check if USB is mounted
# Check if USB is connected
if [ x"$udc_state" == "xconfigured" ]; then
# Connected succesfully to a host
@ -140,8 +154,13 @@ case "$1" in
stop_share
;;
is_sharing)
is_share_started
;;
*)
die 15 "Usage $0 {init|start|stop}"
die 15 "Usage $0 {init|start|stop|is_sharing}"
;;
esac
exit $?

View File

@ -4,7 +4,7 @@
#
################################################################################
RETROFE_VERSION = 3c504234b22f7702fc0b8489ffa93cc5073e1175
RETROFE_VERSION = f43ec65c428baf1239c609ab2860440053915c8d
RETROFE_SITE_METHOD = git
#RETROFE_SITE = ssh://git@github.com/FunKey-Project/FunKey-Launcher-retrofe.git
RETROFE_SITE = ssh://git@fk/FunKey-Project/FunKey-Launcher-retrofe.git