diff --git a/Scripts/gadget.sh b/Scripts/gadget.sh index fde27f2..490c1ef 100755 --- a/Scripts/gadget.sh +++ b/Scripts/gadget.sh @@ -3,6 +3,13 @@ # "Using OTG mode on Raspberry Pi SBCs" # https://pip-assets.raspberrypi.com/categories/685-app-notes-guides-whitepapers/documents/RP-009276-WP/Using-OTG-mode-on-Raspberry-Pi-SBCs +# This script only works if you are running it as root +if [ $(id -u) -ne 0 ]; then + echo "Please run as root or use sudo" + exit 1 +fi + + # Is the dwc2 overlay installed? Nothing will work if it isn't. if lsmod | grep -q "dwc2"; then systemd-cat -t gadget.sh -p info echo "DWC2 module loaded, setting up OTG gadget serial and ethernet"