diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/is_usb_data_connected b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/is_usb_data_connected new file mode 100755 index 0000000..c447693 --- /dev/null +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/is_usb_data_connected @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share index a3872ad..c9ef30b 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share @@ -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 () { @@ -103,8 +117,8 @@ start_share () { local udc_state=$(cat /sys/class/udc/musb-hdrc.1.auto/state) 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 $? diff --git a/FunKey/package/retrofe/retrofe.mk b/FunKey/package/retrofe/retrofe.mk index ed77b2c..cc95abe 100644 --- a/FunKey/package/retrofe/retrofe.mk +++ b/FunKey/package/retrofe/retrofe.mk @@ -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