Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b43d1d6798 |
@@ -13,6 +13,7 @@ Scripts and documentation for setting up a Raspberry Pi (Zero W 1 or 2) for use
|
|||||||
- [Starting on Raspberry Pi Zero](https://reykjavik.instructure.com/courses/6589/pages/starting-on-raspberry-pi-zero-w)
|
- [Starting on Raspberry Pi Zero](https://reykjavik.instructure.com/courses/6589/pages/starting-on-raspberry-pi-zero-w)
|
||||||
|
|
||||||
## References and Links
|
## References and Links
|
||||||
|
- [Sparkfun GPIO pinout](https://cdn.sparkfun.com/assets/learn_tutorials/6/7/6/PiZero_1.pdf)
|
||||||
- [Guide to creating ssh keys](https://pimylifeup.com/raspberry-pi-ssh-keys/) Of note, this guide is a little dated as it suggests using RSA keys and many people are moving toward EDCSA keys.
|
- [Guide to creating ssh keys](https://pimylifeup.com/raspberry-pi-ssh-keys/) Of note, this guide is a little dated as it suggests using RSA keys and many people are moving toward EDCSA keys.
|
||||||
- [Raspberry Pi Connect](https://connect.raspberrypi.com)
|
- [Raspberry Pi Connect](https://connect.raspberrypi.com)
|
||||||
- [Setting up Raspberry Pi Connect](https://www.raspberrypi.com/documentation/services/connect.html)
|
- [Setting up Raspberry Pi Connect](https://www.raspberrypi.com/documentation/services/connect.html)
|
||||||
|
|||||||
+6
-23
@@ -3,33 +3,20 @@
|
|||||||
# "Using OTG mode on Raspberry Pi SBCs"
|
# "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
|
# 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.
|
# Is the dwc2 overlay installed? Nothing will work if it isn't.
|
||||||
|
LOGGER="systemd-cat -t gadget.sh"
|
||||||
if lsmod | grep -q "dwc2"; then
|
if lsmod | grep -q "dwc2"; then
|
||||||
echo "DWC2 module loaded, setting up OTG gadget serial and ethernet" | logger -t $0 -p info
|
$LOGGER -p info "DWC2 module loaded, setting up OTG gadget serial and ethernet"
|
||||||
echo "DWC2 module loaded"
|
|
||||||
else
|
else
|
||||||
echo "DWC2 module missing. Aborting OTG setup." | logger -t $0 -p info
|
$LOGGER -p warning "DWC2 module missing. Aborting OTG setup"
|
||||||
echo "DWC2 module missing"
|
|
||||||
systemctl disable serial-getty@ttyGS0.service
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
modprobe libcomposite
|
|
||||||
|
sudo modprobe libcomposite
|
||||||
cd /sys/kernel/config/usb_gadget
|
cd /sys/kernel/config/usb_gadget
|
||||||
if [ -d "MyGadget" ]; then
|
|
||||||
echo "MyGadget already exists. Aborting OTG setup." | logger -t $0 -p info
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create our new gadget
|
# Create our new gadget
|
||||||
mkdir MyGadget
|
sudo 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
|
||||||
@@ -54,7 +41,6 @@ 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
|
||||||
@@ -78,6 +64,3 @@ 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