rpi-usb-gadget works better but needs an offline-switch
This commit is contained in:
@@ -9,11 +9,25 @@ if [ $(id -u) -ne 0 ]; then
|
||||
exit 1
|
||||
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.
|
||||
<<<<<<< HEAD
|
||||
if lsmod | grep -q "dwc2"; then
|
||||
echo "DWC2 module loaded, setting up OTG gadget serial and ethernet" | logger -t $0 -p info
|
||||
echo "DWC2 module loaded"
|
||||
=======
|
||||
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
|
||||
systemd-cat -t gadget.sh -p info echo "DWC2 precompiled, setting up OTG gadget serial and ethernet"
|
||||
elif lsmod | grep -q "dwc2"; then
|
||||
systemd-cat -t gadget.sh -p info echo "Pre 6.18.39 kernel. DWC2 module loaded, setting up OTG gadget serial and ethernet"
|
||||
>>>>>>> master
|
||||
else
|
||||
echo "DWC2 module missing. Aborting OTG setup." | logger -t $0 -p info
|
||||
echo "DWC2 module missing"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=Serial and Ethernet over OTG USB
|
||||
After=systemd-user-sessions.service
|
||||
#After=systemd-user-sessions.service
|
||||
Before=serial-getty@ttyGS0.service
|
||||
[Service]
|
||||
ExecStart=/root/rover-pi/Scripts/gadget.sh
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user