Skip to content

Commit

Permalink
Add mode=peripheral
Browse files Browse the repository at this point in the history
Change-Id: I68f6e160362d460ed3eedcc657814c873bff4655
  • Loading branch information
b100dian committed Mar 27, 2023
1 parent 7ba258b commit 19936a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions init-script
Expand Up @@ -194,6 +194,9 @@ inject_loop() {
usb_setup_configfs() {
G_USB_ISERIAL=$GADGET_DIR/g1/strings/0x409/serialnumber
G_CONFIG=c.1
G_USB_DEVICE="$(ls /sys/class/udc | grep -v dummy)"

write /sys/class/udc/$G_USB_DEVICE/device/../mode peripheral

mkdir $GADGET_DIR/g1
write $GADGET_DIR/g1/idVendor "0x18D1"
Expand Down Expand Up @@ -223,7 +226,7 @@ usb_setup_configfs() {
fi
echo $USB_FUNCTIONS | grep -q "mass_storage" && ln -s $GADGET_DIR/g1/functions/storage.0 $GADGET_DIR/g1/configs/$G_CONFIG

echo "$(ls /sys/class/udc | grep -v dummy)" > $GADGET_DIR/g1/UDC
echo "$(G_USB_DEVICE)" > $GADGET_DIR/g1/UDC
}

# This sets up the USB with whatever USB_FUNCTIONS are set to via android_usb
Expand Down Expand Up @@ -278,7 +281,7 @@ run_debug_session() {
if [ x$USB_IFACE = xnotfound ]; then
usb_info "Mer Debug: ERROR: could not setup USB as usb0 or rndis0"
dmesg
sleep 60 # plenty long enough to check usb on host
sleep 50 # plenty long enough to check usb on host
reboot -f
fi

Expand Down

0 comments on commit 19936a2

Please sign in to comment.