mirror of
https://github.com/espressif/openthread.git
synced 2026-07-24 04:54:06 +00:00
Windows: Fix bug with Querying Device Capablities (#1382)
* Fix bug with querying device capablities * Another similar bug with querying factory address property
This commit is contained in:
@@ -471,7 +471,7 @@ Return Value:
|
||||
}
|
||||
|
||||
// Query the device capabilities
|
||||
NtStatus = otLwfCmdGetProp(pFilter, SpinelCapsDataBuffer, SPINEL_PROP_CAPS, SPINEL_DATATYPE_DATA_S, &SpinelCapsPtr, &SpinelCapsLen);
|
||||
NtStatus = otLwfCmdGetProp(pFilter, &SpinelCapsDataBuffer, SPINEL_PROP_CAPS, SPINEL_DATATYPE_DATA_S, &SpinelCapsPtr, &SpinelCapsLen);
|
||||
if (!NT_SUCCESS(NtStatus))
|
||||
{
|
||||
NdisStatus = NDIS_STATUS_NOT_SUPPORTED;
|
||||
@@ -480,18 +480,21 @@ Return Value:
|
||||
}
|
||||
|
||||
// Iterate and process returned capabilities
|
||||
NT_ASSERT(SpinelCapsDataBuffer);
|
||||
while (SpinelCapsLen > 0)
|
||||
{
|
||||
ULONG SpinelCap = 0;
|
||||
spinel_ssize_t len = spinel_datatype_unpack(SpinelCapsPtr, SpinelCapsLen, SPINEL_DATATYPE_UINT_PACKED_S, &SpinelCap);
|
||||
if (len < 1) break;
|
||||
SpinelCapsLen -= (spinel_size_t)len;
|
||||
SpinelCapsPtr += len;
|
||||
|
||||
switch (SpinelCap)
|
||||
{
|
||||
case SPINEL_CAP_MAC_RAW:
|
||||
pFilter->DeviceCapabilities |= OTLWF_DEVICE_CAP_RADIO;
|
||||
pFilter->DeviceCapabilities |= OTLWF_DEVICE_CAP_RADIO_ACK_TIMEOUT;
|
||||
pFilter->DeviceCapabilities |= OTLWF_DEVICE_CAP_RADIO_MAC_RETRY_AND_COLLISION_AVOIDANCE;
|
||||
pFilter->DeviceCapabilities |= OTLWF_DEVICE_CAP_RADIO_ENERGY_SCAN;
|
||||
break;
|
||||
case SPINEL_CAP_NET_THREAD_1_0:
|
||||
|
||||
@@ -116,6 +116,7 @@ otLwfRadioGetFactoryAddress(
|
||||
)
|
||||
{
|
||||
NTSTATUS status;
|
||||
PVOID SpinelBuffer = NULL;
|
||||
uint8_t *hwAddress = NULL;
|
||||
|
||||
RtlZeroMemory(&pFilter->otFactoryAddress, sizeof(pFilter->otFactoryAddress));
|
||||
@@ -124,7 +125,7 @@ otLwfRadioGetFactoryAddress(
|
||||
status =
|
||||
otLwfCmdGetProp(
|
||||
pFilter,
|
||||
NULL,
|
||||
&SpinelBuffer,
|
||||
SPINEL_PROP_HWADDR,
|
||||
SPINEL_DATATYPE_EUI64_S,
|
||||
&hwAddress
|
||||
@@ -135,7 +136,9 @@ otLwfRadioGetFactoryAddress(
|
||||
return;
|
||||
}
|
||||
|
||||
NT_ASSERT(SpinelBuffer);
|
||||
memcpy(&pFilter->otFactoryAddress, hwAddress, sizeof(pFilter->otFactoryAddress));
|
||||
FILTER_FREE_MEM(SpinelBuffer);
|
||||
|
||||
LogInfo(DRIVER_DEFAULT, "Interface %!GUID! cached factory Extended Mac Address: %llX", &pFilter->InterfaceGuid, pFilter->otFactoryAddress);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user