enable/disable gettys as needed
This commit is contained in:
+6
-3
@@ -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"
|
systemd-cat -t gadget.sh -p info echo "DWC2 module loaded, setting up OTG gadget serial and ethernet"
|
||||||
else
|
else
|
||||||
systemd-cat -t gadget.sh -p warning echo "DWC2 module missing. Aborting OTG setup."
|
systemd-cat -t gadget.sh -p warning echo "DWC2 module missing. Aborting OTG setup."
|
||||||
|
systemctl disable serial-getty@ttyGS0.service
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
sudo modprobe libcomposite
|
sudo modprobe libcomposite
|
||||||
cd /sys/kernel/config/usb_gadget
|
cd /sys/kernel/config/usb_gadget
|
||||||
# Was the script already run?
|
|
||||||
if [ -d "MyGadget" ]; then
|
if [ -d "MyGadget" ]; then
|
||||||
systemd-cat -t gadget.sh -p warning echo "MyGadget already exists. Aborting OTG setup."
|
systemd-cat -t gadget.sh -p warning echo "MyGadget already exists. Aborting OTG setup."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create our new gadget
|
# Create our new gadget
|
||||||
sudo mkdir MyGadget
|
mkdir MyGadget
|
||||||
cd MyGadget
|
cd MyGadget
|
||||||
# Add some boilerplate data that the gadget needs
|
# Add some boilerplate data that the gadget needs
|
||||||
echo 0x1d6b > idVendor # Linux Foundation’s USB VID. Replace with your own VID if required
|
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
|
### Remember to create the storage block device first
|
||||||
## cd /root
|
## cd /root
|
||||||
### Example: Make a 256 MB file to act as "USB stick"
|
### 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
|
## sudo dd if=/dev/zero of=drive.bin bs=1M count=256
|
||||||
### Create a VFAT file system on the backing store
|
### Create a VFAT file system on the backing store
|
||||||
## sudo mkfs.vfat drive.bin
|
## sudo mkfs.vfat drive.bin
|
||||||
@@ -69,3 +69,6 @@ ln -s functions/ecm.usb0 configs/c.1/
|
|||||||
## USB Device Controller update
|
## USB Device Controller update
|
||||||
UDC=`ls /sys/class/udc`
|
UDC=`ls /sys/class/udc`
|
||||||
echo $UDC > UDC
|
echo $UDC > UDC
|
||||||
|
|
||||||
|
# Enable the gettys
|
||||||
|
systemctl enable serial-getty@ttyGS0.service
|
||||||
|
|||||||
Reference in New Issue
Block a user