1 /***************************************************************************
3 * addon-acpi.c : Poll battery and AC adapter devices and update
6 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
7 * Use is subject to license terms.
9 * Licensed under the Academic Free License version 2.1
11 **************************************************************************/
13 #pragma ident "%Z%%M% %I% %E% SMI"
28 #include "../../hald/logger.h"
29 #include "../../hald/util_helper.h"
30 #include "../../utils/acpi.h"
33 main(int argc
, char **argv
)
35 LibHalContext
*ctx
= NULL
;
38 GMainLoop
*loop
= g_main_loop_new(NULL
, FALSE
);
43 dbus_error_init(&error
);
44 if ((ctx
= libhal_ctx_init_direct(&error
)) == NULL
) {
45 printf("main(): init_direct failed\n");
48 dbus_error_init(&error
);
49 if (!libhal_device_addon_is_ready(ctx
, getenv("UDI"), &error
)) {
53 g_timeout_add(BATTERY_POLL_TIMER
, update_devices
, ctx
);
55 g_main_loop_run(loop
);