use new share script

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK
2021-06-07 22:34:57 +02:00
parent 67ee9f1520
commit 8ba4b07964
4 changed files with 25 additions and 22 deletions

View File

@@ -1,20 +0,0 @@
#!/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

@@ -127,6 +127,25 @@ is_share_started () {
return $res
}
is_usb_data_connected () {
# Get USB state
local usb_present=$(cat /sys/class/power_supply/axp20x-usb/present)
# Get udc state
local udc_state=$(cat /sys/class/udc/musb-hdrc.1.auto/state)
if [ "x${udc_state}" = "xconfigured" -a "${usb_present}" -eq 1 ]; then
# Connected succesfully to a host
echo "yes"
return 0
else
echo "no"
return 1
fi
}
case "$1" in
init)
@@ -145,6 +164,9 @@ case "$1" in
is_share_started
;;
is_usb_data_connected)
is_usb_data_connected
;;
*)
die 15 "Usage $0 {init|start|stop|is_sharing}"