}
if (new_bat_capacity <= battery_info.realoff) {
- if (battery->charge_now == CHARGER_CHARGING || battery->charger_charging == CHARGER_DISABLED) {
- _I("Skip lowbat poweroff during test (c:%d charge:%d online:%d charger_charging:%d)",
- battery->capacity, battery->charge_now, battery->charger_connected, battery->charger_charging);
+ if (battery->charge_now == CHARGER_CHARGING) {
new_bat_state = battery_info.poweroff;
if (vconf_state != VCONFKEY_SYSMAN_BAT_POWER_OFF)
status = VCONFKEY_SYSMAN_BAT_POWER_OFF;
if (low_bat_skip_cnt >= RETRY_MAX) {
new_bat_state = battery_info.realoff;
status = VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF;
- _I("Go to real poweroff inspite of charging (c:%d charge:%d online:%d charger_charging %d current now %d)",
- battery->capacity, battery->charge_now, battery->charger_connected, battery->charger_charging, battery->current_now);
+ _I("Go to real poweroff inspite of charging (c:%d charge:%d online:%d current_now:%d)",
+ battery->capacity, battery->charge_now, battery->charger_connected, battery->current_now);
low_bat_skip_cnt = 0;
} else if (battery->current_now <= MIN_INOW_VALUE) {
low_bat_skip_cnt++;
static int old;
static char sig_old[32];
int ret;
- int chg_on;
if (!sig) {
_E("There is no signal name.");
old = status;
- if (battery.charger_charging == CHARGER_DISABLED) {
- ret = sys_get_int(CHARGER_CHARGE_ON_NODE, &chg_on);
- if (ret == 0 && battery.charger_charging != chg_on) {
- ret = sys_set_int(CHARGER_CHARGE_ON_NODE, battery.charger_charging);
- _I("%s to change status with %d", ((ret == 0) ? "success" : "fail"), battery.charger_charging);
- }
- if (strncmp(sig, CHARGE_NOW_SIGNAL, strlen(CHARGE_NOW_SIGNAL)) == 0) {
- _I("Skip signal while charger disabled.");
- return 0;
- }
- }
-
snprintf(sig_old, sizeof(sig_old), "%s", sig);
ret = gdbus_signal_emit(NULL,
return g_variant_new("(i)", type);
}
-static GVariant *dbus_charger_charging(GDBusConnection *conn,
- const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
- GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
-{
- int ret = 0;
- int val;
- int chg_on;
-
- g_variant_get(param, "(i)", &val);
-
- if (val != CHARGER_ENABLED && val != CHARGER_DISABLED) {
- _E("There is no valid input: %d", battery.charger_charging);
- ret = -EINVAL;
- goto out;
- }
- if (battery.charger_connected == 0) {
- _E("There is no charger(%d) input(%d).", battery.charger_connected, battery.charger_charging);
- ret = -EACCES;
- goto out;
- }
- ret = sys_get_int(CHARGER_CHARGE_ON_NODE, &chg_on);
- if (ret == 0 && val != chg_on) {
- battery.charger_charging = val;
- ret = sys_set_int(CHARGER_CHARGE_ON_NODE, battery.charger_charging);
- CRITICAL_LOG("chg_on changed to %d %s", battery.charger_charging,
- (ret == 0) ? "success" : "fail");
- _I("%s to change status with %d.", ((ret == 0) ? "success" : "fail"), battery.charger_charging);
- } else {
- _I("Skip change status with %d (ret %d prev %d)", val, ret, battery.charger_charging);
- }
-out:
- return g_variant_new("(i)", ret);
-}
-
static GVariant *dbus_get_charge_now(GDBusConnection *conn,
const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
{ GET_POWER_SUBSYSTEM, NULL, "iiiiiiisiiiii", dbus_get_power_supply_handler },
{ "GetBatteryInfo", NULL, "isssiiiiiiii", dbus_get_battery_info },
{ CHARGER_TYPE_SIGNAL, NULL, "i", dbus_get_charger_type },
- { "ChargerCharging", "i", "i", dbus_charger_charging },
{ CHARGE_BATTERY_PROPERTIES, NULL, "iiiiii", dbus_get_battery_props },
{ CHARGE_MISC_EVENT_SIGNAL, NULL, "i", dbus_get_misc },
};
memset(&battery, 0, sizeof(struct battery_status));
memset(&old_battery, 0, sizeof(struct battery_status));
- battery.charger_charging = CHARGER_ENABLED;
battery.misc = MISC_NONE;
battery.charger_connected = -1;
return reply;
}
-// ChargerCharging : in i, out i
-
-gint test_deviced_Battery_ChargerCharging(gint param1)
-{
- gint val1;
- GVariant *reply;
- int ret_dbus;
-
- ret_dbus = gdbus_call_sync_with_reply("org.tizen.system.deviced",
- "/Org/Tizen/System/DeviceD/Battery",
- "org.tizen.system.deviced.Battery",
- "ChargerCharging",
- g_variant_new("(i)", param1),
- &reply);;
- if (ret_dbus < 0) {
- _E("failed ChargerCharging");
- return 0;
- }
-
- g_variant_get(reply, "(i)", &val1);
- g_variant_unref(reply);
-
- return val1;
-}
-
// ChargerType : in , out i
gint test_deviced_Battery_ChargerType(void)