1 /* Conky, a system monitor, based on torsmo
3 * Any original torsmo code is licensed under the BSD license
5 * All code written since the fork of torsmo is licensed under the GPL
7 * Please see COPYING for details
9 * Copyright (c) 2008 Markus Meissner
10 * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
12 * All rights reserved.
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * vim: ts=4 sw=4 noet ai cindent syntax=c
32 const int nvidia_query_to_attr[] = {NV_CTRL_GPU_CORE_TEMPERATURE,
33 NV_CTRL_GPU_CORE_THRESHOLD,
34 NV_CTRL_AMBIENT_TEMPERATURE,
35 NV_CTRL_GPU_CURRENT_CLOCK_FREQS,
36 NV_CTRL_GPU_CURRENT_CLOCK_FREQS,
37 NV_CTRL_IMAGE_SETTINGS};
39 int get_nvidia_value(QUERY_ID qid, Display *dpy){
41 if(!XNVCTRLQueryAttribute(dpy, 0, 0, nvidia_query_to_attr[qid], &tmp)){
44 /* FIXME: when are the low 2 bytes of NV_GPU_FREQ needed? */
45 if (qid == NV_GPU_FREQ)
47 if (qid == NV_MEM_FREQ)
52 int set_nvidia_type(struct nvidia_s *nvidia, const char *arg)
54 if (!arg || !arg[0] || !arg[1])
57 nvidia->print_as_float = 0;
59 case 't': // temp or threshold
60 nvidia->print_as_float = 1;
62 nvidia->type = NV_TEMP;
63 else if (arg[1] == 'h')
64 nvidia->type = NV_TEMP_THRESHOLD;
68 case 'a': // ambient temp
69 nvidia->print_as_float = 1;
70 nvidia->type = NV_TEMP_AMBIENT;
73 nvidia->type = NV_GPU_FREQ;
76 nvidia->type = NV_MEM_FREQ;
78 case 'i': // imagequality
79 nvidia->type = NV_IMAGE_QUALITY;