1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

Merge branch 'master' into imlib2

This commit is contained in:
Brenden Matthews 2009-05-04 13:22:51 -06:00
commit d6e5a6491f
11 changed files with 144 additions and 3713 deletions

2
.gitignore vendored
View File

@ -34,3 +34,5 @@ conky-*.tar.*
doc/*.html doc/*.html
doc/*.mxml doc/*.mxml
patches/ patches/
README
doc/conky.1

View File

@ -1,3 +1,6 @@
2009-05-03
* Added Sony VAIO fanspeed info (thanks Yeon-Hyeong)
2009-05-01 2009-05-01
* Added diskio_avg_samples patch (thanks Yeon-Hyeong) * Added diskio_avg_samples patch (thanks Yeon-Hyeong)
* Fixed $texeci regression * Fixed $texeci regression

1975
README

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2733,6 +2733,7 @@
Prints the song name in either the form "artist - title" or file name, depending on whats available Prints the song name in either the form "artist - title" or file name, depending on whats available
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command><option>if_xmms2_connected</option></command> <command><option>if_xmms2_connected</option></command>
@ -2742,6 +2743,15 @@
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command><option>sony_fanspeed</option></command>
</term>
<listitem>
Displays the Sony VAIO fanspeed information if sony-laptop kernel support is enabled. Linux only.
<para></para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command><option>eve</option></command> <command><option>eve</option></command>

View File

@ -64,7 +64,7 @@ xmms2 = xmms2.c
endif endif
if BUILD_LINUX if BUILD_LINUX
linux = linux.c top.c diskio.c users.c linux = linux.c top.c diskio.c users.c sony.c
PTHREAD_LIBS = -lpthread PTHREAD_LIBS = -lpthread
endif endif
@ -208,6 +208,7 @@ EXTRA_DIST = \
smapi.h \ smapi.h \
ibm.c \ ibm.c \
ibm.h \ ibm.h \
sony.h \
users.c users.c

View File

@ -1226,6 +1226,9 @@ static struct text_object *construct_text_object(const char *s,
END OBJ(ibm_volume, 0) END OBJ(ibm_volume, 0)
END OBJ(ibm_brightness, 0) END OBJ(ibm_brightness, 0)
#endif #endif
/* information from sony_laptop kernel module
* /sys/devices/platform/sony-laptop */
END OBJ(sony_fanspeed, 0)
END OBJ_IF(if_gw, 0) END OBJ_IF(if_gw, 0)
END OBJ(ioscheduler, 0) END OBJ(ioscheduler, 0)
if (!arg) { if (!arg) {
@ -2545,7 +2548,7 @@ static struct text_object *construct_text_object(const char *s,
}else if(arg[i] == '}') { }else if(arg[i] == '}') {
indenting--; indenting--;
} }
if(indenting == 0 && (arg[i+1] == ' ' || arg[i+1] == '$' || arg[i+1] == 0)) { if (indenting == 0 && arg[i+1] < 48) { //<48 has 0, $, and the most used chars not used in varnames but not { or }
endvar[j]=i+1; endvar[j]=i+1;
j++; j++;
} }
@ -3418,6 +3421,11 @@ static void generate_text_internal(char *p, int p_max_size,
get_ibm_acpi_brightness(p, p_max_size); get_ibm_acpi_brightness(p, p_max_size);
} }
#endif /* IBM */ #endif /* IBM */
/* information from sony_laptop kernel module
* /sys/devices/platform/sony-laptop */
OBJ(sony_fanspeed) {
get_sony_fanspeed(p, p_max_size);
}
OBJ(if_gw) { OBJ(if_gw) {
if (!cur->gw_info.count) { if (!cur->gw_info.count) {
DO_JUMP; DO_JUMP;

View File

@ -103,6 +103,9 @@ char *strndup(const char *s, size_t n);
#include "smapi.h" #include "smapi.h"
#endif #endif
/* sony support */
#include "sony.h"
/* A size for temporary, static buffers to use when /* A size for temporary, static buffers to use when
* one doesn't know what to choose. Defaults to 256. */ * one doesn't know what to choose. Defaults to 256. */
extern unsigned int text_buffer_size; extern unsigned int text_buffer_size;

76
src/sony.c Normal file
View File

@ -0,0 +1,76 @@
/* Conky, a system monitor, based on torsmo
*
* Please see COPYING for details
*
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
* Copyright (c) 2009 Yeon-Hyeong Yang <lbird94@gmail.com>
* (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/>.
*
*/
/* conky support for information from sony_laptop kernel module
* information from sony_laptop kernel module
* /sys/devices/platform/sony-laptop
* I mimicked the methods from ibm.c
* Yeon-Hyeong Yang <lbird94@gmail.com> */
#include "conky.h"
#include "config.h"
#include "sony.h"
#include "logging.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#define SONY_LAPTOP_DIR "/sys/devices/platform/sony-laptop"
/* fanspeed in SONY_LAPTOP_DIR contains an integer value for fanspeed (0~255).
* I don't know the exact measurement unit, though. I may assume that 0 for
* 'fan stopped' and 255 for 'maximum fan speed'. */
void get_sony_fanspeed(char *p_client_buffer, size_t client_buffer_size)
{
FILE *fp;
unsigned int speed = 0;
char fan[128];
if (!p_client_buffer || client_buffer_size <= 0) {
return;
}
snprintf(fan, 127, "%s/fanspeed", SONY_LAPTOP_DIR);
fp = fopen(fan, "r");
if (fp != NULL) {
while (!feof(fp)) {
char line[256];
if (fgets(line, 255, fp) == NULL) {
break;
}
if (sscanf(line, "%u", &speed)) {
break;
}
}
} else {
CRIT_ERR("can't open '%s': %s\nEnable sony support or remove "
"sony* from your "PACKAGE_NAME" config file.",
fan, strerror(errno));
}
fclose(fp);
snprintf(p_client_buffer, client_buffer_size, "%d", speed);
}

36
src/sony.h Normal file
View File

@ -0,0 +1,36 @@
/* Conky, a system monitor, based on torsmo
*
* Please see COPYING for details
*
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
* Copyright (c) 2009 Yeon-Hyeong Yang <lbird94@gmail.com>
* (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/>.
*
*/
/* conky support for information from sony_laptop kernel module
* information from sony_laptop kernel module
* /sys/devices/platform/sony-laptop
* I mimicked the methods from ibm.c
* Yeon-Hyeong Yang <lbird94@gmail.com> */
#ifndef _SONY_H
#define _SONY_H
#include <sys/types.h>
void get_sony_fanspeed(char *buf, size_t client_buffer_size);
#endif /* _SONY_H */

View File

@ -148,6 +148,9 @@ enum text_object_type {
OBJ_smapi_bat_power, OBJ_smapi_bat_power,
OBJ_if_smapi_bat_installed, OBJ_if_smapi_bat_installed,
#endif /* IBM */ #endif /* IBM */
/* information from sony_laptop kernel module
* /sys/devices/platform/sony-laptop */
OBJ_sony_fanspeed,
OBJ_if_gw, OBJ_if_gw,
OBJ_ioscheduler, OBJ_ioscheduler,
OBJ_gw_iface, OBJ_gw_iface,