# $Id$
2007-08-12
+ * Added $hwmon var, similar to $i2c and $platform.
+
+2007-08-12
* Added var $platform which is similar to $i2c and accommodates the conversion
of many devices from /sys/bus/i2c/devices to /sys/bus/platform/devices.
* Removed config item post_21_kernel since it forced all i2c device lookups
Horizontal line, height is the height in pixels
- hwmon N sensor number input
- This has the ability to display the contents of hwmon files lo-
- cated under "/sys/class/hwmon/hwmonX/device/N". For example, use
- ${hwmon 0 temp 1 input} to read the temperature of the CPU (in
- oC) from "/sys/class/hwmon/hwmon0/device/temp1_input". If the
- sensor name equals "temp", then the value read will be divided
- by 1000, otherwise the number will be used unchanged. The factor
- 1000 is just for the Abit uGuru sensor.
+ hwmon (dev) type n
+ Hwmon sensor from sysfs (Linux 2.6). Parameter dev may be omit-
+ ted if you have only one hwmon device. Parameter type is either
+ 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Cel-
+ sius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n
+ is number of the sensor. See /sys/class/hwmon/ on your local
+ computer.
iconv_start codeset_from codeset_to
- Convert text from one codeset to another using GNU iconv. Needs
+ Convert text from one codeset to another using GNU iconv. Needs
to be stopped with iconv_stop.
i2c (dev) type n
- I2C sensor from sysfs (Linux 2.6). dev may be omitted if you
- have only one I2C device. type is either in (or vol) meaning
- voltage, fan meaning fan or temp/tempf (first in C, second in F)
- meaning temperature. n is number of the sensor. See
- /sys/bus/i2c/devices/ on your local computer.
+ I2C sensor from sysfs (Linux 2.6). Parameter dev may be omitted
+ if you have only one I2C device. Parameter type is either 'in'
+ or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or
+ 'tempf' (Fahrenheit) meaning temperature. Parameter n is number
+ of the sensor. See /sys/bus/i2c/devices/ on your local computer.
i8k_ac_status
platform (dev) type n
- Platform sensor from sysfs (Linux 2.6). dev may be omitted if
- you have only one platform device. type is either in (or vol)
- meaning voltage, fan meaning fan or temp/tempf (first in C, sec-
- ond in F) meaning temperature. n is number of the sensor. See
- /sys/bus/platform/devices/ on your local computer.
+ Platform sensor from sysfs (Linux 2.6). Parameter dev may be
+ omitted if you have only one platform device. Platform type is
+ either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp'
+ (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter
+ n is number of the sensor. See /sys/bus/platform/devices/ on
+ your local computer.
pop3_unseen (args)
Displays the number of unseen messages in your global POP3 inbox
by default. You can define individual POP3 inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
- [-i interval] [-p port] [-e command]". Default port is 110, de-
+ [-i interval] [-p port] [-e command]". Default port is 110, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
pop3_used (args)
- Displays the amount of space (in MiB, 2^20) used in your global
- POP3 inbox by default. You can define individual POP3 inboxes
- seperately by passing arguments to this object. Arguments are:
- "host user pass [-i interval] [-p port] [-e command]". Default
- port is 110, default interval is 5 minutes. If the password is
+ Displays the amount of space (in MiB, 2^20) used in your global
+ POP3 inbox by default. You can define individual POP3 inboxes
+ seperately by passing arguments to this object. Arguments are:
+ "host user pass [-i interval] [-p port] [-e command]". Default
+ port is 110, default interval is 5 minutes. If the password is
supplied as '*', you will be prompted to enter the password when
Conky starts.
The connection index provides you with access to each connection
in the port monitor. The monitor will return information for in-
dex values from 0 to n-1 connections. Values higher than n-1 are
- simply ignored. For the "count" item, the connection index must
+ simply ignored. For the "count" item, the connection index must
be omitted. It is required for all other items.
Examples:
- ${tcp_portmon 6881 6999 count} - displays the number of connec-
+ ${tcp_portmon 6881 6999 count} - displays the number of connec-
tions in the bittorrent port range
- ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
+ ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
first sshd connection
- ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
+ ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
tenth sshd connection
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
the first connection on a privileged port
${tcp_portmon 1 1024 rport 4} - displays the remote host port of
the fifth connection on a privileged port
- ${tcp_portmon 1 65535 lservice 14} - displays the local service
+ ${tcp_portmon 1 65535 lservice 14} - displays the local service
name of the fifteenth connection in the range of all ports
Note that port monitor variables which share the same port range
actually refer to the same monitor, so many references to a sin-
gle port range for different items and different indexes all use
- the same monitor internally. In other words, the program avoids
+ the same monitor internally. In other words, the program avoids
creating redundant monitors.
texeci interval command
- Runs a command at an interval inside a thread and displays the
- output. Same as $execi, except the command is run inside a
- thread. Use this if you have a slow script to keep Conky updat-
- ing. You should make the interval slightly longer then the time
- it takes your script to execute. For example, if you have a
- script that take 5 seconds to execute, you should make the in-
+ Runs a command at an interval inside a thread and displays the
+ output. Same as $execi, except the command is run inside a
+ thread. Use this if you have a slow script to keep Conky updat-
+ ing. You should make the interval slightly longer then the time
+ it takes your script to execute. For example, if you have a
+ script that take 5 seconds to execute, you should make the in-
terval at least 6 seconds. See also $execi.
rss url delay_in_minutes action item_num
- Download and parse RSS feeds. Action may be one of the follow-
- ing: feed_title, item_title (with num par), item_desc (with num
+ Download and parse RSS feeds. Action may be one of the follow-
+ ing: feed_title, item_title (with num par), item_desc (with num
par) and item_titles.
time (format)
- Local time, see man strftime to get more information about for-
+ Local time, see man strftime to get more information about for-
mat
tztime (timezone) (format)
- Local time for specified timezone, see man strftime to get more
- information about format. The timezone argument is specified in
- similar fashion as TZ environment variable. For hints, look in
+ Local time for specified timezone, see man strftime to get more
+ information about format. The timezone argument is specified in
+ similar fashion as TZ environment variable. For hints, look in
/usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.
totaldown net
- Total download, overflows at 4 GB on Linux with 32-bit arch and
+ Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has al-
ready done that before conky has started.
top type, num
- This takes arguments in the form:top (name) (number) Basically,
- processes are ranked from highest to lowest in terms of cpu us-
- age, which is what (num) represents. The types are: "name",
- "pid", "cpu", and "mem". There can be a max of 10 processes
+ This takes arguments in the form:top (name) (number) Basically,
+ processes are ranked from highest to lowest in terms of cpu us-
+ age, which is what (num) represents. The types are: "name",
+ "pid", "cpu", and "mem". There can be a max of 10 processes
listed.
Upload speed in kilobytes with one decimal
- upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
+ upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
2) (scale)
- Upload speed graph, colours defined in hex, minus the #. If
+ Upload speed graph, colours defined in hex, minus the #. If
scale is non-zero, it becomes the scale for the graph.
voffset (pixels)
- Change vertical offset by N pixels. Negative values will cause
+ Change vertical offset by N pixels. Negative values will cause
text to overlap. See also $offset.
voltage_mv (n)
- Returns CPU #n's voltage in mV. CPUs are counted from 1. If
+ Returns CPU #n's voltage in mV. CPUs are counted from 1. If
omitted, the parameter defaults to 1.
BUGS
Drawing to root or some other desktop window directly doesn't work with
all window managers. Especially doesn't work well with Gnome and it has
- been reported that it doesn't work with KDE either. Nautilus can be
- disabled from drawing to desktop with program gconf-editor. Uncheck
- show_desktop in /apps/nautilus/preferences/. There is -w switch in
- Conky to set some specific window id. You might find xwininfo -tree
- useful to find the window to draw to. You can also use -o argument
+ been reported that it doesn't work with KDE either. Nautilus can be
+ disabled from drawing to desktop with program gconf-editor. Uncheck
+ show_desktop in /apps/nautilus/preferences/. There is -w switch in
+ Conky to set some specific window id. You might find xwininfo -tree
+ useful to find the window to draw to. You can also use -o argument
which makes Conky to create its own window.
SEE ALSO
Horizontal line, height is the height in pixels
.TP
-\fB\*(T<\fBhwmon\fR\*(T>\fR \*(T<\fBN sensor number input\fR\*(T>
-This has the ability to display the contents of hwmon files located under "/sys/class/hwmon/hwmonX/device/N". For example, use ${hwmon 0 temp 1 input} to read the temperature of the CPU (in \(deC) from "/sys/class/hwmon/hwmon0/device/temp1_input". If the sensor name equals "temp", then the value read will be divided by 1000, otherwise the number will be used unchanged. The factor 1000 is just for the Abit uGuru sensor.
+\fB\*(T<\fBhwmon\fR\*(T>\fR \*(T<\fB(dev) type n\fR\*(T>
+Hwmon sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one hwmon device. Parameter type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n is number of the sensor. See /sys/class/hwmon/ on your local computer.
.TP
\fB\*(T<\fBiconv_start\fR\*(T>\fR \*(T<\fBcodeset_from codeset_to\fR\*(T>
.TP
\fB\*(T<\fBi2c\fR\*(T>\fR \*(T<\fB(dev) type n\fR\*(T>
-I2C sensor from sysfs (Linux 2.6). dev may be omitted if you have only one I2C device. type is either in (or vol) meaning voltage, fan meaning fan or temp/tempf (first in C, second in F) meaning temperature. n is number of the sensor. See /sys/bus/i2c/devices/ on your local computer.
+I2C sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one I2C device. Parameter type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n is number of the sensor. See /sys/bus/i2c/devices/ on your local computer.
.TP
\fB\*(T<\fBi8k_ac_status\fR\*(T>\fR
.TP
\fB\*(T<\fBplatform\fR\*(T>\fR \*(T<\fB(dev) type n\fR\*(T>
-Platform sensor from sysfs (Linux 2.6). dev may be omitted if you have only one platform device. type is
-either in (or vol) meaning voltage, fan meaning fan or temp/tempf (first in C, second in F) meaning temperature. n is number
-of the sensor. See /sys/bus/platform/devices/ on your local computer.
+Platform sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one platform device. Platform type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n is number of the sensor. See /sys/bus/platform/devices/ on your local computer.
.TP
\fB\*(T<\fBpop3_unseen\fR\*(T>\fR \*(T<\fB(args)\fR\*(T>
</varlistentry>
<varlistentry>
- <term>
- <command><option>hwmon</option></command>
- <option>N sensor number input</option>
- </term>
- <listitem>
- This has the ability to display the contents of hwmon files located under "/sys/class/hwmon/hwmonX/device/N". For example, use ${hwmon 0 temp 1 input} to read the temperature of the CPU (in °C) from "/sys/class/hwmon/hwmon0/device/temp1_input". If the sensor name equals "temp", then the value read will be divided by 1000, otherwise the number will be used unchanged. The factor 1000 is just for the Abit uGuru sensor.
- <para></para></listitem>
+ <term>
+ <command><option>hwmon</option></command>
+ <option>(dev) type n</option>
+ </term>
+ <listitem>
+ Hwmon sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one hwmon device. Parameter type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n is number of the sensor. See /sys/class/hwmon/ on your local computer.
+ <para></para></listitem>
</varlistentry>
<varlistentry>
<option>(dev) type n</option>
</term>
<listitem>
- I2C sensor from sysfs (Linux 2.6). dev may be omitted if you have only one I2C device. type is either in (or vol) meaning voltage, fan meaning fan or temp/tempf (first in C, second in F) meaning temperature. n is number of the sensor. See /sys/bus/i2c/devices/ on your local computer.
+ I2C sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one I2C device. Parameter type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n is number of the sensor. See /sys/bus/i2c/devices/ on your local computer.
<para></para></listitem>
</varlistentry>
<option>(dev) type n</option>
</term>
<listitem>
- Platform sensor from sysfs (Linux 2.6). dev may be omitted if you have only one platform device. type is
-either in (or vol) meaning voltage, fan meaning fan or temp/tempf (first in C, second in F) meaning temperature. n is number
-of the sensor. See /sys/bus/platform/devices/ on your local computer.
+ Platform sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have only one platform device. Platform type is either 'in' or 'vol' meaning voltage; 'fan' meaning fan; 'temp' (Celsius) or 'tempf' (Fahrenheit) meaning temperature. Parameter n is number of the sensor. See /sys/bus/platform/devices/ on your local computer.
<para></para></listitem>
</varlistentry>
OBJ_alignr,
OBJ_alignc,
OBJ_i2c,
+ OBJ_platform,
+ OBJ_hwmon,
#if defined(__linux__)
OBJ_i8k_version,
OBJ_i8k_bios,
OBJ_mixerrbar,
OBJ_new_mails,
OBJ_nodename,
- OBJ_platform,
OBJ_pre_exec,
OBJ_processes,
OBJ_running_processes,
int arg;
char devtype[256];
char type[64];
- } i2c, platform; /* 2 */
+ } sysfs; /* 2 */
struct {
int pos;
close(objs[i].data.i);
break;
case OBJ_i2c:
- close(objs[i].data.i2c.fd);
+ close(objs[i].data.sysfs.fd);
break;
case OBJ_platform:
- close(objs[i].data.platform.fd);
+ close(objs[i].data.sysfs.fd);
+ break;
+ case OBJ_hwmon:
+ close(objs[i].data.sysfs.fd);
break;
#endif /* !__OpenBSD__ */
case OBJ_time:
obj->data.pair.b = b;
#ifndef __OpenBSD__
- END OBJ(i2c, INFO_I2C)
+ END OBJ(i2c, INFO_SYSFS)
char buf1[64], buf2[64];
int n;
if (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) != 3) {
/* if scanf couldn't read three values, read type and num and use default device */
sscanf(arg, "%63s %d", buf2, &n);
- obj->data.i2c.fd =
- open_i2c_sensor(0, buf2, n, &obj->data.i2c.arg, obj->data.i2c.devtype);
- strncpy(obj->data.i2c.type, buf2, 63);
+ obj->data.sysfs.fd =
+ open_i2c_sensor(0, buf2, n, &obj->data.sysfs.arg, obj->data.sysfs.devtype);
+ strncpy(obj->data.sysfs.type, buf2, 63);
} else {
- obj->data.i2c.fd =
- open_i2c_sensor(buf1, buf2, n, &obj->data.i2c.arg, obj->data.i2c.devtype);
- strncpy(obj->data.i2c.type, buf2, 63);
+ obj->data.sysfs.fd =
+ open_i2c_sensor(buf1, buf2, n, &obj->data.sysfs.arg, obj->data.sysfs.devtype);
+ strncpy(obj->data.sysfs.type, buf2, 63);
}
- END OBJ(platform, INFO_PLATFORM)
+ END OBJ(platform, INFO_SYSFS)
char buf1[64], buf2[64];
int n;
if (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) != 3) {
/* if scanf couldn't read three values, read type and num and use default device */
sscanf(arg, "%63s %d", buf2, &n);
- obj->data.platform.fd =
- open_platform_sensor(0, buf2, n, &obj->data.platform.arg, obj->data.platform.devtype);
- strncpy(obj->data.platform.type, buf2, 63);
+ obj->data.sysfs.fd =
+ open_platform_sensor(0, buf2, n, &obj->data.sysfs.arg, obj->data.sysfs.devtype);
+ strncpy(obj->data.sysfs.type, buf2, 63);
+ } else {
+ obj->data.sysfs.fd =
+ open_platform_sensor(buf1, buf2, n, &obj->data.sysfs.arg, obj->data.sysfs.devtype);
+ strncpy(obj->data.sysfs.type, buf2, 63);
+ }
+
+ END OBJ(hwmon, INFO_SYSFS)
+ char buf1[64], buf2[64];
+ int n;
+
+ if (!arg) {
+ ERR("hwmon needs argumanets");
+ obj->type = OBJ_text;
+ return NULL;
+ }
+
+ if (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) != 3) {
+ /* if scanf couldn't read three values, read type and num and use default device */
+ sscanf(arg, "%63s %d", buf2, &n);
+ obj->data.sysfs.fd =
+ open_hwmon_sensor(0, buf2, n, &obj->data.sysfs.arg, obj->data.sysfs.devtype);
+ strncpy(obj->data.sysfs.type, buf2, 63);
} else {
- obj->data.platform.fd =
- open_platform_sensor(buf1, buf2, n, &obj->data.platform.arg, obj->data.platform.devtype);
- strncpy(obj->data.platform.type, buf2, 63);
+ obj->data.sysfs.fd =
+ open_hwmon_sensor(buf1, buf2, n, &obj->data.sysfs.arg, obj->data.sysfs.devtype);
+ strncpy(obj->data.sysfs.type, buf2, 63);
}
#endif /* !__OpenBSD__ */
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
END OBJ(sysname, 0)
#ifndef __OpenBSD__
- END OBJ(temp1, INFO_I2C) obj->type = OBJ_i2c;
- obj->data.i2c.fd =
- open_i2c_sensor(0, "temp", 1, &obj->data.i2c.arg,
- obj->data.i2c.devtype);
- END OBJ(temp2, INFO_I2C) obj->type = OBJ_i2c;
- obj->data.i2c.fd =
- open_i2c_sensor(0, "temp", 2, &obj->data.i2c.arg,
- obj->data.i2c.devtype);
+ END OBJ(temp1, INFO_SYSFS) obj->type = OBJ_i2c;
+ obj->data.sysfs.fd =
+ open_i2c_sensor(0, "temp", 1, &obj->data.sysfs.arg,
+ obj->data.sysfs.devtype);
+ END OBJ(temp2, INFO_SYSFS) obj->type = OBJ_i2c;
+ obj->data.sysfs.fd =
+ open_i2c_sensor(0, "temp", 2, &obj->data.sysfs.arg,
+ obj->data.sysfs.devtype);
#endif
END OBJ(time, 0) obj->data.s = strdup(arg ? arg : "%F %T");
END OBJ(utime, 0) obj->data.s = strdup(arg ? arg : "%F %T");
OBJ(i2c) {
double r;
- r = get_sysbus_info(&obj->data.i2c.fd,
- obj->data.i2c.arg,
- obj->data.i2c.devtype,
- obj->data.i2c.type);
+ r = get_sysfs_info(&obj->data.sysfs.fd,
+ obj->data.sysfs.arg,
+ obj->data.sysfs.devtype,
+ obj->data.sysfs.type);
if (r >= 100.0 || r == 0)
snprintf(p, p_max_size, "%d", (int) r);
OBJ(platform) {
double r;
- r = get_sysbus_info(&obj->data.platform.fd,
- obj->data.platform.arg,
- obj->data.platform.devtype,
- obj->data.platform.type);
+ r = get_sysfs_info(&obj->data.sysfs.fd,
+ obj->data.sysfs.arg,
+ obj->data.sysfs.devtype,
+ obj->data.sysfs.type);
if (r >= 100.0 || r == 0)
snprintf(p, p_max_size, "%d", (int) r);
else
snprintf(p, p_max_size, "%.1f", r);
}
+ OBJ(hwmon) {
+ double r;
+
+ r = get_sysfs_info(&obj->data.sysfs.fd,
+ obj->data.sysfs.arg,
+ obj->data.sysfs.devtype,
+ obj->data.sysfs.type);
+
+ if (r >= 100.0 || r == 0)
+ snprintf(p, p_max_size, "%d", (int) r);
+ else
+ snprintf(p, p_max_size, "%.1f", r);
+ }
#endif /* !__OpenBSD__ */
OBJ(alignr) {
new_alignr(p, obj->data.i);
INFO_UPTIME = 6,
INFO_BUFFERS = 7,
INFO_FS = 8,
- INFO_I2C = 9,
+ INFO_SYSFS = 9,
INFO_MIXER = 10,
INFO_LOADAVG = 11,
INFO_UNAME = 12,
#ifdef RSS
INFO_RSS = 24,
#endif
- INFO_PLATFORM = 25
};
char get_voltage(char *, size_t, char *, int, unsigned int ); /* ptarjan */
void update_load_average();
-int open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype);
+int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype);
#define open_i2c_sensor(dev,type,n,div,devtype) \
- open_sysbus_sensor("/sys/bus/i2c/devices/",dev,type,n,div,devtype)
+ open_sysfs_sensor("/sys/bus/i2c/devices/",dev,type,n,div,devtype)
#define open_platform_sensor(dev,type,n,div,devtype) \
- open_sysbus_sensor("/sys/bus/platform/devices/",dev,type,n,div,devtype)
+ open_sysfs_sensor("/sys/bus/platform/devices/",dev,type,n,div,devtype)
-double get_sysbus_info(int *fd, int arg, char *devtype, char *type);
+#define open_hwmon_sensor(dev,type,n,div,devtype) \
+ open_sysfs_sensor("/sys/class/hwmon/",dev,type,n,div,devtype); \
+
+double get_sysfs_info(int *fd, int arg, char *devtype, char *type);
void get_adt746x_cpu( char *, size_t );
void get_adt746x_fan( char *, size_t );
}
double
-get_sysbus_info(int *fd, int arg, char *devtype, char *type)
+get_sysfs_info(int *fd, int arg, char *devtype, char *type)
{
return (0);
}
}
int
-open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
+open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
{
return (0);
}
}
}
-int open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
+int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
{
char path[256];
char buf[256];
int fd;
int divfd;
- /* if i2c device is NULL or *, get first */
+ memset (buf, 0, sizeof(buf));
+
+ /* if device is NULL or *, get first */
if (dev == NULL || strcmp(dev, "*") == 0) {
static int rep = 0;
if (!get_first_file_in_a_directory(dir, buf, &rep))
dev = buf;
}
+ if (strcmp (dir, "/sys/class/hwmon/")==0) {
+ if (*buf) {
+ /* buf holds result from get_first_file_in_a_directory() above,
+ * e.g. "hwmon0" -- append "/device" */
+ strcat (buf,"/device");
+ }
+ else {
+ /* dev holds device number N as a string,
+ * e.g. "0", -- convert to "hwmon0/device" */
+ sprintf (buf,"hwmon%s/device",dev);
+ dev = buf;
+ }
+ }
+
/* change vol to in */
if (strcmp(type, "vol") == 0)
type = "in";
/* open file */
fd = open(path, O_RDONLY);
if (fd < 0) {
- CRIT_ERR("can't open '%s': %s\nplease check your device or remove this var from Conky", path, strerror(errno));
+ CRIT_ERR("can't open '%s': %s\nplease check your device or remove this var from Conky",
+ path, strerror(errno));
}
if (strcmp(type, "in") == 0 || strcmp(type, "temp") == 0
return fd;
}
-double get_sysbus_info(int *fd, int div, char *devtype, char *type)
+double get_sysfs_info(int *fd, int div, char *devtype, char *type)
{
int val = 0;
}
-double get_sysbus_info(int *fd, int div, char *devtype)
+double get_sysfs_info(int *fd, int div, char *devtype)
{
return -1;
}
}
int
-open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
+open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
{
return -1;
}