Harald Welte | a7c1eb0 | 2019-09-12 15:16:43 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | GADGET_NAME=osmo-hub |
| 4 | |
| 5 | GADGET_CONFIGFS=/sys/kernel/config/usb_gadget |
| 6 | |
| 7 | set -e |
| 8 | set -x |
| 9 | |
| 10 | gadgetdir="$GADGET_CONFIGFS/$GADGET_NAME" |
| 11 | |
| 12 | # unmount the endpoints from the filesystem |
| 13 | umount /dev/ffs-hub |
| 14 | |
| 15 | # detach from USB gadget/bus |
| 16 | echo "" > "$gadgetdir/UDC" || true |
| 17 | |
| 18 | # remove function from config |
| 19 | rm "$gadgetdir/configs/c.1/ffs.usb0" |
| 20 | |
| 21 | # remove strings in config |
| 22 | rmdir "$gadgetdir/configs/c.1/strings/0x409" |
| 23 | |
| 24 | # remove config |
| 25 | rmdir "$gadgetdir/configs/c.1" |
| 26 | |
| 27 | # remove function |
| 28 | rmdir "$gadgetdir/functions/ffs.usb0" |
| 29 | |
| 30 | # remove strings in gadget |
| 31 | rmdir "$gadgetdir/strings/0x409" |
| 32 | |
| 33 | rmdir $gadgetdir |