Remove unreliable max bitrate from Speed line
NM.AccessPoint.get_max_bitrate() reports a value that doesn't account for MIMO spatial streams or extended channel widths, leading to the negotiated speed appearing higher than the supposed max (e.g. 1729 vs 540). Remove the max from the connected info Speed line where the comparison is misleading. Keep it in the AP list where it serves as a relative indicator between access points.
This commit is contained in:
parent
244d69919d
commit
87c5001da1
4 changed files with 6 additions and 17 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
"name": "WiFi Signal Plus",
|
"name": "WiFi Signal Plus",
|
||||||
"description": "Displays WiFi generation (4/5/6/7) in the top bar with detailed connection info on hover",
|
"description": "Displays WiFi generation (4/5/6/7) in the top bar with detailed connection info on hover",
|
||||||
"shell-version": ["45", "46", "47", "48", "49"],
|
"shell-version": ["45", "46", "47", "48", "49"],
|
||||||
"version": 6,
|
"version": 7,
|
||||||
"url": "https://github.com/JalilArfaoui/gnome-extension-wifi-signal-plus",
|
"url": "https://github.com/JalilArfaoui/gnome-extension-wifi-signal-plus",
|
||||||
"donations": {
|
"donations": {
|
||||||
"liberapay": "Jalil"
|
"liberapay": "Jalil"
|
||||||
|
|
|
||||||
|
|
@ -603,27 +603,18 @@ export default class WifiSignalPlusExtension extends Extension {
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatBitrate(info: ConnectedInfo): string {
|
private formatBitrate(info: ConnectedInfo): string {
|
||||||
const { txBitrate, rxBitrate, bitrate, maxBitrate } = info;
|
const { txBitrate, rxBitrate, bitrate } = info;
|
||||||
|
|
||||||
let speed: string;
|
|
||||||
if (txBitrate !== null && rxBitrate !== null) {
|
if (txBitrate !== null && rxBitrate !== null) {
|
||||||
const tx = txBitrate as number;
|
const tx = txBitrate as number;
|
||||||
const rx = rxBitrate as number;
|
const rx = rxBitrate as number;
|
||||||
speed = tx === rx ? `${tx} Mbit/s` : `↑${tx} ↓${rx} Mbit/s`;
|
return tx === rx ? `${tx} Mbit/s` : `↑${tx} ↓${rx} Mbit/s`;
|
||||||
} else if (txBitrate !== null) {
|
} else if (txBitrate !== null) {
|
||||||
speed = `↑${txBitrate} Mbit/s`;
|
return `↑${txBitrate} Mbit/s`;
|
||||||
} else if (rxBitrate !== null) {
|
} else if (rxBitrate !== null) {
|
||||||
speed = `↓${rxBitrate} Mbit/s`;
|
return `↓${rxBitrate} Mbit/s`;
|
||||||
} else {
|
|
||||||
speed = `${bitrate} Mbit/s`;
|
|
||||||
}
|
}
|
||||||
|
return `${bitrate} Mbit/s`;
|
||||||
const max = maxBitrate as number;
|
|
||||||
if (max > 0) {
|
|
||||||
speed += ` (max ${max})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return speed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatChannelWidth(width: ChannelWidthMHz | null): string {
|
private formatChannelWidth(width: ChannelWidthMHz | null): string {
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@ export interface ConnectedInfo extends BaseConnectionInfo {
|
||||||
readonly channelWidth: ChannelWidthMHz | null;
|
readonly channelWidth: ChannelWidthMHz | null;
|
||||||
readonly txBitrate: BitrateMbps | null;
|
readonly txBitrate: BitrateMbps | null;
|
||||||
readonly rxBitrate: BitrateMbps | null;
|
readonly rxBitrate: BitrateMbps | null;
|
||||||
readonly maxBitrate: BitrateMbps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScannedNetwork {
|
export interface ScannedNetwork {
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,6 @@ export class WifiInfoService {
|
||||||
channelWidth: iwInfo.channelWidth,
|
channelWidth: iwInfo.channelWidth,
|
||||||
txBitrate: iwInfo.txBitrate,
|
txBitrate: iwInfo.txBitrate,
|
||||||
rxBitrate: iwInfo.rxBitrate,
|
rxBitrate: iwInfo.rxBitrate,
|
||||||
maxBitrate: asBitrateMbps(ap.get_max_bitrate() / 1000),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue