X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fbattery.c;h=2e27e60e4bcdce4b0be7452a943ce2d398636f60;hb=c96e6f04275cad2ba1622555f3f4e58bda4d92df;hp=bdf461945c7e780be1ed0e7d383054b0c046c7c6;hpb=2f0dfdda8bc499fdb161c6a5850ec176e75bd4fa;p=collectd.git diff --git a/src/battery.c b/src/battery.c index bdf46194..2e27e60e 100644 --- a/src/battery.c +++ b/src/battery.c @@ -48,45 +48,12 @@ # include #endif -#if HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H || KERNEL_LINUX -# define BATTERY_HAVE_READ 1 -#else -# define BATTERY_HAVE_READ 0 +#if !HAVE_IOKIT_IOKITLIB_H && !HAVE_IOKIT_PS_IOPOWERSOURCES_H && !KERNEL_LINUX +# error "No applicable input method." #endif #define INVALID_VALUE 47841.29 -static data_source_t data_source_charge[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t charge_ds = -{ - "charge", 1, data_source_charge -}; - -static data_source_t data_source_current[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t current_ds = -{ - "current", 1, data_source_current -}; - -static data_source_t data_source_voltage[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t voltage_ds = -{ - "voltage", 1, data_source_voltage -}; - -#if BATTERY_HAVE_READ #if HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H /* No global variables */ /* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */ @@ -553,22 +520,9 @@ static int battery_read (void) return (0); } -#endif /* BATTERY_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - { - plugin_register_data_set (&charge_ds); - plugin_register_data_set (¤t_ds); - plugin_register_data_set (&voltage_ds); - } - -#if BATTERY_HAVE_READ - if (load & MR_READ) - { - plugin_register_init ("battery", battery_init); - plugin_register_read ("battery", battery_read); - } -#endif /* BATTERY_HAVE_READ */ + plugin_register_init ("battery", battery_init); + plugin_register_read ("battery", battery_read); } /* void module_register */