Files
Sven Kirmess a61151a5d0 [posix] add a tx-power radio URL parameter (#13574)
The radio URL can configure the CCA threshold, the FEM LNA gain, the
region and a per-channel power cap, but not the power the radio actually
transmits at. `ot-ctl txpower` sets it at runtime only, so a deployment
cannot be brought up from its configuration alone -- something has to
issue a CLI command after every start.

`max-power-table` does not cover this. It is a cap: the effective power
is `min(txPower, channelMax)`, so it can lower the power but never raise
it above whatever the RCP happens to be at. Nothing on the host sets that
power during initialisation, and OPENTHREAD_CONFIG_DEFAULT_TRANSMIT_POWER
is consumed by the platform layer rather than here, so an RCP-based
deployment runs at whatever constant its RCP firmware was built with.

This adds `tx-power[=dbm]`, applied during radio initialisation next to
`cca-threshold` and `fem-lnagain`. The two combine rather than override:
the radio transmits at `min(tx-power, max-power-table)`, which the help
text spells out -- conditionally, since `max-power-table` is itself behind
OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE and a build without it
would otherwise point at a parameter its own help does not list.

`tests/scripts/expect/posix-tx-power.exp` covers it, following
posix-ccathreshold.exp: two valid values, the two int8 boundaries that
must be rejected, and a run without the parameter that must report 0 dBm
-- without that last case the test could not tell a value that came from
the radio URL from one the radio happened to be at. Because it goes through
`RadioSpinel::SetTransmitPower()`, it also lands in the restoration
bookkeeping and survives an RCP reset.

Measured against a simulated RCP:

  tx-power=11    ot-ctl txpower -> 11 dBm
  no parameter   ot-ctl txpower ->  0 dBm

and against an SLZB-06M (EFR32, SL-OPENTHREAD/2.4.2.0), with the radio
deliberately set to 5 dBm beforehand so neither the default nor a
retained value could explain the result:

  tx-power=11    ot-ctl txpower -> 10 dBm

10 rather than 11 because the EFR32 selects the nearest step at or below
the requested power; 5 reads back as 4 for the same reason.

Closes #13573
2026-09-07 00:27:54 +02:00
..