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