Commit c7c29283 authored by Christian Kellner's avatar Christian Kellner
Browse files

Detect AC adapter on Apple hardware

On Apple hardware the sysfs directory for the mains power supply
is called ADPx and not ACx.

https://bugzilla.gnome.org/show_bug.cgi?id=777149
parent 0d7f58f8
......@@ -215,6 +215,12 @@ adapter_free (Adapter *adapter)
g_slice_free(Adapter, adapter);
}
static gboolean
is_adapter(const char *name)
{
return g_str_has_prefix(name, "AC") || g_str_has_prefix(name, "ADP");
}
static gboolean
find_power_supplies(GbbPowerMonitor *monitor,
GCancellable *cancellable,
......@@ -246,7 +252,7 @@ find_power_supplies(GbbPowerMonitor *monitor,
const char *basename = g_file_info_get_name (info);
if (g_str_has_prefix (basename, "BAT"))
monitor->batteries = g_list_prepend (monitor->batteries, battery_new (child));
else if (g_str_has_prefix (basename, "AC"))
else if (is_adapter (basename))
monitor->adapters = g_list_prepend (monitor->adapters, adapter_new (child));
next:
g_clear_object (&child);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment