diff --git a/src/common.h b/src/common.h index 9658453f..be182808 100644 --- a/src/common.h +++ b/src/common.h @@ -70,18 +70,6 @@ struct net_stat { void clear_net_stats(void); struct net_stat *get_net_stat(const char *); -int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, - int *divisor, char *devtype); - -#define open_i2c_sensor(dev, type, n, divisor, devtype) \ - open_sysfs_sensor("/sys/bus/i2c/devices/", dev, type, n, divisor, devtype) -#define open_platform_sensor(dev, type, n, divisor, devtype) \ - open_sysfs_sensor("/sys/bus/platform/devices/", dev, type, n, divisor, devtype) -#define open_hwmon_sensor(dev, type, n, divisor, devtype) \ - open_sysfs_sensor("/sys/class/hwmon/", dev, type, n, divisor, 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); diff --git a/src/conky.c b/src/conky.c index a28530ef..cb30a041 100644 --- a/src/conky.c +++ b/src/conky.c @@ -627,12 +627,14 @@ static void free_text_objects(struct text_object *root) case OBJ_acpitemp: close(data.i); break; +#endif /* !__OpenBSD__ */ +#ifdef __linux__ case OBJ_i2c: case OBJ_platform: case OBJ_hwmon: close(data.sysfs.fd); break; -#endif /* !__OpenBSD__ */ +#endif /* __linux__ */ case OBJ_time: case OBJ_utime: free(data.s); @@ -1598,7 +1600,7 @@ static struct text_object *construct_text_object(const char *s, obj->data.pair.a = a; obj->data.pair.b = b; -#ifndef __OpenBSD__ +#ifdef __linux__ END OBJ(i2c, INFO_SYSFS) char buf1[64], buf2[64]; int n; @@ -2122,7 +2124,7 @@ static struct text_object *construct_text_object(const char *s, END OBJ(swapbar, INFO_MEM) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b); END OBJ(sysname, 0) -#ifndef __OpenBSD__ +#ifdef __linux__ END OBJ(temp1, INFO_SYSFS) obj->type = OBJ_i2c; obj->data.sysfs.fd = open_i2c_sensor(0, "temp", 1, @@ -3918,7 +3920,7 @@ static void generate_text_internal(char *p, int p_max_size, OBJ(voffset) { new_voffset(p, obj->data.i); } -#ifndef __OpenBSD__ +#ifdef __linux__ OBJ(i2c) { double r; @@ -3961,7 +3963,7 @@ static void generate_text_internal(char *p, int p_max_size, snprintf(p, p_max_size, "%.1f", r); } } -#endif /* !__OpenBSD__ */ +#endif /* __linux__ */ OBJ(alignr) { new_alignr(p, obj->data.i); } diff --git a/src/freebsd.c b/src/freebsd.c index d5859d73..a34a01ed 100644 --- a/src/freebsd.c +++ b/src/freebsd.c @@ -345,11 +345,6 @@ void update_cpu_usage() oldtotal = total; } -double get_sysfs_info(int *fd, int arg, char *devtype, char *type) -{ - return 0.0; -} - void update_load_average() { double v[3]; @@ -450,12 +445,6 @@ int get_battery_perct_bar(const char *bar) return 0; } -int open_sysfs_sensor(const char *dir, const char *dev, const char *type, - int n, int *div, char *devtype) -{ - return 0; -} - int open_acpi_temperature(const char *name) { return 0; diff --git a/src/linux.h b/src/linux.h index b9ea6578..4b1f098a 100644 --- a/src/linux.h +++ b/src/linux.h @@ -28,4 +28,16 @@ void update_gateway_info(void); enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME }; void get_powerbook_batt_info(char *, size_t, int); +int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, + int *divisor, char *devtype); + +#define open_i2c_sensor(dev, type, n, divisor, devtype) \ + open_sysfs_sensor("/sys/bus/i2c/devices/", dev, type, n, divisor, devtype) +#define open_platform_sensor(dev, type, n, divisor, devtype) \ + open_sysfs_sensor("/sys/bus/platform/devices/", dev, type, n, divisor, devtype) +#define open_hwmon_sensor(dev, type, n, divisor, devtype) \ + open_sysfs_sensor("/sys/class/hwmon/", dev, type, n, divisor, devtype) + +double get_sysfs_info(int *fd, int arg, char *devtype, char *type); + #endif /* _LINUX_H */ diff --git a/src/netbsd.c b/src/netbsd.c index 71d0a4c6..8f054f92 100644 --- a/src/netbsd.c +++ b/src/netbsd.c @@ -302,11 +302,6 @@ void update_cpu_usage() oldtotal = total; } -double get_sysfs_info(int *fd, int div, char *devtype) -{ - return -1; -} - void update_load_average() { double v[3]; @@ -327,12 +322,6 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item) { } -int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n, - int *div, char *devtype) -{ - return -1; -} - int open_acpi_temperature(const char *name) { return -1;