summaryrefslogtreecommitdiff
path: root/meta-google
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2022-04-05 03:51:09 +0300
committerWilliam A. Kennington III <wak@google.com>2022-04-06 01:48:12 +0300
commit69ebd2cebd2a16a116163400831920c757542cfd (patch)
tree14b170d629b2710a7fa876d8e4813aa2dff3f539 /meta-google
parentab8ea8d59aafe93229a2bfa47300e22ac5beb1b5 (diff)
downloadopenbmc-69ebd2cebd2a16a116163400831920c757542cfd.tar.xz
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>
Diffstat (limited to 'meta-google')
-rw-r--r--meta-google/recipes-google/networking/google-usb-network/usb_network.service.m41
-rwxr-xr-xmeta-google/recipes-google/networking/google-usb-network/usb_network.sh19
2 files changed, 18 insertions, 2 deletions
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 c65b815602..cefaff9400 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 @@ ExecStart=M_SCRIPT_INSTALL_DIR/usb_network.sh \
--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 cbe7d0aefa..ebba57d0b6 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 @@ $0 [OPTIONS] [stop|start]
--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 @@ HOST_MAC_ADDR=""
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 @@ fi
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