Skip to content

Commit 5d10928

Browse files
lexfreiclaude
andcommitted
fix(bindings): correct otRadioCaps type to u16 for riscv32imac
The riscv32imac bindings incorrectly defined otRadioCaps as u8, but OT_RADIO_CAPS_RX_ON_WHEN_IDLE = 256 which doesn't fit in u8. This caused the capability to be silently truncated to 0, preventing OpenThread from calling otPlatRadioSetRxOnWhenIdle callback. Changes: - Change otRadioCaps from u8 to u16 in riscv32imac bindings - Add missing OT_RADIO_CAPS_RX_ON_WHEN_IDLE constant (256) - Use proper import in lib.rs instead of local const Co-Authored-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 8e42bae commit 5d10928

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

openthread-sys/src/include/riscv32imac-unknown-none-elf.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ pub type _bindgen_ty_4 = ::core::ffi::c_uint;
28302830
/// Represents radio capabilities.
28312831
///
28322832
/// The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions.
2833-
pub type otRadioCaps = u8;
2833+
pub type otRadioCaps = u16;
28342834
///< Radio supports no capability.
28352835
pub const OT_RADIO_CAPS_NONE: _bindgen_ty_5 = 0;
28362836
///< Radio supports AckTime event.
@@ -2849,6 +2849,8 @@ pub const OT_RADIO_CAPS_TRANSMIT_SEC: _bindgen_ty_5 = 32;
28492849
pub const OT_RADIO_CAPS_TRANSMIT_TIMING: _bindgen_ty_5 = 64;
28502850
///< Radio supports rx at specific time.
28512851
pub const OT_RADIO_CAPS_RECEIVE_TIMING: _bindgen_ty_5 = 128;
2852+
///< Radio supports RxOnWhenIdle setting.
2853+
pub const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: _bindgen_ty_5 = 256;
28522854
/// Defines constants that are used to indicate different radio capabilities. See `otRadioCaps`.
28532855
pub type _bindgen_ty_5 = ::core::ffi::c_uint;
28542856
/// Represents the IEEE 802.15.4 PAN ID.

openthread/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ use sys::{
7878
otPlatRadioTxDone, otPlatRadioTxStarted, otRadioCaps, otRadioFrame, otSetStateChangedCallback,
7979
otTaskletsProcess, otThreadGetDeviceRole, otThreadGetExtendedPanId, otThreadSetEnabled,
8080
otThreadSetLinkMode, OT_RADIO_CAPS_ACK_TIMEOUT, OT_RADIO_CAPS_CSMA_BACKOFF,
81-
OT_RADIO_FRAME_MAX_SIZE,
81+
OT_RADIO_CAPS_RX_ON_WHEN_IDLE, OT_RADIO_FRAME_MAX_SIZE,
8282
};
8383

8484
/// A newtype wrapper over the native OpenThread error type (`otError`).
@@ -1427,8 +1427,6 @@ impl<'a> OtContext<'a> {
14271427
}
14281428

14291429
fn plat_radio_caps(&mut self) -> otRadioCaps {
1430-
// OT_RADIO_CAPS_RX_ON_WHEN_IDLE = 256, not in all bindgen targets
1431-
const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: u32 = 256;
14321430
let caps =
14331431
(OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF | OT_RADIO_CAPS_RX_ON_WHEN_IDLE)
14341432
as _;

0 commit comments

Comments
 (0)