SilverAzide / Gadgets

Gadgets for Rainmeter
Other
351 stars 12 forks source link

7.1.1 Network Meter speeds are still multiplied when adapters not selected (set to 0) #29

Closed hijomojo closed 2 years ago

hijomojo commented 2 years ago

Hey there,

Firstly, big thanks for your work on this project!

Since updating from 5.0.0 to 7.1.1 (yes...wow) I noticed the standard Network Monitor skin was reporting values which appeared to be multiples of the correct values (as reported by some on the forum). However, your patch notes for 7.1.1 mention this was fixed...

Corrected Network Meter regression issue where monitoring could report incorrect values if no adapters were configured.

The issue remains for me, though I can provide possible some extra info...

  1. Having all 3 interface options set to "0" as they are when the skin is first installed results in the values which appear to be triple the true rate e.g. ~4MB/s download shows as around 12MB/s in the skin.
  2. Having the Ethernet Interface option set to the correct card (I just used the auto-configure), but the other 2 interfaces set to "0", results in values which appear to be double the true rate.
  3. Having the Ethernet option set, and the Wireless Interface set to blank (which is what I got when clicking auto-configure for that) results in the correct speed values being shown in the skin. "Other Interface" is still "0" in this case. As you'd know, this directly translates to the "InterfaceWireless=" line in "Network Varliables.inc" having the "0" removed...perhaps a simple fix is to pre-configure this file to have the Ethernet and Wireless interfaces (or all 3) set to blank, instead of to "0"? I tested this with success.

For reference, the computer I figured this out on has 2 Realtek GBE devices, and no wireless network devices. Only 1 of the 2 GBE cards is actually in use, the other had no cable attached during testing. Windows 10 20H1 b19043.1288

SilverAzide commented 2 years ago

Thank you for testing and feedback!

How did you set the interface option to "0"? This is not a proper value and will definitely cause duplicated (or more) values due to the most recent changes to Rainmeter. The auto-configure option should select full adapter names (not numbers), so if you are getting numbers let me know. In the latest Rainmeter, "0" now translates to "Best" (i.e., the active adapter); it used to mean "all adapters". So setting the names to "0" will cause the skin to report the active adapter 3 times (tripling the values, as you found).

Is there a chance you upgraded your v5.x installation from an even older version of the Gadgets? Back in the Rainmeter 3.x days, numeric indexes were used instead of adapter names, so if you upgraded an older version to 5.x, it could have retained the original numeric values, and retained them again for the v7.x upgrade. Numeric adapter indexes have not been used in the Gadgets for many years, and are never recommended as they are highly inaccurate.

When the skin is first installed (i.e., not upgraded), the interface names are set to be all blanks (not "0"), as you recommend. Then, the first time you run the skin, it will attempt to automatically set the interface names of your ethernet and Wi-Fi adapters. But this should never result in a number value, it should only be text. You can change the auto-config values afterwards (it only tries the auto-config one time, then never again).

So in your case, from the description you gave me of your PC, the proper configuration of the Network Meter is your ethernet interface should be set to the name of your adapter, then the wireless and "other/broadband" interfaces should be blank (not "0" or anything else).

This should also be what you get if you do a clean install of the Gadgets. To do a clean install (if you want to try it), copy the Gadgets folder someplace safe, install the Gadgets but be sure to use the Advanced button to uncheck the "Backup skins" option, then test the Network Meter. When you are done testing, delete the Gadgets folder and replace it with the copy you saved, then refresh Rainmeter again. Alternatively, you can edit the NetworkVariables.inc file and trick the Network Meter into thinking you have a fresh install. To do this. open the file with Notepad or your preferred editor and change the variables as follows:

InterfaceAutoConfig=1
InterfaceBroadband=
InterfaceEthernet=
InterfaceWireless=

Save the file and refresh the Network Meter. If you inspect the variables file again, the "auto config" setting will be zero, and your ethernet interface will be the name of your adapter. Since you have no wifi card, the rest of the options will still be set to blank.

Let me know how it goes!

SilverAzide commented 2 years ago

I just checked my archives; the last version of the Gadgets that used numeric adapter indexes was Gadgets 2.3.0, released May 2017. In that version, a "0" index meant "disabled", and all indexes set to "0" implied that the skin was to monitor only the single active interface (which was the default configuration). The Gadgets 3.0.0 was a complete rewrite that used the new features of Rainmeter 3.3.0, which could use adapter names instead of numbers.

So my guess is that your installation of the Gadgets was upgraded over the years from the v2.x days, and the settings were carried over from their original numeric values. Your Network Meter has probably not been reporting correct values all along, but the Rainmeter 4.5.3 release has a breaking change for backward compatibility that for sure would be noticeable.

hijomojo commented 2 years ago

Thanks for the quick, and super detailed replies.

I'm glad I mentioned the previous version I was using...wasn't sure if it'd mean anything when I was originally writing that. I just had another look at my copies of the skins after reading your detailed explanation and found some interesting things.

To answer your first question, in testing, I set the interface options to "0" just by manually editing lines 29-31 in Network Variables.inc from the @Resources folder. However, that was actually how they were set after installing the skin. My testing process didn't involve adding or setting things to values other than examples I'd seen from the skin previously (in the .inc or in the config/settings skin for network meter). The solution I figured out was exactly what you described there at the end of your first message.

The curious thing here is, when I "updated" to v7.1.1 a few weeks ago (during which I updated rainmeter, too, of course) I actually did a similar process to what you describe for a "clean install"...however, rather than moving the old skin folder to another parent directory outside of Documents/Rainmeter/Skins/, I simply renamed the old skin from "Gadgets" to "Gadgets(versionNumber)" e.g. Gadget5.0.0 . I did this same process yesterday to test my original 7.1.1 install against a new "clean" one. On top of that, I've just tested again, this time completely removing all Gadgets folders from Documents/Rainmeter/Skins/ and got the same behaviour as I described in my OP, which is that the interface values start off being set to "0". image

I was about to ask "Could these values be getting pulled from some other Rainmeter file, or perhaps something in the @Backup folder?"...but figured I'd test this myself. The answer appears to be: yes, they are coming from stuff in the @Backup folder. Even though I removed the old skin folders completely, and used the "Add" action in the skin installer (i.e. no backup), I suppose Rainmeter must always check if there's a backup when first loading a skin and try to port settings over from that. When I deleted the @Backup folder, and did another clean install, the skins loaded with the very obvious default settings. (I had super old backups in there, probably from Gadgets versions 2.1 and 2.2)

I think you pretty much hit the nail on the head with your second message; judging by the Rainmeter files I have lying around, I think I went from Gadgets 2.1, to 2.2, then to 5.0.0, and must've used "Backup and replace" both times, giving me the 2 backup versions I had. This all worked fine, and I definitely had accurate network speeds displayed in the gadget up until the updating I did a few weeks ago (I often refer to/cross reference its speeds, plus had never seen it go to values anywhere near as high as I have been since that update). However, the fact those old backups still existed, and that I did a "clean" install to update from v5.0.0 to v7.1.1, meant that instead of Rainmeter porting the settings from my 5.0.0 install, it grabbed old junk from the most recent backup which was from v2.2 . That coupled with the changes Rainmeter made in network interface handling in 4.5.3, gave me the issue! Quite ironic...if I'd have remembered/trusted the skin installer to backup the 5.0.0 skin, the 7.1.1 version would have pulled in working settings from that backup! (I since checked the .inc file from 5.0.0, it didn't have the stupid "0"s in there). I wonder though, if I had this issue years ago when updating to 5.0.0, or if in that update Rainmeter correctly set the interface values to blank instead of bringing the "0"s over from the backup?

Bit of a perfect storm of a deprecation and a PEBCAK error on my part! Thanks very much for all the info which helped in figuring this out 😁

SilverAzide commented 2 years ago

Aha! Good news! You are right, the only way those zeros get in there is when the skin installer tries to restore them from the backup folder. If you are ever curious, you can rename the .rmskin extension to .zip and look at the files that get installed. You'll get to see what is in the skin package before the installer changes anything.

Actually, it is my mistake for not properly renaming the variables when their usage changed. I should have changed the variable names to something else when I transitioned them from index numbers to adapter names; that way upgrades would not have migrated bad data into the newer variables files.

Anyway, glad it is all working for you again! 👍