#!/bin/sh

[ -d /sys/kernel/config/usb_gadget ] || exit 0

cd /sys/kernel/config/usb_gadget

cd adb

echo -n "" > UDC || true

killall adbd || true

umount /dev/usb-ffs/adb

rm configs/c.1/ffs.usb0

rmdir configs/c.1/strings/0x409
rmdir configs/c.1

rmdir functions/ffs.usb0
rmdir strings/0x409

cd ..
rmdir adb
