mirror of
https://github.com/espressif/openthread.git
synced 2026-10-03 22:37:36 +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:
@@ -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