Skip to content
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure exit 1 here is the best thing to do. If I understand correctly, this will exit PID 1, leading to kernel panic immediately (followed by reboot, maybe).

I think we should to the same as the # Unable to set up USB interface? Reboot. below (i.e. sleep for 60 seconds, then reboot).

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