Skip to content

luci-mod-network: txpower value 0 dBm displayed as "driver default" instead of "1 mW" #8536

@Sm00shed

Description

@Sm00shed

Is there an existing issue for this?

  • I have searched among all existing issues (including closed issues)

screenshots or captures

No screenshot available. The bug is reproducible on any OpenWrt 25.12.2 device with WLAN by setting txpower to 0 dBm in LuCI under Network > Wireless.

Actual behaviour

When setting the transmit power to 0 dBm in LuCI under Network > Wireless, the dropdown displays "driver default" instead of "0 dBm (1 mW)". Setting 1 dBm works correctly and displays "1 mW".

Expected behaviour

0 dBm should display "0 dBm (1 mW)" like any other value in the list.

Steps to reproduce

  1. Go to Network → Wireless
  2. Click Edit on a radio
  3. Set Maximum transmit power to 0 dBm
  4. Save and Apply
  5. Reopen the edit dialog — dropdown shows "driver default" instead of "0 dBm (1 mW)"

Additional Information

ubus call system board
{
  "model": "OpenWrt One",
  "release": {
    "version": "25.12.2",
    "revision": "r32802-f505120278",
    "target": "mediatek/filogic"
  }
}

Root cause:
In modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js in class CBIWifiTxPowerValue:

Bug — p.dbm is a Number, UCI returns a String:
this.value(p.dbm, `${p.dbm} dBm (${p.mw} mW)`);

Fix — convert to String for correct comparison:
this.value(String(p.dbm), `${p.dbm} dBm (${p.mw} mW)`);

UCI always returns strings. The comparison "0" === 0 fails in JavaScript — so the dropdown finds no matching entry and falls back to "driver default".

Proof — console test on the wireless edit page:
document.querySelector('select[id*="txpower"]').options[1].value
'0' ← string with quotes confirmed

What browsers do you see the problem on?

No response

Relevant log output

Browser independent — the bug is in the JavaScript code, not browser specific.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions