Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermal shows NaN since the last update #520

Closed
Negirno opened this issue May 2, 2019 · 19 comments
Closed

Thermal shows NaN since the last update #520

Negirno opened this issue May 2, 2019 · 19 comments

Comments

@Negirno
Copy link

Negirno commented May 2, 2019

Yesterday, I've got an update for this extension. Today, I've noticed that the thermals are only showing NaN (not a number) in the extension. Psensor displays it correctly.

I'm using Ubuntu 18.04 64-bit with kernel 4.15.0-48-generic on an Intel Core i3-2100.

@IjonFryderyk
Copy link

Same here (Ubuntu 18.04 4.18.0-18-generic) regardless of chosen sensor.

@aroskuski
Copy link

It seems like my Ubuntu 18.04 system has the same issue, but not my Ubuntu 19.04 one.

The Frequency stat seems to have a similar issue on Ubuntu 18.04.

@TimP69
Copy link

TimP69 commented May 3, 2019

Also seeing NaN in thermals now — regardless of sensor selected.
Ubuntu 18.04.2 LTS. Kernel 4.18.0-18-generic. Gnome 3.28.2.

@Cdmium
Copy link

Cdmium commented May 3, 2019

Also Fan and Frequency show NaN
Ubuntu 18.04.2 LTS Kernel 4.15.0-48-generic gnome 3.28.3

@chrisspen
Copy link
Collaborator

I've confirmed this as well. It looks like the value returned source.load_contents_finish(result)[1] inside the Thermal.refresh() method isn't a simple numeric value.

@chrisspen
Copy link
Collaborator

When I log the value, it appears in syslog as "36000#012", and when I use .toString(), it appears as ", 36000". I could strip out the comma, but that would mean my CPU is at 36000 degrees Celcius, so I'm not sure that would qualify as a fix.

I don't have much experience reading the temperature sensor, as I've never had to. Is that a valid value, possibly meaning my computer doesn't have that sensor and just returns some absurdly high default value?

@chrisspen
Copy link
Collaborator

Nevermind. It looks like this commit is what broke it. I've reverted the use of ByteArray.toString, which has fixed it for me.

@chrisspen
Copy link
Collaborator

@shemgp Do you know why ByteArray doesn't work here?

@elin-y
Copy link

elin-y commented May 3, 2019

After I checked out the latest commit, the thermal temperature and fan frequency is fixed for me. However the CPU frequency is still broken showing NaN.

@enricorox
Copy link

Same here: freq, temp and fan speed are NaN

@fakhamatia
Copy link

same here
its show install lm-sensors , but its installed

@shemgp
Copy link
Contributor

shemgp commented May 6, 2019

Finally had time to debug this: In gnome-shell 3.28, when you pass as_r[1] to ByteArray.toString() returns [object GjsModule byteArray], as in, that string. Actually, ByteArray.toString() is not required for it since as_r[1] returns the needed value.

While for newer gnome-shells (I tested, 3.32), ByteArray.toString() returns the same string that was entered, but it is required to use it otherwise there would be a warning (see #504).

So maybe we can have a work around like these?
FROM

            total_frequency += parseInt(ByteArray.toString(as_r[1]));

TO

            let value = as_r[1];
            if (!ByteArray.toString(value).match(/GjsModule byteArray/))
                value = ByteArray.toString(value);
            total_frequency += parseInt(value);

@christodenny
Copy link

Are there plans to update the version in ubuntu software center with this fix? I have the latest version installed from there and am seeing this issue. Thx!

@Tomaskom-cz
Copy link

Just to note, I observed the issue with the extension update on OpenSUSE Leap 15.0 (Gnome 3.26.2), but it works just fine with an up to date OpenSUSE Tumbleweed (Gnome 3.32.2).
The fact that I installed the latter system and extension on it only after it broke on the first one might or might not be relevant.

@ibrahimalkurdi
Copy link

ibrahimalkurdi commented May 30, 2019

I tried the mentioned solutions of both @shemgp and @chrisspen on Ubuntu 18.04.1 LTS with gnome-shell version 3.28.3 but It didn't work

@ibrahimalkurdi
Copy link

ibrahimalkurdi commented May 31, 2019

I tried the mentioned solutions of both @shemgp and @chrisspen on Ubuntu 18.04.1 LTS with gnome-shell version 3.28.3 but It didn't work

It has been fixed after I rebooted my machine. (it didn't fix by reloading the plugin)
The default file path which needs to be modified:
~/.local/share/gnome-shell/extensions/system-monitor@paradoxxx.zero.gmail.com/extension.js

Thanks @shemgp and @chrisspen

@EBoisseauSierra
Copy link

Building up on @ibrahimalkurdi 's answer, here's explicitly what you should do:

  1. Open ~/.local/share/gnome-shell/extensions/system-monitor@paradoxxx.zero.gmail.com/extension.js in your editor
  2. Change the 3 following lines of code:
  • frequency:
total_frequency += parseInt(ByteArray.toString(as_r[1]));

to

                let temp_frequency = as_r[1];
                if (!ByteArray.toString(temp_frequency).match(/GjsModule byteArray/))
                    temp_frequency = ByteArray.toString(temp_frequency);
                total_frequency += parseInt(temp_frequency);
  • temperature:
this.temperature = Math.round(parseInt(ByteArray.toString(as_r[1])) / 1000);

to

                let temp_temperature = as_r[1];
                if (!ByteArray.toString(temp_temperature).match(/GjsModule byteArray/))
                    temp_temperature = ByteArray.toString(temp_temperature);
                this.temperature = Math.round(parseInt(temp_temperature) / 1000);
  • rpm:
this.rpm = parseInt(ByteArray.toString(as_r[1]));

to

                let temp_rpm = as_r[1];
                if (!ByteArray.toString(temp_rpm).match(/GjsModule byteArray/))
                    temp_rpm = ByteArray.toString(temp_rpm);
                this.rpm = parseInt(temp_rpm);
  1. Restart your session.

@matheusbg8
Copy link

Building up on @ibrahimalkurdi 's answer, here's explicitly what you should do:

1. Open `~/.local/share/gnome-shell/extensions/system-monitor@paradoxxx.zero.gmail.com/extension.js` in your editor

2. Change the 3 following lines of code:


* frequency:
total_frequency += parseInt(ByteArray.toString(as_r[1]));

to

                let temp_frequency = as_r[1];
                if (!ByteArray.toString(temp_frequency).match(/GjsModule byteArray/))
                    temp_frequency = ByteArray.toString(temp_frequency);
                total_frequency += parseInt(temp_frequency);
* temperature:
this.temperature = Math.round(parseInt(ByteArray.toString(as_r[1])) / 1000);

to

                let temp_temperature = as_r[1];
                if (!ByteArray.toString(temp_temperature).match(/GjsModule byteArray/))
                    temp_temperature = ByteArray.toString(temp_temperature);
                this.temperature = Math.round(parseInt(temp_temperature) / 1000);
* rpm:
this.rpm = parseInt(ByteArray.toString(as_r[1]));

to

                let temp_rpm = as_r[1];
                if (!ByteArray.toString(temp_rpm).match(/GjsModule byteArray/))
                    temp_rpm = ByteArray.toString(temp_rpm);
                this.rpm = parseInt(temp_rpm);
1. Restart your session.

Your solution worked perfectly on my Ubuntu 18.04 LTS. I installed gnome-shell-extension-system-monitor from the Ubuntu Software Center and I had the NaN problem.

bluet added a commit to bluet/gnome-shell-system-monitor-applet that referenced this issue Apr 6, 2021
… on Ubuntu 18.04

add backward support for Gnome 3.28 , fix NaN temperature and disk IO on Ubuntu 18.04 . 

related issues: paradoxxxzero#520 paradoxxxzero#526 paradoxxxzero#594 paradoxxxzero#597 paradoxxxzero#601  thankjura/ds4battery#4  
I don't have dedicated GPU to test paradoxxxzero#592 but it should be possible to fix in the same way.

inspired by @shemgp and @EBoisseauSierra
@gene1wood
Copy link

Resolved in #777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests