mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-15 17:47:09 +00:00
convert sony_fanspeed to callbacks.print
This commit is contained in:
parent
42b71217e3
commit
faa47450ad
@ -901,10 +901,6 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
snprintf(p, p_max_size, "%s",
|
snprintf(p, p_max_size, "%s",
|
||||||
get_disk_protect_queue(obj->data.s));
|
get_disk_protect_queue(obj->data.s));
|
||||||
}
|
}
|
||||||
/* 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 (!gateway_exists()) {
|
if (!gateway_exists()) {
|
||||||
|
@ -330,6 +330,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
/* information from sony_laptop kernel module
|
/* information from sony_laptop kernel module
|
||||||
* /sys/devices/platform/sony-laptop */
|
* /sys/devices/platform/sony-laptop */
|
||||||
END OBJ(sony_fanspeed, 0)
|
END OBJ(sony_fanspeed, 0)
|
||||||
|
obj->callbacks.print = &get_sony_fanspeed;
|
||||||
END OBJ_IF(if_gw, &update_gateway_info)
|
END OBJ_IF(if_gw, &update_gateway_info)
|
||||||
END OBJ_ARG(ioscheduler, 0, "get_ioscheduler needs an argument (e.g. hda)")
|
END OBJ_ARG(ioscheduler, 0, "get_ioscheduler needs an argument (e.g. hda)")
|
||||||
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sony.h"
|
#include "sony.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
#include "text_object.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -43,12 +44,14 @@
|
|||||||
/* fanspeed in SONY_LAPTOP_DIR contains an integer value for fanspeed (0~255).
|
/* 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
|
* I don't know the exact measurement unit, though. I may assume that 0 for
|
||||||
* 'fan stopped' and 255 for 'maximum fan speed'. */
|
* 'fan stopped' and 255 for 'maximum fan speed'. */
|
||||||
void get_sony_fanspeed(char *p_client_buffer, size_t client_buffer_size)
|
void get_sony_fanspeed(struct text_object *obj, char *p_client_buffer, int client_buffer_size)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
unsigned int speed = 0;
|
unsigned int speed = 0;
|
||||||
char fan[128];
|
char fan[128];
|
||||||
|
|
||||||
|
(void)obj;
|
||||||
|
|
||||||
if (!p_client_buffer || client_buffer_size <= 0) {
|
if (!p_client_buffer || client_buffer_size <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
#ifndef _SONY_H
|
#ifndef _SONY_H
|
||||||
#define _SONY_H
|
#define _SONY_H
|
||||||
|
|
||||||
#include <sys/types.h>
|
void get_sony_fanspeed(struct text_object *, char *, int);
|
||||||
|
|
||||||
void get_sony_fanspeed(char *buf, size_t client_buffer_size);
|
|
||||||
|
|
||||||
#endif /* _SONY_H */
|
#endif /* _SONY_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user