mirror of
https://github.com/espressif/openthread.git
synced 2026-07-25 13:34:06 +00:00
[posix] add radio url (#4935)
Radio url provides a unified interface for users to specify the radio peripheral device and arguments to the OpenThread core stack.
This commit is contained in:
@@ -93,12 +93,12 @@ EOF
|
||||
|
||||
echo "Step 2. Start retrieving dataset from Radio..."
|
||||
RADIO_NCP_PATH="$(pwd)/$(ls output/*linux*/bin/ot-ncp-ftd)"
|
||||
"$(pwd)/$(ls output/posix/*linux*/bin/ot-ncp)" -n --radio-version --ncp-dataset -- "${RADIO_NCP_PATH}" 1
|
||||
"$(pwd)/$(ls output/posix/*linux*/bin/ot-ncp)" -n --radio-version "spinel+hdlc+forkpty://${RADIO_NCP_PATH}?arg=1&ncp-dataset=1"
|
||||
|
||||
echo "Step 3. Start posix app and check whether PAN dataset is the same..."
|
||||
RADIO_RCP_PATH="$(pwd)/$(ls output/*linux*/bin/ot-rcp)"
|
||||
|
||||
OT_CLI_CMD="$(pwd)/$(ls output/posix/*linux*/bin/ot-cli) ${RADIO_RCP_PATH} 1"
|
||||
OT_CLI_CMD="$(pwd)/$(ls output/posix/*linux*/bin/ot-cli) spinel+hdlc+forkpty://${RADIO_RCP_PATH}?arg=1"
|
||||
|
||||
expect <<EOF
|
||||
spawn ${OT_CLI_CMD}
|
||||
@@ -126,8 +126,9 @@ expect eof
|
||||
EOF
|
||||
|
||||
echo "Step 4. Start posix app and check whether it can get radio firmware version..."
|
||||
RADIO_VERSION="$("$(pwd)/$(ls output/posix/*linux*/bin/ot-cli)" -n --radio-version --ncp-dataset -- "${RADIO_RCP_PATH}" 1)" || true
|
||||
test -n "${RADIO_VERSION}"
|
||||
RADIO_VERSION="$("$(pwd)/$(ls output/posix/*linux*/bin/ot-cli)" -n --radio-version "spinel+hdlc+forkpty://${RADIO_RCP_PATH}?arg=1&ncp-dataset=1")" || true
|
||||
echo "${RADIO_VERSION}"
|
||||
test -n "{RADIO_VERSION}"
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -81,12 +81,10 @@ check()
|
||||
# Cover setting a valid network interface name.
|
||||
readonly VALID_NETIF_NAME="wan$(date +%H%M%S)"
|
||||
|
||||
local options=(
|
||||
'--max-power-table=11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26'
|
||||
)
|
||||
RADIO_URL="spinel+hdlc+uart://${CORE_PTY}?max-power-table=11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26"
|
||||
|
||||
if [[ ${DAEMON} == 1 ]]; then
|
||||
sudo "$(pwd)/$(ls output/posix/*linux*/bin/ot-daemon)" "${options[@]}" -I "${VALID_NETIF_NAME}" "${CORE_PTY}" &
|
||||
sudo "$(pwd)/$(ls output/posix/*linux*/bin/ot-daemon)" -I "${VALID_NETIF_NAME}" "${RADIO_URL}" &
|
||||
sleep 1
|
||||
OT_CLI_CMD="$(pwd)/$(ls output/posix/*linux*/bin/ot-ctl)"
|
||||
sudo "${OT_CLI_CMD}" panid 0xface | grep 'Done' || die 'failed to set panid with ot-ctl'
|
||||
@@ -96,14 +94,14 @@ check()
|
||||
sudo "${OT_CLI_CMD}" factoryreset
|
||||
else
|
||||
OT_CLI="$(pwd)/$(ls output/posix/*linux*/bin/ot-cli)"
|
||||
sudo "${OT_CLI}" -I "${VALID_NETIF_NAME}" -n "${CORE_PTY}"
|
||||
sudo "${OT_CLI}" -I "${VALID_NETIF_NAME}" -n "${RADIO_URL}"
|
||||
|
||||
# Cover setting a too long(max is 15 characters) network interface name.
|
||||
# Expect exit code to be 2(OT_EXIT_INVALID_ARGUMENTS).
|
||||
readonly INVALID_NETIF_NAME="wan0123456789123"
|
||||
sudo "${OT_CLI}" -I "${INVALID_NETIF_NAME}" -n "${CORE_PTY}" || test $? = 2
|
||||
sudo "${OT_CLI}" -I "${INVALID_NETIF_NAME}" -n "${RADIO_URL}" || test $? = 2
|
||||
|
||||
OT_CLI_CMD="$(pwd)/$(ls output/posix/*linux*/bin/ot-cli) ${CORE_PTY}"
|
||||
OT_CLI_CMD="$(pwd)/$(ls output/posix/*linux*/bin/ot-cli) ${RADIO_URL}"
|
||||
fi
|
||||
|
||||
sudo expect <<EOF | tee "${OT_OUTPUT}" &
|
||||
|
||||
Reference in New Issue
Block a user