From 01b3a189ed83facac3fac11be6dd87ffb5eaa6eb Mon Sep 17 00:00:00 2001 From: "Joseph T. Foley" Date: Thu, 2 Jul 2026 10:34:26 +0000 Subject: [PATCH] enable/disable gettys as needed --- Scripts/gadget.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Scripts/gadget.sh b/Scripts/gadget.sh index 86514d4..fde27f2 100755 --- a/Scripts/gadget.sh +++ b/Scripts/gadget.sh @@ -8,20 +8,19 @@ if lsmod | grep -q "dwc2"; then systemd-cat -t gadget.sh -p info echo "DWC2 module loaded, setting up OTG gadget serial and ethernet" else systemd-cat -t gadget.sh -p warning echo "DWC2 module missing. Aborting OTG setup." + systemctl disable serial-getty@ttyGS0.service exit 1 fi - sudo modprobe libcomposite cd /sys/kernel/config/usb_gadget -# Was the script already run? if [ -d "MyGadget" ]; then systemd-cat -t gadget.sh -p warning echo "MyGadget already exists. Aborting OTG setup." exit 1 fi # Create our new gadget -sudo mkdir MyGadget +mkdir MyGadget cd MyGadget # Add some boilerplate data that the gadget needs echo 0x1d6b > idVendor # Linux Foundation’s USB VID. Replace with your own VID if required @@ -46,6 +45,7 @@ echo "Config 1" > configs/c.1/strings/0x409/configuration ### Remember to create the storage block device first ## cd /root ### Example: Make a 256 MB file to act as "USB stick" +## Only create it once or it will delete the previous content ## sudo dd if=/dev/zero of=drive.bin bs=1M count=256 ### Create a VFAT file system on the backing store ## sudo mkfs.vfat drive.bin @@ -69,3 +69,6 @@ ln -s functions/ecm.usb0 configs/c.1/ ## USB Device Controller update UDC=`ls /sys/class/udc` echo $UDC > UDC + +# Enable the gettys +systemctl enable serial-getty@ttyGS0.service