meta-google: google-usb-network: Name gadget after interface

We generally have a single interface per gadget, so name it after the
interface by default.

Change-Id: Iac4ebc50fa8586ec3493111ffa85d8c3a7aa8125
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/networking/google-usb-network/usb_network.sh b/meta-google/recipes-google/networking/google-usb-network/usb_network.sh
index 0483e08..cbe7d0a 100755
--- a/meta-google/recipes-google/networking/google-usb-network/usb_network.sh
+++ b/meta-google/recipes-google/networking/google-usb-network/usb_network.sh
@@ -38,7 +38,7 @@
         --dev-mac MAC address of the device (gadget) part of the connection. Optional.
         --dev-type Type of gadget to instantiate. Default: "eem"
         --bind-device Name of the device to bind, as listed in /sys/class/udc/
-        --gadget-dir-name Optional base name for gadget directory. Default: "g1"
+        --gadget-dir-name Optional base name for gadget directory. Default: iface-name
         --iface-name Optional name of the network interface. Default: "usb0"
         --help  Print this help and exit.
 HELP
@@ -132,7 +132,7 @@
 HOST_MAC_ADDR=""
 BIND_DEVICE=""
 ACTION="start"
-GADGET_DIR_NAME="g1"
+GADGET_DIR_NAME=""
 IFACE_NAME="usb0"
 while [[ $# -gt 0 ]]; do
     case "$1" in
@@ -191,6 +191,10 @@
     esac
 done
 
+if [ -z "$GADGET_DIR_NAME" ]; then
+    GADGET_DIR_NAME="$IFACE_NAME"
+fi
+
 if [[ $ACTION == "stop" ]]; then
     gadget_stop
 else