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