mirror of
https://github.com/espressif/openthread.git
synced 2026-10-11 18:27:43 +00:00
[posix-app] check spinel version of RCP from RaioSpinel::Init() (#3141)
This commit is contained in:
committed by
Jonathan Hui
parent
7c8a37263b
commit
e6df05b7eb
@@ -541,6 +541,24 @@ void RadioSpinel::Init(const char *aRadioFile, const char *aRadioConfig)
|
|||||||
SuccessOrExit(error = Get(SPINEL_PROP_HWADDR, SPINEL_DATATYPE_UINT64_S, &gNodeId));
|
SuccessOrExit(error = Get(SPINEL_PROP_HWADDR, SPINEL_DATATYPE_UINT64_S, &gNodeId));
|
||||||
gNodeId = ot::Encoding::BigEndian::HostSwap64(gNodeId);
|
gNodeId = ot::Encoding::BigEndian::HostSwap64(gNodeId);
|
||||||
|
|
||||||
|
{
|
||||||
|
unsigned int versionMajor;
|
||||||
|
unsigned int versionMinor;
|
||||||
|
|
||||||
|
SuccessOrExit(error = Get(SPINEL_PROP_PROTOCOL_VERSION,
|
||||||
|
(SPINEL_DATATYPE_UINT_PACKED_S SPINEL_DATATYPE_UINT_PACKED_S), &versionMajor,
|
||||||
|
&versionMinor));
|
||||||
|
|
||||||
|
if ((versionMajor != SPINEL_PROTOCOL_VERSION_THREAD_MAJOR) ||
|
||||||
|
(versionMinor != SPINEL_PROTOCOL_VERSION_THREAD_MINOR))
|
||||||
|
{
|
||||||
|
otLogCritPlat(mInstance, "Spinel version mismatch - PosixApp:%d.%d, RCP:%d.%d",
|
||||||
|
SPINEL_PROTOCOL_VERSION_THREAD_MAJOR, SPINEL_PROTOCOL_VERSION_THREAD_MINOR, versionMajor,
|
||||||
|
versionMinor);
|
||||||
|
ExitNow(error = OT_ERROR_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned int caps;
|
unsigned int caps;
|
||||||
SuccessOrExit(error = Get(SPINEL_PROP_RADIO_CAPS, SPINEL_DATATYPE_UINT_PACKED_S, &caps));
|
SuccessOrExit(error = Get(SPINEL_PROP_RADIO_CAPS, SPINEL_DATATYPE_UINT_PACKED_S, &caps));
|
||||||
|
|||||||
Reference in New Issue
Block a user