Skip to content

telnet: use NCM configfs function for USB network if available #42

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

Open
wants to merge 1 commit into
base: halium
Choose a base branch
from
Open
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
14 changes: 10 additions & 4 deletions scripts/panic/telnet
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ usb_setup_configfs() {
write $GADGET_DIR/g1/strings/0x409/manufacturer "Halium initrd"
write $GADGET_DIR/g1/strings/0x409/product "Failed to boot"

NETWORK_FUNCTION=""
if echo $USB_FUNCTIONS | grep -q "rndis"; then
mkdir $GADGET_DIR/g1/functions/rndis.usb0
mkdir $GADGET_DIR/g1/functions/rndis_bam.rndis
for function in ncm.usb0 rndis.usb0 rndis_bam.rndis; do
mkdir $GADGET_DIR/g1/functions/$function && NETWORK_FUNCTION=$function && break
done

if [ -z "$NETWORK_FUNCTION" ]; then
echo "Error: No USB network gadget function available" >&2
exit 1
fi
fi
echo $USB_FUNCTIONS | grep -q "mass_storage" && mkdir $GADGET_DIR/g1/functions/storage.0

Expand All @@ -46,8 +53,7 @@ usb_setup_configfs() {
write $GADGET_DIR/g1/configs/c.1/strings/0x409/configuration "$USB_FUNCTIONS"

if echo $USB_FUNCTIONS | grep -q "rndis"; then
ln -s $GADGET_DIR/g1/functions/rndis.usb0 $GADGET_DIR/g1/configs/c.1
ln -s $GADGET_DIR/g1/functions/rndis_bam.rndis $GADGET_DIR/g1/configs/c.1
ln -s $GADGET_DIR/g1/functions/$NETWORK_FUNCTION $GADGET_DIR/g1/configs/c.1
fi
echo $USB_FUNCTIONS | grep -q "mass_storage" && ln -s $GADGET_DIR/g1/functions/storage.0 $GADGET_DIR/g1/configs/c.1

Expand Down
Loading