mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
* Updated to libmpdclient 0.13.0
* Added post_21_kernel config param to specify kernels 2.6.22 and newer so i2c works properly git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@890 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
f95d63bf56
commit
7793867d6b
@ -1,5 +1,10 @@
|
||||
# $Id$
|
||||
|
||||
2007-08-05
|
||||
* Updated to libmpdclient 0.13.0
|
||||
* Added 'post_21_kernel' config param to specify kernels 2.6.22 and newer
|
||||
so i2c works properly
|
||||
|
||||
2007-08-04
|
||||
* Fixed potential issue on FreeBSD when nprocs < 10 (thanks zotrix)
|
||||
* Added support for multiple batteries when using acpi (thanks Phil)
|
||||
|
@ -356,6 +356,14 @@
|
||||
Print text to stdout.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>post_21_kernel</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Set to yes if you have Linux kernel 2.6.22 or newer
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><command><option>pad_percents</option></command></term>
|
||||
<listitem>
|
||||
|
12
src/conky.c
12
src/conky.c
@ -101,6 +101,10 @@ static void print_version()
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
int post_21_kernel;
|
||||
#endif /* __linux__ */
|
||||
|
||||
#ifdef X11
|
||||
|
||||
/*
|
||||
@ -6583,6 +6587,9 @@ static void set_default_configurations(void)
|
||||
info.xmms2.status = NULL;
|
||||
#endif
|
||||
use_spacer = 0;
|
||||
#if defined(__linux__)
|
||||
post_21_kernel = 0;
|
||||
#endif /* __linux__ */
|
||||
#ifdef X11
|
||||
out_to_console = 0;
|
||||
#else
|
||||
@ -6915,6 +6922,11 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
|
||||
CONF("draw_outline") {
|
||||
draw_outline = string_to_bool(value);
|
||||
}
|
||||
#if defined(__linux__)
|
||||
CONF("post_21_kernel") {
|
||||
post_21_kernel = string_to_bool(value);
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* X11 */
|
||||
CONF("out_to_console") {
|
||||
out_to_console = string_to_bool(value);
|
||||
|
@ -605,6 +605,10 @@ void init_rss_info();
|
||||
void free_rss_info();
|
||||
#endif /* RSS */
|
||||
|
||||
#if defined(__linux__)
|
||||
extern int post_21_kernel;
|
||||
#endif /* __linux__ */
|
||||
|
||||
/* in linux.c */
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <stdarg.h>
|
||||
#define MPD_BUFFER_MAX_LENGTH 50000
|
||||
#define MPD_ERRORSTR_MAX_LENGTH 1000
|
||||
#define MPD_WELCOME_MESSAGE "OK MPD "
|
||||
|
||||
#define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */
|
||||
@ -88,8 +89,9 @@ typedef enum mpd_TagItems
|
||||
MPD_TAG_ITEM_COMMENT,
|
||||
MPD_TAG_ITEM_DISC,
|
||||
MPD_TAG_ITEM_FILENAME,
|
||||
MPD_TAG_ITEM_ANY,
|
||||
MPD_TAG_NUM_OF_ITEM_TYPES
|
||||
}mpd_TagItems;
|
||||
} mpd_TagItems;
|
||||
|
||||
extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES];
|
||||
|
||||
@ -107,7 +109,7 @@ typedef struct _mpd_Connection {
|
||||
/* use this to check the version of mpd */
|
||||
int version[3];
|
||||
/* IMPORTANT, you want to get the error messages from here */
|
||||
char errorStr[MPD_BUFFER_MAX_LENGTH+1];
|
||||
char errorStr[MPD_ERRORSTR_MAX_LENGTH+1];
|
||||
int errorCode;
|
||||
int errorAt;
|
||||
/* this will be set to MPD_ERROR_* if there is an error, 0 if not */
|
||||
@ -225,12 +227,21 @@ typedef struct _mpd_Stats {
|
||||
unsigned long dbPlayTime;
|
||||
} mpd_Stats;
|
||||
|
||||
typedef struct _mpd_SearchStats {
|
||||
int numberOfSongs;
|
||||
unsigned long playTime;
|
||||
} mpd_SearchStats;
|
||||
|
||||
void mpd_sendStatsCommand(mpd_Connection * connection);
|
||||
|
||||
mpd_Stats * mpd_getStats(mpd_Connection * connection);
|
||||
|
||||
void mpd_freeStats(mpd_Stats * stats);
|
||||
|
||||
mpd_SearchStats * mpd_getSearchStats(mpd_Connection * connection);
|
||||
|
||||
void mpd_freeSearchStats(mpd_SearchStats * stats);
|
||||
|
||||
/* SONG STUFF */
|
||||
|
||||
#define MPD_SONG_NO_TIME -1
|
||||
@ -262,6 +273,8 @@ typedef struct _mpd_Song {
|
||||
char *genre;
|
||||
/* Composer */
|
||||
char *composer;
|
||||
/* Performer */
|
||||
char *performer;
|
||||
/* Disc */
|
||||
char *disc;
|
||||
/* Comment */
|
||||
@ -414,10 +427,10 @@ void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * dir);
|
||||
/* non-recursive version of ListallInfo */
|
||||
void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir);
|
||||
|
||||
#define MPD_TABLE_ARTIST 0
|
||||
#define MPD_TABLE_ALBUM 1
|
||||
#define MPD_TABLE_TITLE 2
|
||||
#define MPD_TABLE_FILENAME 3
|
||||
#define MPD_TABLE_ARTIST MPD_TAG_ITEM_ARTIST
|
||||
#define MPD_TABLE_ALBUM MPD_TAG_ITEM_ALBUM
|
||||
#define MPD_TABLE_TITLE MPD_TAG_ITEM_TITLE
|
||||
#define MPD_TABLE_FILENAME MPD_TAG_ITEM_FILENAME
|
||||
|
||||
void mpd_sendSearchCommand(mpd_Connection * connection, int table,
|
||||
const char * str);
|
||||
@ -434,7 +447,7 @@ char * mpd_getNextArtist(mpd_Connection * connection);
|
||||
|
||||
char * mpd_getNextAlbum(mpd_Connection * connection);
|
||||
|
||||
char * mpd_getNextTag(mpd_Connection *connection, int table);
|
||||
char * mpd_getNextTag(mpd_Connection *connection, int type);
|
||||
|
||||
/* list artist or albums by artist, arg1 should be set to the artist if
|
||||
* listing albums by a artist, otherwise NULL for listing all artists or albums
|
||||
@ -446,6 +459,8 @@ void mpd_sendListCommand(mpd_Connection * connection, int table,
|
||||
|
||||
void mpd_sendAddCommand(mpd_Connection * connection, const char * file);
|
||||
|
||||
int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file);
|
||||
|
||||
void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum);
|
||||
|
||||
void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum);
|
||||
@ -456,6 +471,9 @@ void mpd_sendLoadCommand(mpd_Connection * connection, const char * name);
|
||||
|
||||
void mpd_sendRmCommand(mpd_Connection * connection, const char * name);
|
||||
|
||||
void mpd_sendRenameCommand(mpd_Connection *connection, const char *from,
|
||||
const char *to);
|
||||
|
||||
void mpd_sendShuffleCommand(mpd_Connection * connection);
|
||||
|
||||
void mpd_sendClearCommand(mpd_Connection * connection);
|
||||
@ -544,6 +562,7 @@ void mpd_freeOutputElement(mpd_OutputEntity * output);
|
||||
* Queries mpd for the allowed commands
|
||||
*/
|
||||
void mpd_sendCommandsCommand(mpd_Connection * connection);
|
||||
|
||||
/**
|
||||
* @param connection a #mpd_Connection
|
||||
*
|
||||
@ -560,6 +579,14 @@ void mpd_sendNotCommandsCommand(mpd_Connection * connection);
|
||||
*/
|
||||
char *mpd_getNextCommand(mpd_Connection *connection);
|
||||
|
||||
void mpd_sendUrlHandlersCommand(mpd_Connection * connection);
|
||||
|
||||
char *mpd_getNextHandler(mpd_Connection * connection);
|
||||
|
||||
void mpd_sendTagTypesCommand(mpd_Connection * connection);
|
||||
|
||||
char *mpd_getNextTagType(mpd_Connection * connection);
|
||||
|
||||
/**
|
||||
* @param connection a MpdConnection
|
||||
* @param path the path to the playlist.
|
||||
@ -568,6 +595,7 @@ char *mpd_getNextCommand(mpd_Connection *connection);
|
||||
*
|
||||
*/
|
||||
void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path);
|
||||
|
||||
/**
|
||||
* @param connection a MpdConnection
|
||||
* @param path the path to the playlist.
|
||||
@ -584,27 +612,29 @@ void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path);
|
||||
* starts a search, use mpd_addConstraintSearch to add
|
||||
* a constraint to the search, and mpd_commitSearch to do the actual search
|
||||
*/
|
||||
void mpd_startSearch(mpd_Connection * connection,int exact);
|
||||
void mpd_startSearch(mpd_Connection *connection, int exact);
|
||||
|
||||
/**
|
||||
* @param connection a #mpd_Connection
|
||||
* @param field
|
||||
* @param type
|
||||
* @param name
|
||||
*
|
||||
*/
|
||||
void mpd_addConstraintSearch(mpd_Connection *connection, int field, char *name);
|
||||
void mpd_addConstraintSearch(mpd_Connection *connection, int type, const char *name);
|
||||
|
||||
/**
|
||||
* @param connection a #mpd_Connection
|
||||
*
|
||||
*/
|
||||
void mpd_commitSearch(mpd_Connection *connection);
|
||||
|
||||
/**
|
||||
* @param connection a #mpd_Connection
|
||||
* @param field The field to search
|
||||
* @param type The type to search for
|
||||
*
|
||||
* starts a search for fields... f.e. get a list of artists would be:
|
||||
* @code
|
||||
* mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
|
||||
* mpd_commitSearch(connection);
|
||||
* @endcode
|
||||
*
|
||||
* or get a list of artist in genre "jazz" would be:
|
||||
* @code
|
||||
@ -614,10 +644,25 @@ void mpd_commitSearch(mpd_Connection *connection);
|
||||
* @endcode
|
||||
*
|
||||
* mpd_startSearch will return a list of songs (and you need mpd_getNextInfoEntity)
|
||||
* this one will return a list of only one field (the field specified with field) and you need
|
||||
* this one will return a list of only one field (the one specified with type) and you need
|
||||
* mpd_getNextTag to get the results
|
||||
*/
|
||||
void mpd_startFieldSearch(mpd_Connection * connection,int field);
|
||||
void mpd_startFieldSearch(mpd_Connection *connection, int type);
|
||||
|
||||
void mpd_startPlaylistSearch(mpd_Connection *connection, int exact);
|
||||
|
||||
void mpd_startStatsSearch(mpd_Connection *connection);
|
||||
|
||||
void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path);
|
||||
|
||||
void mpd_sendPlaylistAddCommand(mpd_Connection *connection,
|
||||
char *playlist, char *path);
|
||||
|
||||
void mpd_sendPlaylistMoveCommand(mpd_Connection *connection,
|
||||
char *playlist, int from, int to);
|
||||
|
||||
void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection,
|
||||
char *playlist, int pos);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
24
src/linux.c
24
src/linux.c
@ -252,6 +252,8 @@ inline void update_net_stats()
|
||||
curtmp1 += ns->net_rec[i];
|
||||
curtmp2 += ns->net_trans[i];
|
||||
}
|
||||
if (curtmp1 == 0) curtmp1 = 1;
|
||||
if (curtmp2 == 0) curtmp2 = 1;
|
||||
ns->recv_speed = curtmp1 / (double) info.net_avg_samples;
|
||||
ns->trans_speed = curtmp2 / (double) info.net_avg_samples;
|
||||
if (info.net_avg_samples > 1) {
|
||||
@ -624,12 +626,14 @@ get_first_file_in_a_directory(const char *dir, char *s, int *rep)
|
||||
}
|
||||
}
|
||||
|
||||
#define I2C_DIR "/sys/bus/i2c/devices/"
|
||||
|
||||
int
|
||||
open_i2c_sensor(const char *dev, const char *type, int n, int *div,
|
||||
char *devtype)
|
||||
int open_i2c_sensor(const char *dev, const char *type, int n, int *div, char *devtype)
|
||||
{
|
||||
char i2c_dir[64];
|
||||
if (post_21_kernel) {
|
||||
strncpy(i2c_dir, "/sys/bus/platform/devices/", 64);
|
||||
} else {
|
||||
strncpy(i2c_dir, "/sys/bus/i2c/devices/", 64);
|
||||
}
|
||||
char path[256];
|
||||
char buf[256];
|
||||
int fd;
|
||||
@ -638,7 +642,7 @@ open_i2c_sensor(const char *dev, const char *type, int n, int *div,
|
||||
/* if i2c device is NULL or *, get first */
|
||||
if (dev == NULL || strcmp(dev, "*") == 0) {
|
||||
static int rep = 0;
|
||||
if (!get_first_file_in_a_directory(I2C_DIR, buf, &rep))
|
||||
if (!get_first_file_in_a_directory(i2c_dir, buf, &rep))
|
||||
return -1;
|
||||
dev = buf;
|
||||
}
|
||||
@ -648,9 +652,9 @@ open_i2c_sensor(const char *dev, const char *type, int n, int *div,
|
||||
type = "in";
|
||||
|
||||
if (strcmp(type, "tempf") == 0) {
|
||||
snprintf(path, 255, I2C_DIR "%s/%s%d_input", dev, "temp", n);
|
||||
snprintf(path, 255, "%s%s/%s%d_input", i2c_dir, dev, "temp", n);
|
||||
} else {
|
||||
snprintf(path, 255, I2C_DIR "%s/%s%d_input", dev, type, n);
|
||||
snprintf(path, 255, "%s%s/%s%d_input", i2c_dir, dev, type, n);
|
||||
}
|
||||
strncpy(devtype, path, 255);
|
||||
|
||||
@ -671,10 +675,10 @@ open_i2c_sensor(const char *dev, const char *type, int n, int *div,
|
||||
|
||||
/* test if *_div file exist, open it and use it as divisor */
|
||||
if (strcmp(type, "tempf") == 0) {
|
||||
snprintf(path, 255, I2C_DIR "%s/%s%d_div", "one", "two",
|
||||
snprintf(path, 255, "%s%s/%s%d_div", i2c_dir, "one", "two",
|
||||
n);
|
||||
} else {
|
||||
snprintf(path, 255, I2C_DIR "%s/%s%d_div", dev, type, n);
|
||||
snprintf(path, 255, "%s%s/%s%d_div", i2c_dir, dev, type, n);
|
||||
}
|
||||
|
||||
divfd = open(path, O_RDONLY);
|
||||
|
Loading…
Reference in New Issue
Block a user