/*
 * power_management_cleanup
 *
 * Perform any cleanup that might be required.
 */
void
power_management_cleanup( void )
{
#ifdef HAVE_UPOWER
  if( using_upower)
  {
    battstat_upower_cleanup();
    pm_initialised = 1;
    return;
  }
#endif

#ifdef __linux__
  if (using_acpi)
  {
    if (acpiwatch != 0)
      g_source_remove(acpiwatch);
     acpiwatch = 0;
     acpi_linux_cleanup(&acpiinfo);
  }
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
  if (using_acpi) {
    acpi_freebsd_cleanup(&acpiinfo);
  }
#endif

  pm_initialised = 0;
}
Example #2
0
static gboolean acpi_callback (GIOChannel * chan, GIOCondition cond, gpointer data)
{
  if (cond & (G_IO_ERR | G_IO_HUP)) {
    acpi_linux_cleanup(&acpiinfo);
    apminfo.battery_percentage = -1;
    return FALSE;
  }
  
  if (acpi_process_event(&acpiinfo)) {
    acpi_linux_read(&apminfo, &acpiinfo);
  }
  return TRUE;
}