Check for GADGET_MODE in boot/firmware to enable
This commit is contained in:
@@ -9,6 +9,13 @@ if [ $(id -u) -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /boot/firmware/GADGET_MODE ]; then
|
||||||
|
systemd-cat -t gadget.sh -p info echo "/boot/firmware/GADGET_MODE exists: GADGET mode enabled"
|
||||||
|
else
|
||||||
|
systemd-cat -t gadget.sh -p warning echo "/boot/firmware/GADGET_MODE missing: GADGET mode disabled"
|
||||||
|
systemctl disable serial-getty@ttyGS0.service
|
||||||
|
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.
|
||||||
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
|
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
|
||||||
|
|||||||
@@ -18,14 +18,6 @@ Make sure you have your USB cable plugged into the left port **USB** and not the
|
|||||||
```
|
```
|
||||||
sudo su
|
sudo su
|
||||||
```
|
```
|
||||||
1. Enable the DWC version 2 USB peripheral device tree overlay by appending it to the end after the `[all]` category (which is at the end)
|
|
||||||
```
|
|
||||||
echo "dtoverlay=dwc2" >> /boot/firmware/config.txt
|
|
||||||
```
|
|
||||||
1. We add the required module `dwc2` for loading at startup
|
|
||||||
```
|
|
||||||
echo "dwc2" >> /etc/modules
|
|
||||||
```
|
|
||||||
1. Check that we can load the libcomposite module
|
1. Check that we can load the libcomposite module
|
||||||
```
|
```
|
||||||
modprobe libcomposite
|
modprobe libcomposite
|
||||||
@@ -94,7 +86,38 @@ This is similar to the procedure for accessing an Arduino.
|
|||||||
```
|
```
|
||||||
1. Press enter and you will be prompted to log in to the Pi with default credentials. User: pi - PW: raspberry
|
1. Press enter and you will be prompted to log in to the Pi with default credentials. User: pi - PW: raspberry
|
||||||
|
|
||||||
# Disabling the OTG mode to use a keyboard and mouse again
|
# Enabling/Disabling the OTG mode to use a keyboard and mouse again
|
||||||
|
|
||||||
|
**WARNING: Untested**
|
||||||
|
1. Disable: Delete a file called `GADGET_MODE` in the boot partition/drive when not on a pi. If the Pi is booted, you can delete `sudo rm /boot/firmware/GADGET_MODE` and reboot
|
||||||
|
1. Enable: create a file called `GADGET_MODE` in the boot partition/drive when not on a pi. If the Pi is booted, you can create `sudo touch /boot/firmware/GADGET_MODE` and reboot
|
||||||
|
|
||||||
|
# Connecting over the USB ethernet to ssh into your Pi
|
||||||
|
|
||||||
|
I have not tested this procedure because the serial console and normal network connection is sufficient for me --foley
|
||||||
|
|
||||||
|
https://www.raspberrypi.com/news/usb-gadget-mode-in-raspberry-pi-os-ssh-over-usb/
|
||||||
|
|
||||||
|
|
||||||
|
# Untested
|
||||||
|
Here are items that bear investigating but haven't been tested yet
|
||||||
|
|
||||||
|
- [Modify Imager manifest to install otg](https://github.com/raspberrypi/rpi-imager/tree/main/doc/local_json)
|
||||||
|
|
||||||
|
# Old DWC Instructions (for older versions)
|
||||||
|
|
||||||
|
## Setting up
|
||||||
|
1. Enable the DWC version 2 USB peripheral device tree overlay by appending it to the end after the `[all]` category (which is at the end)
|
||||||
|
```
|
||||||
|
echo "dtoverlay=dwc2" >> /boot/firmware/config.txt
|
||||||
|
```
|
||||||
|
1. We add the required module `dwc2` for loading at startup
|
||||||
|
```
|
||||||
|
echo "dwc2" >> /etc/modules
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Disabling the OTG mode to use a keyboard and mouse again
|
||||||
|
|
||||||
**WARNING: Untested**
|
**WARNING: Untested**
|
||||||
1. Comment out the dwg2 line in `/boot/firmware/config.txt` using a `#` in front of the line
|
1. Comment out the dwg2 line in `/boot/firmware/config.txt` using a `#` in front of the line
|
||||||
@@ -114,16 +137,3 @@ This is similar to the procedure for accessing an Arduino.
|
|||||||
```
|
```
|
||||||
systemctl disable serial-getty@ttyGS0.service
|
systemctl disable serial-getty@ttyGS0.service
|
||||||
```
|
```
|
||||||
|
|
||||||
# Connecting over the USB ethernet to ssh into your Pi
|
|
||||||
|
|
||||||
I have not tested this procedure because the serial console and normal network connection is sufficient for me --foley
|
|
||||||
|
|
||||||
https://www.raspberrypi.com/news/usb-gadget-mode-in-raspberry-pi-os-ssh-over-usb/
|
|
||||||
|
|
||||||
|
|
||||||
# Untested
|
|
||||||
Here are items that bear investigating but haven't been tested yet
|
|
||||||
|
|
||||||
- [Modify Imager manifest to install otg](https://github.com/raspberrypi/rpi-imager/tree/main/doc/local_json)
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user