Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add g_ether in cmdline.txt as libcomposite often fails to load and minor fixes #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on the shoulders of giants.

## Usage
```shell
wget https://raw.githubusercontent.com/kmpm/rpi-usb-gadget/master/rpi4-usb.sh
curl -O https://raw.githubusercontent.com/kmpm/rpi-usb-gadget/master/rpi4-usb.sh
bash rpi4-usb.sh
```
If you answer no to any of the questions the script will exit
Expand Down
6 changes: 3 additions & 3 deletions remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ fi



if $(grep -q modules-load=dwc2 $CMDLINE_FILE) ; then
if $(grep -q modules-load=dwc2,g_ether $CMDLINE_FILE) ; then
echo
echo "remove line modules-load=dwc2 from $CMDLINE_FILE"
echo "remove line modules-load=dwc2,g_ether from $CMDLINE_FILE"
if ! confirm ; then
exit
fi
cat $CMDLINE_FILE
sudo sed -i '${s/ modules-load=dwc2//}' $CMDLINE_FILE
sudo sed -i '${s/ modules-load=dwc2,g_ether//}' $CMDLINE_FILE
cat $CMDLINE_FILE
fi

Expand Down
10 changes: 6 additions & 4 deletions rpi4-usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,17 @@ fi

# enable dwc2 overlay

teeconfirm "dtoverlay=dwc2" $CONFIG_FILE
if ! $(grep -q modules-load=dwc2 $CMDLINE_FILE) ; then
# teeconfirm "dtoverlay=dwc2" $CONFIG_FILE #cant use `teeconfirm` function, config file has multiple `dtoverlay=dwc2`
sudo sed -i '$ a\dtoverlay=dwc2' $CONFIG_FILE

if ! $(grep -q modules-load=dwc2,g_ether $CMDLINE_FILE) ; then
echo
echo "Add the line modules-load=dwc2 to $CMDLINE_FILE"
echo "Add the line modules-load=dwc2,g_ether to $CMDLINE_FILE"
if ! confirm ; then
exit
fi
if $DO_MODIFY ; then
sudo sed -i '${s/$/ modules-load=dwc2/}' $CMDLINE_FILE
sudo sed -i '${s/$/ modules-load=dwc2,g_ether/}' $CMDLINE_FILE
fi
fi

Expand Down