forked from enlightenment/enlightenment
Enlightenment: Fix double compare in batman and fix compilation on bsd.
This commit is contained in:
parent
0b0b6e6fd9
commit
9189293b46
|
@ -414,11 +414,11 @@ _batman_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
|
|||
|
||||
if (inst->o_main != event_data) return;
|
||||
|
||||
#ifdef HAVE_EEZE
|
||||
#if defined(HAVE_EEZE)
|
||||
_batman_udev_stop(inst);
|
||||
#elif defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__
|
||||
_batman_sysctl_stop();
|
||||
#elif upower
|
||||
#elif defined(upower)
|
||||
_batman_upower_stop();
|
||||
#else
|
||||
_batman_fallback_stop();
|
||||
|
@ -439,7 +439,7 @@ sysinfo_batman_remove(Instance *inst)
|
|||
_batman_udev_stop(inst);
|
||||
#elif defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__
|
||||
_batman_sysctl_stop();
|
||||
#elif upower
|
||||
#elif defined(upower)
|
||||
_batman_upower_stop();
|
||||
#else
|
||||
_batman_fallback_stop();
|
||||
|
|
|
@ -229,11 +229,11 @@ _batman_udev_battery_update(const char *syspath, Battery *bat, Instance *inst)
|
|||
GET_STR(bat, model, POWER_SUPPLY_MODEL_NAME);
|
||||
GET_STR(bat, vendor, POWER_SUPPLY_MANUFACTURER);
|
||||
GET_NUM(bat, design_charge, POWER_SUPPLY_ENERGY_FULL_DESIGN);
|
||||
if (!bat->design_charge)
|
||||
if (eina_dbl_exact(bat->design_charge, 0))
|
||||
GET_NUM(bat, design_charge, POWER_SUPPLY_CHARGE_FULL_DESIGN);
|
||||
}
|
||||
GET_NUM(bat, last_full_charge, POWER_SUPPLY_ENERGY_FULL);
|
||||
if (!bat->last_full_charge)
|
||||
if (eina_dbl_exact(bat->last_full_charge, 0))
|
||||
GET_NUM(bat, last_full_charge, POWER_SUPPLY_CHARGE_FULL);
|
||||
test = eeze_udev_syspath_get_property(bat->udi, "POWER_SUPPLY_ENERGY_NOW");
|
||||
if (!test)
|
||||
|
@ -245,9 +245,9 @@ _batman_udev_battery_update(const char *syspath, Battery *bat, Instance *inst)
|
|||
charge = strtod(test, NULL);
|
||||
eina_stringshare_del(test);
|
||||
t = ecore_time_get();
|
||||
if ((bat->got_prop) && (charge != bat->current_charge) && bat->current_charge != 0)
|
||||
if ((bat->got_prop) && (!eina_dbl_exact(charge, bat->current_charge)) && (!eina_dbl_exact(bat->current_charge, 0)))
|
||||
charge_rate = ((charge - bat->current_charge) / (t - bat->last_update));
|
||||
if (charge_rate != 0 || bat->last_update == 0 || bat->current_charge == 0)
|
||||
if ((!eina_dbl_exact(charge_rate, 0)) || eina_dbl_exact(bat->last_update, 0) || eina_dbl_exact(bat->current_charge, 0))
|
||||
{
|
||||
bat->last_update = t;
|
||||
bat->current_charge = charge;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#include "cpuclock.h"
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
typedef struct _Thread_Config Thread_Config;
|
||||
|
||||
struct _Thread_Config
|
||||
{
|
||||
int interval;
|
||||
|
@ -9,7 +12,6 @@ struct _Thread_Config
|
|||
};
|
||||
|
||||
typedef struct _Pstate_Config Pstate_Config;
|
||||
|
||||
struct _Pstate_Config
|
||||
{
|
||||
Instance *inst;
|
||||
|
@ -77,7 +79,7 @@ _cpuclock_set_thread_frequency(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
const char *freq = data;
|
||||
|
||||
#if defined __FreeBSD__ || defined __OpenBSD__
|
||||
_cpuclock_sysctl_set("frequency", freq);
|
||||
_cpuclock_sysctl_frequency(freq);
|
||||
return;
|
||||
#endif
|
||||
_cpuclock_sysfs_setall("scaling_setspeed", freq);
|
||||
|
|
|
@ -8,7 +8,7 @@ int _cpuclock_sysfs_setall(const char *control, const char *value);
|
|||
int _cpuclock_sysfs_set(const char *control, const char *value);
|
||||
int _cpuclock_sysfs_pstate(int min, int max, int turbo);
|
||||
#if defined __OpenBSD__ || defined __FreeBSD__
|
||||
int _cpuclock_sysctl_frequency(int new_perf)
|
||||
int _cpuclock_sysctl_frequency(int new_perf);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if defined(__linux__)
|
||||
#include "thermal.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -429,3 +430,5 @@ thermal_fallback_get(Tempthread *tth)
|
|||
temp = check(tth);
|
||||
return temp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -177,6 +177,7 @@ check(Tempthread *tth)
|
|||
else
|
||||
goto error;
|
||||
#endif
|
||||
}
|
||||
else if (tth->sensor_type == SENSOR_TYPE_OPENBSD)
|
||||
{
|
||||
#ifdef __OpenBSD_
|
||||
|
|
Loading…
Reference in New Issue