wifi-scripts: iwinfo: don't show bitrate unit when unknown

When bitrate is unknown, the units shouldn't be displayed. This is
consistent with other "unknown" fields and non-ucode iwinfo.

Signed-off-by: Sean Khan <datapronix@protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/18039
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Sean Khan 2025-02-19 17:22:29 -05:00 committed by Robert Marko
parent 144ac2e29e
commit 9bcc287414

View file

@ -11,7 +11,7 @@ function print_assoclist(stations) {
let bitrate = station[k];
let flags = join(', ', bitrate.flags);
printf(`\t${uc(k)}: ${bitrate.bitrate} MBit/s`);
printf(`\t${uc(k)}: ${bitrate.bitrate == 'unknown' ? 'unknown' : bitrate.bitrate + ' MBit/s'}`);
if (length(bitrate.flags))
printf(', %s', flags);
printf('%10d Pkts.\n', bitrate.packets);
@ -48,7 +48,7 @@ function print_info(list) {
printf(`${padding}Center Channel 1: ${bss.center_freq1} 2: ${bss.center_freq2}\n`);
printf(`${padding}Tx-Power: ${bss.txpower} dBm Link Quality: ${bss.quality}/70\n`);
printf(`${padding}Signal: ${bss.signal} Noise: ${bss.noise}\n`);
printf(`${padding}Bit Rate: ${bss.bitrate ?? 'unknown'} MBit/s\n`);
printf(`${padding}Bit Rate: ${bss.bitrate == 'unknown' ? 'unknown' : bss.bitrate + ' MBit/s'}\n`);
printf(`${padding}Encryption: ${bss.encryption}\n`);
printf(`${padding}Type: nl80211 HW Mode(s): 802.11${bss.hwmode}\n`);
printf(`${padding}Hardware: ${bss.hw_type} [${bss.hw_id}]\n`);