#!/bin/sh if $(grep -q b_idle /sys/devices/platform/musb_hdrc/mode) then #echo "guest mode enabled" hostmode=0 else #echo "host mode" hostmode=1 fi case "$1" in "enable" | "host" | "hostmode" ) echo host > /sys/devices/platform/musb_hdrc/mode run-standalone.sh dbus-send --print-reply \ --type=method_call --dest=org.freedesktop.Notifications \ /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog \ string:'USB HOST MODE - ENABLED' uint32:0 string:'OK' 2> /dev/null 1> /dev/null ;; "disable" | "guest" | "otg" | "peripheral" ) echo otg > /sys/devices/platform/musb_hdrc/mode run-standalone.sh dbus-send --print-reply \ --type=method_call --dest=org.freedesktop.Notifications \ /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog \ string:'USB HOST MODE - DISABLED' uint32:0 string:'OK' 2> /dev/null 1> /dev/null ;; "toggle" ) if [ $hostmode -eq 1 ] ; then #"Calling $0 to disable" $0 disable else #"Calling $0 to enable" $0 enable fi ;; * ) echo "$0 usage: enable | disable | toggle | --help" ;; esac