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

Sync with sensors applet #30

Closed
wants to merge 14 commits into from
Closed

Sync with sensors applet #30

wants to merge 14 commits into from

Conversation

infirit
Copy link
Contributor

@infirit infirit commented Jun 30, 2015

Sync up with most of sensors-applet. There is some code that adds GSettings to sensors-applet but this was not trivial so left for another time.

Compiles and runs nicely here (intel gfx) but needs testing on ati/nvidia hence this PR.

@monsta
Copy link
Contributor

monsta commented Jun 30, 2015

Wow, that's a big one. I have nvidia (with proprietary drivers), so I can test it later.
BTW, what mbmon is for?

@monsta
Copy link
Contributor

monsta commented Jun 30, 2015

@NiceandGently @flexiondotorg @stefano-k
please help with testing too if you can 😄

@infirit
Copy link
Contributor Author

infirit commented Jun 30, 2015

mbmon is just another monitoring tool like libsensors. It applied cleanly so I thought why not 😄

@monsta
Copy link
Contributor

monsta commented Jun 30, 2015

I actually wondered what it might monitor 😄

@infirit
Copy link
Contributor Author

infirit commented Jun 30, 2015

I actually wondered what it might monitor

I may misunderstand this but the chips/HW supported are listed in the readme linked.

@monsta
Copy link
Contributor

monsta commented Jul 3, 2015

About mbmon - are you sure it's needed? Looks like this tool isn't maintained since 2008 (at least in Debian). It might not even have any support for the motherboards released since then. I think lm-sensors pretty much obsoletes this.

@monsta
Copy link
Contributor

monsta commented Jul 3, 2015

About nvidia stuff: new "thermal" sensor shows exactly the same value as the old "core" one - is that by design?
Also I noticed that the fan speed is shown in RPMs - but nvidia-settings tool says reading RPMs is unsupported and the value is actually in percents:

nvidia x server settings

@infirit
Copy link
Contributor Author

infirit commented Jul 3, 2015

I only brought the code in sync with the original applet so that new fixes and feature can be easily applied. The questions are in such a detail that I do not know without spending significant effort to figure out (which I have no time for).

re mbmon, it is self contained and does not break anything. Plus the original applet authors considered it useful so who are we to argue against it 😄. Do you care strongly?

@raveit65
Copy link
Member

raveit65 commented Jul 4, 2015

hmm, last xmbmon is from 2005
http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/xmbmon/
Is this really shipped by any distro?

@raveit65
Copy link
Member

raveit65 commented Jul 4, 2015

gtk3 build failed with nvidia!

Making all in nvidia
make[2]: Entering directory '/builddir/build/BUILD/mate-sensors-applet-1.10.2/plugins/nvidia'
  CC       nvidia-plugin.lo
nvidia-plugin.c: In function 'nvidia_plugin_get_sensor_value':
nvidia-plugin.c:55:9: error: 'NV_CTRL_TARGET_TYPE_THERMAL_SENSOR' undeclared (first use in this function)
         NV_CTRL_TARGET_TYPE_THERMAL_SENSOR,
         ^
nvidia-plugin.c:55:9: note: each undeclared identifier is reported only once for each function it appears in
nvidia-plugin.c:58:9: error: 'NV_CTRL_THERMAL_SENSOR_READING' undeclared (first use in this function)
         NV_CTRL_THERMAL_SENSOR_READING,
         ^
nvidia-plugin.c:62:9: error: 'NV_CTRL_TARGET_TYPE_COOLER' undeclared (first use in this function)
         NV_CTRL_TARGET_TYPE_COOLER,
         ^
nvidia-plugin.c:65:9: error: 'NV_CTRL_THERMAL_COOLER_LEVEL' undeclared (first use in this function)
         NV_CTRL_THERMAL_COOLER_LEVEL,
         ^
nvidia-plugin.c: In function 'nvidia_plugin_init':
nvidia-plugin.c:117:10: error: 'NV_CTRL_TARGET_TYPE_THERMAL_SENSOR' undeclared (first use in this function)
          NV_CTRL_TARGET_TYPE_THERMAL_SENSOR,
          ^
nvidia-plugin.c:136:10: error: 'NV_CTRL_TARGET_TYPE_COOLER' undeclared (first use in this function)
          NV_CTRL_TARGET_TYPE_COOLER,
          ^
Makefile:502: recipe for target 'nvidia-plugin.lo' failed
make[2]: Leaving directory '/builddir/build/BUILD/mate-sensors-applet-1.10.2/plugins/nvidia'
Makefile:433: recipe for target 'all-recursive' failed
make[1]: Leaving directory '/builddir/build/BUILD/mate-sensors-applet-1.10.2/plugins'
Makefile:563: recipe for target 'all-recursive' failed
make[2]: *** [nvidia-plugin.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

@infirit
Copy link
Contributor Author

infirit commented Jul 4, 2015

Yes distros schip mbmon on linux. And do note that MATE runs on other os's like *bsd where lmsensors is not available.

I will look at the build failure when I am back at home next week.

@raveit65
Copy link
Member

raveit65 commented Jul 4, 2015

Yes distros schip mbmon on linux. And do note that MATE runs on other os's like *bsd where lmsensors is not available.

Ok, bsd is a reason.

@monsta
Copy link
Contributor

monsta commented Jul 4, 2015

gtk3 build failed with nvidia!

Probably it's some old version of libxnvctrl...

@monsta
Copy link
Contributor

monsta commented Jul 4, 2015

And do note that MATE runs on other os's like *bsd where lmsensors is not available.

Poor BSD users... how did they even use this applet then? lm-sensors is a significant part.

@raveit65
Copy link
Member

raveit65 commented Jul 4, 2015

Probably it's some old version of libxnvctrl...

I can only use this version http://pkgs.fedoraproject.org/cgit/libXNVCtrl.git/log/
Since f14 (4.5 years) libXNVCtrl isn't update anymore, only rebuild.
But i maintain it for epel7 branch, so patches are welcome ;)

@monsta
Copy link
Contributor

monsta commented Jul 4, 2015

Damn, version 169 is ancient... Ubuntu 14.04 has 331 (it's in nvidia-settings package there).

@raveit65
Copy link
Member

raveit65 commented Jul 4, 2015

......and nvidia-settings is nonfree

@monsta
Copy link
Contributor

monsta commented Jul 5, 2015

That's not a problem for Mint 😄
As for Debian/Ubuntu, libxnvctrl has been split into a separate (and free) package in recent releases.
But anyway, this is not the point here 😄

@infirit
Copy link
Contributor Author

infirit commented Jul 5, 2015

The nvidia plugin is for the non free driver anyway and will not work without it. While I sympathize with the old version in fedora the commit brings support for newer HW so it will need a newer version of libxnvctrl.

I'll probably merge and push this in a day or two.

@raveit65
Copy link
Member

raveit65 commented Jul 5, 2015

It would be friendly to wait for merging it.
I need to contact main fedora maintainer to see if it's possible to update libxnvctrl for fedora.
Also mate-sensor-applet isn't the own package which depends on it, so another maintainer is involved too.

root@mother rave]# repoquery --whatrequires libXNVCtrl
hwloc-plugins-0:1.10.1-2.fc22.x86_64
mate-sensors-applet-0:1.10.2-1.fc22.x86_64

All this action is impossible to do in one or two days.
If it's not possible to update the package i can't build mate-sensor-applet with nvidia sensor, which is a regression imo.
The nvidia plugin from current release works here out of box for both gtk+ versions

PS: is this commit ever tested for gtk3 on bare metal from anyone other then me?

@raveit65
Copy link
Member

raveit65 commented Jul 5, 2015

Which nvidia-settings version is needed?
Latest is nvidia-settings-352.21.tar.bz2
see ftp://download.nvidia.com/XFree86/nvidia-settings/

@infirit
Copy link
Contributor Author

infirit commented Jul 5, 2015

All this action is impossible to do in one or two days.

You have till the next MATE release to get this lib updated in fedora, this is not meant to go into 1.10 which should only get bugfixes now. Good enough?

Which nvidia-settings version is needed?

I build against 343.22 so and I think @monsta build against ~340 which is in jessie.

@raveit65
Copy link
Member

raveit65 commented Jul 5, 2015

You have till the next MATE release to get this lib updated in fedora, this is not meant to go into 1.10 which should only get bugfixes now. Good enough?

good enough, so m-s-a needs branched.
Another question is does that work with all current legacy nvidia driver versions?
304 and 340.
....340 seems working
anyways i will try to update libXNVCtrl to latest 352, and than i will see if it works with legacy 340 which i use.

@leigh123linux
Copy link

@NiceandGently

This is going to cost you some more reviews 😆 https://dl.dropboxusercontent.com/u/6907158/libXNVCtrl-352.21-1.fc23.src.rpm

@infirit
Copy link
Contributor Author

infirit commented Jul 6, 2015

Another question is does that work with all current legacy nvidia driver versions

tbh, I don't know but.. nvidia-settings does not mention anything on this subject so I think it is likely backwards compatible.

@raveit65
Copy link
Member

raveit65 commented Jul 6, 2015

RFE is filed out.
https://bugzilla.redhat.com/show_bug.cgi?id=1240234
Edit:
i forgot to say, using libXNVCtrl-352.21 fix the build.

@monsta
Copy link
Contributor

monsta commented Jul 6, 2015

I can say it builds fine in Mint 17.2 (based on Ubuntu 14.04) with nvidia-settings 331.20, and of course in Debian Jessie where we have libxnvctrl 340.46.

@monsta
Copy link
Contributor

monsta commented Jul 6, 2015

Ok, found out the exact versions where these two defines appeared:

NV_CTRL_THERMAL_COOLER_LEVEL - 190.32:
NVIDIA/nvidia-settings@29bde12#diff-c8d9162ce179db35fb13e3b489e36facR2577
NV_CTRL_THERMAL_SENSOR_READING - 256.25:
NVIDIA/nvidia-settings@9f27714#diff-c8d9162ce179db35fb13e3b489e36facR2916

5-6 years ago... 😄

@monsta
Copy link
Contributor

monsta commented Jul 6, 2015

Also I noticed that the fan speed is shown in RPMs - but nvidia-settings tool says reading RPMs is unsupported and the value is actually in percents

Turned out it's a limitation of the applet's own code.
All values received from fans are treated as RPMs:
https://github.com/mate-desktop/mate-sensors-applet/blob/master/sensors-applet/active-sensor.c#L625
https://github.com/mate-desktop/mate-sensors-applet/blob/master/sensors-applet/sensors-applet.c#L372
https://github.com/mate-desktop/mate-sensors-applet/blob/master/sensors-applet/sensors-applet.h#L57
Limits are also set for RPMs:
https://github.com/mate-desktop/mate-sensors-applet/blob/master/lib/sensors-applet-plugin.c#L89

@raveit65
Copy link
Member

raveit65 commented Jul 7, 2015

OK, i tested again and added the new patch.
On my main box with proprietary nvidia driver:
GTK2/GTK3 build works well.
On my notebook with hybrid grapphics (intel + nvidia), but intel is in used and nouveau driver is installed.
Same gtk2 build failed, means i can't add the applet to the panel.

alexmurray and others added 14 commits July 7, 2015 11:27
Taken from sensors-applet commit: c2596b4534f612ae890fac1719d4e6e6ef35ef91
and adapted for MATE by infirit@gmail.com
…orruption

Make sure we don't write past the bounds of the output buffer - thanks
to JeanFI for noticing this issue.
Changed() signal doesn't occur that often so instead poll each time to ensure
we have the most up-to-date value
Based off sensors-applet commit c1777c9c58994d7eeec95893a5fdd1cbb7acb6eb
from Alex Murray <murray.alex@gmail.com>
Adds support for NV_CTRL_THERMAL_SENSOR_READING as alternative to
NV_CTRL_GPU_CORE_TEMPERATURE and NV_CTRL_THERMAL_COOLER_LEVEL for
reading fan speeds on more modern NVIDIA GPUs.
Adapted for mate-sensors-applet by infirit@gmail.com
Passing NULL to strcmp could be unsafe or at the minimum
result in undefined behaviour. g_strcmp0 handles NULL
gracefully and returns 0.
@raveit65
Copy link
Member

raveit65 commented Jul 7, 2015

commit 1 is good --> applet starts on my notebook
commit 2 breaks the start of the applet on my notebook
commit 3 didn't apply without commit 2
commit 4 --> good
commit 5 --> good
commit 6 --> good
commit 7 --> good
commit 8 --> good
commit 9 --> good
commit 10 --> good
commit 11 --> good
commit 12 --> good
commit 14 --> good
commit 14 --> good

Summary:
The applet starts fine on my notebook if i use all commits, exept 2 +3 !
2 looks like a general applet commit which was mentioned in my stacktrace from yesterday

@infirit
Copy link
Contributor Author

infirit commented Jul 7, 2015

Thanks for testing. I merged all the good commits and the 3rd. It looks like you are hitting one of the g_debug's that @monsta and I do not. I'll close this one now and try to figure out what is going on.

@infirit infirit closed this Jul 7, 2015
@raveit65
Copy link
Member

raveit65 commented Jul 9, 2015

@infirit
libXNVCtrl is updated in fedora + epel7 branch (rhel7 family)
https://admin.fedoraproject.org/updates/libXNVCtrl-352.21-1.fc22?_csrf_token=bf4cb00b505fa46daa5f85dd006dd067b7481cfd
I agree if you want backport changes to 1.10 branch, would be nice to have new sensors.
Maybe you need to check the situation in other distros.

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

Successfully merging this pull request may close these issues.

None yet

7 participants