mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
statd: Add rx/tx bitrate to WiFi station operational data
Extend the WiFi station mode with rx-speed and tx-speed leaves, mirroring what already exists for AP mode connected stations. Display bitrates in 'show interface <wifi>' detailed view. Also standardize speed units to kbps/Mbps across the YANG model. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -218,6 +218,36 @@ submodule infix-if-wifi {
|
||||
- Below -80 dBm: Very weak";
|
||||
}
|
||||
|
||||
leaf rx-speed {
|
||||
config false;
|
||||
type uint32;
|
||||
units "100 kbps";
|
||||
description
|
||||
"Last received data rate from the access point in 100 kbps.
|
||||
|
||||
Only available when connected.
|
||||
|
||||
Examples:
|
||||
- 10 = 1 Mbps
|
||||
- 65 = 6.5 Mbps
|
||||
- 866 = 86.6 Mbps";
|
||||
}
|
||||
|
||||
leaf tx-speed {
|
||||
config false;
|
||||
type uint32;
|
||||
units "100 kbps";
|
||||
description
|
||||
"Last transmitted data rate to the access point in 100 kbps.
|
||||
|
||||
Only available when connected.
|
||||
|
||||
Examples:
|
||||
- 10 = 1 Mbps
|
||||
- 65 = 6.5 Mbps
|
||||
- 866 = 86.6 Mbps";
|
||||
}
|
||||
|
||||
list scan-results {
|
||||
config false;
|
||||
key ssid;
|
||||
@@ -421,26 +451,26 @@ submodule infix-if-wifi {
|
||||
|
||||
leaf rx-speed {
|
||||
type uint32;
|
||||
units "100 kbit/s";
|
||||
units "100 kbps";
|
||||
description
|
||||
"Last received data rate from this client in 100 kbit/s.
|
||||
"Last received data rate from this client in 100 kbps.
|
||||
|
||||
Examples:
|
||||
- 10 = 1 Mbit/s
|
||||
- 65 = 6.5 Mbit/s
|
||||
- 866 = 86.6 Mbit/s";
|
||||
- 10 = 1 Mbps
|
||||
- 65 = 6.5 Mbps
|
||||
- 866 = 86.6 Mbps";
|
||||
}
|
||||
|
||||
leaf tx-speed {
|
||||
type uint32;
|
||||
units "100 kbit/s";
|
||||
units "100 kbps";
|
||||
description
|
||||
"Last transmitted data rate to this client in 100 kbit/s.
|
||||
"Last transmitted data rate to this client in 100 kbps.
|
||||
|
||||
Examples:
|
||||
- 10 = 1 Mbit/s
|
||||
- 65 = 6.5 Mbit/s
|
||||
- 866 = 86.6 Mbit/s";
|
||||
- 10 = 1 Mbps
|
||||
- 65 = 6.5 Mbps
|
||||
- 866 = 86.6 Mbps";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1295,7 +1295,7 @@ class Iface:
|
||||
rx_bytes = station.get("rx-bytes", 0)
|
||||
tx_bytes = station.get("tx-bytes", 0)
|
||||
|
||||
# Speed in 100 kbit/s units, convert to Mbps for display
|
||||
# Speed in 100 kbps units, convert to Mbps for display
|
||||
rx_speed = station.get("rx-speed", 0)
|
||||
tx_speed = station.get("tx-speed", 0)
|
||||
rx_speed_str = f"{rx_speed / 10:.1f}" if rx_speed else "-"
|
||||
@@ -1640,6 +1640,12 @@ class Iface:
|
||||
if rssi is not None:
|
||||
signal_status = rssi_to_status(rssi)
|
||||
print(f"{'signal':<{20}}: {rssi} dBm ({signal_status})")
|
||||
rx_speed = station.get('rx-speed')
|
||||
tx_speed = station.get('tx-speed')
|
||||
if rx_speed is not None:
|
||||
print(f"{'rx bitrate':<{20}}: {rx_speed / 10:.1f} Mbps")
|
||||
if tx_speed is not None:
|
||||
print(f"{'tx bitrate':<{20}}: {tx_speed / 10:.1f} Mbps")
|
||||
if "scan-results" in station:
|
||||
self.pr_wifi_ssids()
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ def wifi_station(ifname):
|
||||
station_data['ssid'] = link['ssid']
|
||||
if link.get('rssi') is not None:
|
||||
station_data['rssi'] = link['rssi']
|
||||
if link.get('rx-speed') is not None:
|
||||
station_data['rx-speed'] = link['rx-speed']
|
||||
if link.get('tx-speed') is not None:
|
||||
station_data['tx-speed'] = link['tx-speed']
|
||||
|
||||
# Get scan results from wpa_supplicant (better scan support)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user