Fix lost settings on battery plug/unplug
This commit is contained in:
@@ -181,6 +181,12 @@ void cleanup_battery()
|
|||||||
battery_os_free();
|
battery_os_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reinit_battery()
|
||||||
|
{
|
||||||
|
battery_os_free();
|
||||||
|
battery_found = battery_os_init();
|
||||||
|
update_battery();
|
||||||
|
}
|
||||||
void init_battery()
|
void init_battery()
|
||||||
{
|
{
|
||||||
if (!battery_enabled)
|
if (!battery_enabled)
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ int update_battery();
|
|||||||
void init_battery();
|
void init_battery();
|
||||||
void init_battery_panel(void *panel);
|
void init_battery_panel(void *panel);
|
||||||
|
|
||||||
|
void reinit_battery();
|
||||||
void draw_battery(void *obj, cairo_t *c);
|
void draw_battery(void *obj, cairo_t *c);
|
||||||
|
|
||||||
int resize_battery(void *obj);
|
int resize_battery(void *obj);
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ static struct uevent_notify psy_change = {
|
|||||||
|
|
||||||
static void uevent_battery_plug() {
|
static void uevent_battery_plug() {
|
||||||
printf("reinitialize batteries after HW change\n");
|
printf("reinitialize batteries after HW change\n");
|
||||||
cleanup_battery();
|
reinit_battery();
|
||||||
init_battery();
|
|
||||||
}
|
}
|
||||||
static struct uevent_notify psy_plug = {
|
static struct uevent_notify psy_plug = {
|
||||||
UEVENT_ADD | UEVENT_REMOVE,
|
UEVENT_ADD | UEVENT_REMOVE,
|
||||||
|
|||||||
Reference in New Issue
Block a user