mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
web: show the speed a port is set to, not always auto
The speed selector on the Ports tab was filled with its options and never given a value, so it read "auto" on every load whatever the port was set to. Forcing a port to 1G and reloading showed "auto" in the selector beside a link badge reading 1G. The advertisement bits ports.json already reports say what the port is set to: phy_set_speed() writes the same three registers the JSON reads back, and every forced speed leaves exactly one of the six bits standing while auto leaves the lot. Map those to the selector, and leave it alone while it has focus, as the MTU field does. Values with no entry in the table, such as the 100M setting that advertises both duplex modes, leave the selector untouched rather than claim a setting the list cannot express.
This commit is contained in:
1 parent
0cc09e4015
commit
93003c8cb8
1 file changed
+3
@@ -723,6 +723,7 @@ tabHooks.dash={
|
||||
var SPEEDS=[["auto","c_auto"],["2g5","2.5G"],["1g","1G"],["100m full","100M full"],
|
||||
["100m half","100M half"],["10m full","10M full"],["10m half","10M half"]];
|
||||
var SFPRATES=[["auto","c_auto"],["10g","10G"],["2g5","2.5G"],["1g","1G"],["100m","100M"]];
|
||||
var ADVSEL={63:"auto",31:"auto",32:"2g5",16:"1g",8:"100m full",4:"100m half",2:"10m full",1:"10m half"};
|
||||
function speedLabel(s){
|
||||
if(s==="c_auto")return t("c_auto");
|
||||
return s.replace(" full"," "+t("c_full")).replace(" half"," "+t("c_half"));
|
||||
@@ -785,6 +786,8 @@ function portsStatus(){
|
||||
S.ports.forEach(function(p){
|
||||
var i=p.portNum-1,el=$("plink"+i);
|
||||
if(el)el.innerHTML=linkBadge(p);
|
||||
var sel=$("pspd"+i),v=p.isSFP?0:ADVSEL[parseInt(p.adv,2)];
|
||||
if(sel&&v&&document.activeElement!==sel)sel.value=v;
|
||||
});
|
||||
}
|
||||
function applyPort(i){
|
||||
|
||||
Reference in new issue
Block a user