meta-google: google-usb-network: Require fields

The interface, product ID and bind device are required in order to set
up the interface.

Change-Id: I9e47c8e9dfa86ae33cb01cedee8471c863e2f066
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/networking/google-usb-network/usb_network.service.m4 b/meta-google/recipes-google/networking/google-usb-network/usb_network.service.m4
index c65b815..cefaff9 100644
--- a/meta-google/recipes-google/networking/google-usb-network/usb_network.service.m4
+++ b/meta-google/recipes-google/networking/google-usb-network/usb_network.service.m4
@@ -21,6 +21,7 @@
     --dev-type "M_BMC_USB_TYPE" \
     HOST_MAC_ARG(M_BMC_USB_HOST_MAC) \
     DEV_MAC_ARG(M_BMC_USB_DEV_MAC) \
+    --iface-name usb0 \
     --bind-device "M_BMC_USB_BIND_DEV"
 ExecStop=M_SCRIPT_INSTALL_DIR/usb_network.sh stop
 
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 cbe7d0a..ebba57d 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
@@ -39,7 +39,7 @@
         --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: iface-name
-        --iface-name Optional name of the network interface. Default: "usb0"
+        --iface-name name of the network interface.
         --help  Print this help and exit.
 HELP
 }
@@ -133,7 +133,7 @@
 BIND_DEVICE=""
 ACTION="start"
 GADGET_DIR_NAME=""
-IFACE_NAME="usb0"
+IFACE_NAME=""
 while [[ $# -gt 0 ]]; do
     case "$1" in
         --product-id)
@@ -198,6 +198,21 @@
 if [[ $ACTION == "stop" ]]; then
     gadget_stop
 else
+    if [ -z "$ID_PRODUCT" ]; then
+        echo "Product ID is missing" >&2
+        exit 1
+    fi
+
+    if [ -z "$IFACE_NAME" ]; then
+        echo "Interface name is missing" >&2
+        exit 1
+    fi
+
+    if [ -z "$BIND_DEVICE" ]; then
+        echo "Bind device is missing" >&2
+        exit 1
+    fi
+
     rc=0
     gadget_start || rc=$?
     (( rc == 0 )) || gadget_stop || true