1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-12 19:06:36 +00:00

* Added NVIDIA Graficcard support patch (thanks meissna)

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1122 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2008-06-03 20:46:15 +00:00
parent bd6196c6b0
commit 7ff7c1083c
12 changed files with 344 additions and 229 deletions

View File

@ -191,6 +191,9 @@ Lucas Brutschy <lbrutschy at users dot sourceforge dot net>
Marcus Huesgen <marcus dot huesgen at googlemail dot com>
battery_bar fix
Markus Meissner <meissna at users dot sourceforge dot net>
NVIDIA Graficcard support with libXNVCtrl patch
Michal Januszewski <spock at gentoo dot org>
hddtemp support

View File

@ -1,5 +1,8 @@
# $Id$
2008-06-03
* Added NVIDIA Graficcard support patch (thanks meissna)
2008-05-30
* Simplified docs for color0-9 config settings and variables.
* Improved $if_up for configurable behaviour.

77
README
View File

@ -171,34 +171,9 @@ CONFIGURATION SETTINGS
Border width in pixels
color0 A color variable for use inside TEXT segments
color1 A color variable for use inside TEXT segments
color2 A color variable for use inside TEXT segments
color3 A color variable for use inside TEXT segments
color4 A color variable for use inside TEXT segments
color5 A color variable for use inside TEXT segments
color6 A color variable for use inside TEXT segments
color7 A color variable for use inside TEXT segments
color8 A color variable for use inside TEXT segments
color9 A color variable for use inside TEXT segments
colorN Predefine a color for use inside TEXT segments. Substitute N by
a digit between 0 and 9, inclusively. When specifying the color
value in hex, omit the leading hash (#).
cpu_avg_samples
@ -256,6 +231,13 @@ CONFIGURATION SETTINGS
passing -y at command line, e.g. gap_y 10.
if_up_strictness
How strict should if_up be when testing an interface for being
up? The value is one of up, link or address, to check for the
interface being solely up, being up and having link or being up,
having link and an assigned IP address.
imap Default global IMAP server. Arguments are: "host user pass [-i
interval] [-f folder] [-p port] [-e command]". Default port is
143, default folder is 'INBOX', default interval is 5 minutes.
@ -599,34 +581,8 @@ VARIABLES
Change drawing color to color
color0 Change drawing color to color0 configuration option
color1 Change drawing color to color1 configuration option
color2 Change drawing color to color2 configuration option
color3 Change drawing color to color3 configuration option
color4 Change drawing color to color4 configuration option
color5 Change drawing color to color5 configuration option
color6 Change drawing color to color6 configuration option
color7 Change drawing color to color7 configuration option
color8 Change drawing color to color8 configuration option
color9 Change drawing color to color9 configuration option
colorN Change drawing color to colorN configuration option, where N is
a digit between 0 and 9, inclusively.
conky_version
@ -1156,6 +1112,15 @@ VARIABLES
Hostname
nvidia threshold temp gpufreq memfreq imagequality
Nvidia graficcard support for the XNVCtrl library. Each option
gives back one integer value: (threshold): the thresholdtempera-
ture at which the gpu slows down (temp): gives the gpu current
temperature (gpufreq): gives the current gpu frequency (mem-
freq): gives the current mem frequency (imagequality): which im-
agequality should be choosen by OpenGL applications
outlinecolor (color)
Change outline color

View File

@ -240,7 +240,7 @@ dnl
AC_ARG_ENABLE([wlan],
AC_HELP_STRING([--enable-wlan], [enable if you want wireless support @<:@default=no@:>@]),
[want_wlan="$enableval"], [want_wlan=no])
#
AM_CONDITIONAL(BUILD_WLAN, test x$want_wlan = xyes)
if test x$want_wlan = xyes; then
AC_CHECK_HEADERS([iwlib.h], [], AC_MSG_ERROR([iwlib.h header not found]))
@ -248,6 +248,24 @@ if test x$want_wlan = xyes; then
AC_DEFINE(HAVE_IWLIB, 1, [Define if you want wireless support])
fi
dnl
dnl NVIDIA libXNVCtrl support
dnl
AC_ARG_ENABLE([nvidia],
AC_HELP_STRING([--enable-nvidia], [enable if you want nvidia support @<:@default=no@:>@]),
[want_nvidia="$enableval"], [want_nvidia=no])
AM_CONDITIONAL(BUILD_NVIDIA, test x$want_nvidia = xyes)
if test x$want_nvidia = xyes; then
AC_CHECK_HEADERS([NVCtrl/NVCtrl.h], [], AC_MSG_ERROR([NVCtrl/NVCtrl.h header not found]))
dnl AC_CHECK_LIB([XNVCtrl], [XNVCTRLQueryVersion], [] ,[AC_MSG_ERROR([grrr])] )
dnl AC_CHECK_LIB([XNVCtrl], [XNVCTRLCheckTargetData], [], [AC_MSG_ERROR([grr])])
dnl ## am I Stupid ??
dnl ## it won't find the lib for some reason!?
LIBS="$LIBS -lXNVCtrl"
AC_DEFINE(NVIDIA, 1, [Define if you want nvidia support])
fi
dnl
dnl IMLIB2
dnl
@ -624,4 +642,5 @@ $PACKAGE $VERSION configured successfully:
RSS: $want_rss
wireless: $want_wlan
SMAPI: $want_smapi
nvidia: $want_nvidia
EOF

View File

@ -158,44 +158,8 @@ Border margin in pixels
Border width in pixels
.TP
\fB\*(T<\fBcolor0\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor1\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor2\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor3\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor4\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor5\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor6\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor7\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor8\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor9\fR\*(T>\fR
A color variable for use inside TEXT segments
\fB\*(T<\fBcolorN\fR\*(T>\fR
Predefine a color for use inside TEXT segments. Substitute N by a digit between 0 and 9, inclusively. When specifying the color value in hex, omit the leading hash (#).
.TP
\fB\*(T<\fBcpu_avg_samples\fR\*(T>\fR
@ -251,6 +215,10 @@ e.g. gap_x 10
Gap, in pixels, between top or bottom border of screen, same as passing -y at command line,
e.g. gap_y 10.
.TP
\fB\*(T<\fBif_up_strictness\fR\*(T>\fR
How strict should if_up be when testing an interface for being up? The value is one of up, link or address, to check for the interface being solely up, being up and having link or being up, having link and an assigned IP address.
.TP
\fB\*(T<\fBimap\fR\*(T>\fR
Default global IMAP server. Arguments are: "host user pass [-i interval] [-f folder] [-p port] [-e command]". Default port is 143, default folder is 'INBOX', default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
@ -564,44 +532,8 @@ Amount of memory cached
Change drawing color to color
.TP
\fB\*(T<\fBcolor0\fR\*(T>\fR
Change drawing color to color0 configuration option
.TP
\fB\*(T<\fBcolor1\fR\*(T>\fR
Change drawing color to color1 configuration option
.TP
\fB\*(T<\fBcolor2\fR\*(T>\fR
Change drawing color to color2 configuration option
.TP
\fB\*(T<\fBcolor3\fR\*(T>\fR
Change drawing color to color3 configuration option
.TP
\fB\*(T<\fBcolor4\fR\*(T>\fR
Change drawing color to color4 configuration option
.TP
\fB\*(T<\fBcolor5\fR\*(T>\fR
Change drawing color to color5 configuration option
.TP
\fB\*(T<\fBcolor6\fR\*(T>\fR
Change drawing color to color6 configuration option
.TP
\fB\*(T<\fBcolor7\fR\*(T>\fR
Change drawing color to color7 configuration option
.TP
\fB\*(T<\fBcolor8\fR\*(T>\fR
Change drawing color to color8 configuration option
.TP
\fB\*(T<\fBcolor9\fR\*(T>\fR
Change drawing color to color9 configuration option
\fB\*(T<\fBcolorN\fR\*(T>\fR
Change drawing color to colorN configuration option, where N is a digit between 0 and 9, inclusively.
.TP
\fB\*(T<\fBconky_version\fR\*(T>\fR
@ -1033,6 +965,16 @@ not. Both mbox and maildir type mailboxes are supported.
\fB\*(T<\fBnodename\fR\*(T>\fR
Hostname
.TP
\fB\*(T<\fBnvidia\fR\*(T>\fR \*(T<\fBthreshold\fR\*(T> \*(T<\fBtemp\fR\*(T> \*(T<\fBgpufreq\fR\*(T> \*(T<\fBmemfreq\fR\*(T> \*(T<\fBimagequality\fR\*(T>
Nvidia graficcard support for the XNVCtrl library.
Each option gives back one integer value:
(threshold): the thresholdtemperature at which the gpu slows down
(temp): gives the gpu current temperature
(gpufreq): gives the current gpu frequency
(memfreq): gives the current mem frequency
(imagequality): which imagequality should be choosen by OpenGL applications
.TP
\fB\*(T<\fBoutlinecolor\fR\*(T>\fR \*(T<\fB(color)\fR\*(T>
Change outline color

View File

@ -1389,6 +1389,27 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>nvidia</option></command>
<option>threshold</option>
<option>temp</option>
<option>gpufreq</option>
<option>memfreq</option>
<option>imagequality</option>
</term>
<listitem>
Nvidia graficcard support for the XNVCtrl library.
Each option gives back one integer value:
(threshold): the thresholdtemperature at which the gpu slows down
(temp): gives the gpu current temperature
(gpufreq): gives the current gpu frequency
(memfreq): gives the current mem frequency
(imagequality): which imagequality should be choosen by OpenGL applications
<para></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>outlinecolor</option></command>

View File

@ -88,6 +88,10 @@ if BUILD_SMAPI
smapi = smapi.c smapi.h
endif
if BUILD_NVIDIA
nvidia = nvidia.c nvidia.h
endif
conky_SOURCES = \
$(audacious) \
$(bmpx) \
@ -98,6 +102,7 @@ conky_SOURCES = \
fs.c \
$(hddtemp) \
$(linux) \
$(nvidia) \
mail.c \
mixer.c \
$(mpd) \
@ -130,6 +135,8 @@ EXTRA_DIST = \
libtcp-portmon.h \
mpd.c \
netbsd.c \
nvidia.c \
nvidia.h \
openbsd.c \
solaris.c \
top.h \
@ -139,4 +146,5 @@ EXTRA_DIST = \
smapi.c \
users.c
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

View File

@ -126,6 +126,9 @@ static void print_version(void)
#ifdef SMAPI
" * smapi\n"
#endif /* SMAPI */
#ifdef NVIDIA
" * nvidia\n"
#endif
"", SYSTEM_CONFIG_FILE
);
@ -708,7 +711,6 @@ static void new_font(char *buf, char *args)
}
}
#endif
inline void graph_append(struct special_t *graph, double f)
{
int i;
@ -1205,6 +1207,7 @@ enum text_object_type {
OBJ_nameserver,
OBJ_new_mails,
OBJ_nodename,
OBJ_nvidia,
OBJ_pre_exec,
OBJ_processes,
OBJ_running_processes,
@ -1456,6 +1459,10 @@ struct text_object {
} rss;
#endif
struct local_mail_s local_mail;
#ifdef NVIDIA
struct nvidia_s nvidia;
#endif /* NVIDIA */
} data;
int type;
int a, b;
@ -2273,6 +2280,10 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
free(objs[i].data.ifblock.str);
break;
#endif
#ifdef NVIDIA
case OBJ_nvidia:
break;
#endif
#ifdef MPD
case OBJ_mpd_title:
case OBJ_mpd_artist:
@ -3876,6 +3887,28 @@ static struct text_object *construct_text_object(const char *s,
END OBJ(entropy_poolsize, INFO_ENTROPY)
END OBJ(entropy_bar, INFO_ENTROPY)
scan_bar(arg, &obj->a, &obj->b);
#ifdef NVIDIA
END OBJ(nvidia, 0)
if (!arg){
CRIT_ERR("nvidia needs one argument "
"[temp,threshold,gpufreq,memfreq,imagequality]");
} else {
if (strcmp(arg, "temp") == 0)
obj->data.nvidia.type = NV_TEMP;
else if (strcmp(arg, "threshold") == 0)
obj->data.nvidia.type = NV_TEMP_THRESHOLD;
else if (strcmp(arg, "gpufreq") == 0)
obj->data.nvidia.type = NV_GPU_FREQ;
else if (strcmp(arg, "memfreq") == 0)
obj->data.nvidia.type = NV_MEM_FREQ;
else if (strcmp(arg, "imagequality") == 0)
obj->data.nvidia.type = NV_IMAGE_QUALITY;
else
CRIT_ERR("you have to give one of these arguments "
"[temp,threshold,gpufreq,memfreq,imagequality");
strncpy((char*)&obj->data.nvidia.arg, arg, 20);
}
#endif /* NVIDIA */
END {
char buf[256];
@ -6227,6 +6260,17 @@ head:
new_bar(p, obj->a, obj->b, 0);
}
#endif /* SMAPI */
#ifdef NVIDIA
OBJ(nvidia) {
int hol = (strcmp((char*)&obj->data.nvidia.arg, "gpufreq")) ? 1 : 0;
if(!(obj->data.nvidia.value = get_nvidia_value(obj->data.nvidia.type, display, hol)))
snprintf(p, p_max_size, "value unavailible");
else
spaced_print(p, p_max_size, "%*d", 4, "nvidia",
4, obj->data.nvidia.value);
}
#endif /* NVIDIA */
break;
}

View File

@ -85,6 +85,10 @@ char *strndup(const char *s, size_t n);
#include "smapi.h"
#endif
#ifdef NVIDIA
#include "nvidia.h"
#endif
#include "mboxscan.h"
#include "timed_thread.h"
@ -329,6 +333,10 @@ enum {
INFO_USERS = 26,
INFO_GW = 27,
INFO_DNS = 28
#ifdef NVIDIA
, INFO_NVIDIA = 29
#endif
};
/* get_battery_stuff() item selector */
@ -733,4 +741,11 @@ void free_rss_info(void);
/* in linux.c */
/* in nvidia.c */
#ifdef NVIDIA
int get_nvidia_value(QUERY_ID qid, Display *dpy, int highorlow);
#endif /* NVIDIA */
#endif

View File

@ -560,8 +560,9 @@ void update_tcp_port_monitor_collection(
(unsigned long *) &inode) != 7) {
fprintf(stderr, "/proc/net/tcp: bad file format\n");
}
if ((inode == 0) || (state != TCP_ESTABLISHED)) {
/** TCP_ESTABLISHED equals 1, but is not (always??) included **/
//if ((inode == 0) || (state != TCP_ESTABLISHED)) {
if((inode == 0) || (state != 1)) {
continue;
}

43
src/nvidia.c Normal file
View File

@ -0,0 +1,43 @@
/* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2008 Markus Meissner
* Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
#include "nvidia.h"
int get_nvidia_value(QUERY_ID qid, Display *dpy, int highorlow){
int tmp;
if(!XNVCTRLQueryAttribute(dpy, 0, 0, qid, &tmp)){
return 0;
} else if (qid == NV_GPU_FREQ){
if (highorlow == 1)
return tmp >> 16;
else
return tmp & 0x0000FFFF;
} else
return tmp;
}

51
src/nvidia.h Normal file
View File

@ -0,0 +1,51 @@
/* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2008 Markus Meissner
* Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*/
#include <X11/Xlib.h>
#include <NVCtrl/NVCtrlLib.h>
#ifndef NVIDIA_CONKY_H
#define NVIDIA_CONKY_H
typedef enum _QUERY_ID {
NV_TEMP = NV_CTRL_GPU_CORE_TEMPERATURE,
NV_TEMP_THRESHOLD = NV_CTRL_GPU_CORE_THRESHOLD,
NV_GPU_FREQ = NV_CTRL_GPU_CURRENT_CLOCK_FREQS,
NV_MEM_FREQ = NV_CTRL_GPU_CURRENT_CLOCK_FREQS,
NV_IMAGE_QUALITY = NV_CTRL_IMAGE_SETTINGS
} QUERY_ID;
struct nvidia_s {
int interval;
int value;
char arg[20];
QUERY_ID type;
};
#endif