diff options
author | William A. Kennington III <wak@google.com> | 2022-03-01 05:05:54 +0300 |
---|---|---|
committer | linchuyuan <linchuyuan@google.com> | 2022-03-05 04:03:10 +0300 |
commit | f8a7774abd5e8650038240d45f590fb3cdc79fb3 (patch) | |
tree | b160033482f5a71010d4352044bd18dc61b5199d /meta-google/recipes-google/networking | |
parent | 9c528c9172d7174fcd19c7b312864fc204fb7949 (diff) | |
download | openbmc-f8a7774abd5e8650038240d45f590fb3cdc79fb3.tar.xz |
meta-google: google-usb-network: Allow picking device type
This makes it possible to choose something other than EEM.
Change-Id: Id3bd080efa63eddd1d413df19bc373eef96ac359
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google/recipes-google/networking')
3 files changed, 14 insertions, 4 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 7893ba4ccf..c65b815602 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 @@ -18,6 +18,7 @@ RemainAfterExit=yes ExecStart=M_SCRIPT_INSTALL_DIR/usb_network.sh \ --product-id "M_BMC_USB_PRODUCT_ID" \ --product-name "M_BMC_USB_PRODUCT_NAME" \ + --dev-type "M_BMC_USB_TYPE" \ HOST_MAC_ARG(M_BMC_USB_HOST_MAC) \ DEV_MAC_ARG(M_BMC_USB_DEV_MAC) \ --bind-device "M_BMC_USB_BIND_DEV" 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 ede4482440..6f2c4d5b5b 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 @@ -23,6 +23,7 @@ ARGUMENT_LIST=( "host-mac:" "bind-device:" "dev-mac:" + "dev-type:" "gadget-dir-name:" "iface-name:" ) @@ -35,6 +36,7 @@ $0 [OPTIONS] [stop|start] --product-name Product name string (en) for the gadget. --host-mac MAC address of the host part of the connection. Optional. --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" --iface-name Optional name of the network interface. Default: "usb0" @@ -71,9 +73,9 @@ EOF mkdir -p "${config_dir}" echo 100 > "${config_dir}/MaxPower" mkdir -p "${config_dir}/strings/0x409" - echo "EEM" > "${config_dir}/strings/0x409/configuration" + echo "${DEV_TYPE^^}" > "${config_dir}/strings/0x409/configuration" - local func_dir="${gadget_dir}/functions/eem.${IFACE_NAME}" + local func_dir="${gadget_dir}/functions/${DEV_TYPE}.${IFACE_NAME}" mkdir -p "${func_dir}" if [[ -n $HOST_MAC_ADDR ]]; then @@ -91,11 +93,11 @@ EOF gadget_stop() { local gadget_dir="${CONFIGFS_HOME}/usb_gadget/${GADGET_DIR_NAME}" - rm -f ${gadget_dir}/configs/c.1/eem.${IFACE_NAME} + rm -f ${gadget_dir}/configs/c.1/${DEV_TYPE}.${IFACE_NAME} rm -rf ${gadget_dir}/configs/c.1/strings/0x409 rm -rf ${gadget_dir}/configs/c.1 rm -rf ${gadget_dir}/strings/0x409 - rm -rf ${gadget_dir}/functions/eem.${IFACE_NAME} + rm -rf ${gadget_dir}/functions/${DEV_TYPE}.${IFACE_NAME} rm -rf ${gadget_dir} rm -f /run/systemd/network/+-bmc-"${IFACE_NAME}".network @@ -117,6 +119,7 @@ ID_PRODUCT="" STR_EN_VENDOR="Google" STR_EN_PRODUCT="" DEV_MAC_ADDR="" +DEV_TYPE="eem" HOST_MAC_ADDR="" BIND_DEVICE="" ACTION="start" @@ -140,6 +143,10 @@ while [[ $# -gt 0 ]]; do DEV_MAC_ADDR=$2 shift 2 ;; + --dev-type) + DEV_TYPE=$2 + shift 2 + ;; --bind-device) BIND_DEVICE=$2 shift 2 diff --git a/meta-google/recipes-google/networking/google-usb-network_git.bb b/meta-google/recipes-google/networking/google-usb-network_git.bb index eb079597c4..882b755f8e 100644 --- a/meta-google/recipes-google/networking/google-usb-network_git.bb +++ b/meta-google/recipes-google/networking/google-usb-network_git.bb @@ -25,6 +25,7 @@ BMC_USB_ECM_DEV_MAC ??= "invalid" BMC_USB_ECM_BIND_DEV ??= "" BMC_USB_CONFIG_PRIORITY ??= "" BMC_USB_CONFIG_FILENAME ??= "${BMC_USB_CONFIG_PRIORITY}-bmc-usb0.network" +BMC_USB_TYPE ??= "eem" SRC_URI += "file://00-bmc-usb0.network.m4" SRC_URI += "file://usb_network.service.m4" @@ -44,6 +45,7 @@ do_compile() { m4 \ -DM_BMC_USB_PRODUCT_ID="${BMC_USB_ECM_PRODUCT_ID}" \ -DM_BMC_USB_PRODUCT_NAME="${BMC_USB_ECM_PRODUCT_NAME}" \ + -DM_BMC_USB_TYPE="${BMC_USB_TYPE}" \ -DM_BMC_USB_HOST_MAC="${BMC_USB_ECM_HOST_MAC}" \ -DM_BMC_USB_DEV_MAC="${BMC_USB_ECM_DEV_MAC}" \ -DM_BMC_USB_BIND_DEV="${BMC_USB_ECM_BIND_DEV}" \ |