summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/UPower.conf8
-rw-r--r--src/linux/Makefile.am2
-rw-r--r--src/linux/up-backend.c12
-rw-r--r--src/linux/up-dock.c200
-rw-r--r--src/linux/up-dock.h60
-rw-r--r--src/org.freedesktop.UPower.xml6
-rw-r--r--src/up-daemon.c17
-rw-r--r--src/up-daemon.h2
8 files changed, 5 insertions, 302 deletions
diff --git a/etc/UPower.conf b/etc/UPower.conf
index 920b256..4282948 100644
--- a/etc/UPower.conf
+++ b/etc/UPower.conf
@@ -18,14 +18,6 @@
# default=false
EnableWattsUpPro=false
-# Poll the kernel for dock state changes.
-#
-# Some drivers are still broken, and do not send out uvents when the
-# connected state changes.
-#
-# default=false
-PollDockDevices=false
-
# Don't poll the kernel for battery level changes.
#
# Some hardware will send us battery level changes through
diff --git a/src/linux/Makefile.am b/src/linux/Makefile.am
index 7242e1f..4876a57 100644
--- a/src/linux/Makefile.am
+++ b/src/linux/Makefile.am
@@ -38,8 +38,6 @@ libupshared_la_SOURCES = \
up-device-wup.h \
up-input.c \
up-input.h \
- up-dock.c \
- up-dock.h \
up-backend.c \
up-native.c \
hidpp-device.c \
diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c
index bfecc8e..5e2b846 100644
--- a/src/linux/up-backend.c
+++ b/src/linux/up-backend.c
@@ -40,7 +40,6 @@
#include "up-device-wup.h"
#include "up-device-hid.h"
#include "up-input.h"
-#include "up-dock.h"
#include "up-config.h"
#ifdef HAVE_IDEVICE
#include "up-device-idevice.h"
@@ -65,7 +64,6 @@ struct UpBackendPrivate
UpDeviceList *device_list;
GUdevClient *gudev_client;
UpDeviceList *managed_devices;
- UpDock *dock;
UpConfig *config;
DBusConnection *connection;
GDBusProxy *logind_proxy;
@@ -316,7 +314,6 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
GList *devices;
GList *l;
guint i;
- gboolean ret;
const gchar *subsystems_wup[] = {"power_supply", "usb", "usbmisc", "tty", "input", "hid", NULL};
const gchar *subsystems[] = {"power_supply", "usb", "usbmisc", "input", "hid", NULL};
@@ -341,15 +338,6 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
g_list_free (devices);
}
- /* add dock update object */
- backend->priv->dock = up_dock_new ();
- ret = up_config_get_boolean (backend->priv->config, "PollDockDevices");
- g_debug ("Polling docks: %s", ret ? "YES" : "NO");
- up_dock_set_should_poll (backend->priv->dock, ret);
- ret = up_dock_coldplug (backend->priv->dock, daemon);
- if (!ret)
- g_warning ("failed to coldplug dock devices");
-
return TRUE;
}
diff --git a/src/linux/up-dock.c b/src/linux/up-dock.c
deleted file mode 100644
index 014b42e..0000000
--- a/src/linux/up-dock.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <glib-object.h>
-#include <gudev/gudev.h>
-
-#include "up-daemon.h"
-#include "up-dock.h"
-
-struct UpDockPrivate
-{
- UpDaemon *daemon;
- GUdevClient *gudev_client;
- guint poll_id;
-};
-
-G_DEFINE_TYPE (UpDock, up_dock, G_TYPE_OBJECT)
-#define UP_DOCK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DOCK, UpDockPrivate))
-
-/* the kernel is pretty crap at sending a uevent when the status changes */
-#define UP_DOCK_POLL_TIMEOUT 30
-
-/**
- * up_dock_device_check:
- **/
-static gboolean
-up_dock_device_check (GUdevDevice *d)
-{
- const gchar *status;
- gboolean ret = FALSE;
-
- /* Get the boolean state from the kernel -- note that ideally
- * the property value would be "1" or "true" but now it's
- * set in stone as ABI. Urgh. */
- status = g_udev_device_get_sysfs_attr (d, "status");
- if (status == NULL)
- goto out;
- ret = (g_strcmp0 (status, "connected") == 0);
- g_debug ("graphics device %s is %s",
- g_udev_device_get_sysfs_path (d),
- ret ? "on" : "off");
-out:
- return ret;
-}
-
-/**
- * up_dock_refresh:
- **/
-static gboolean
-up_dock_refresh (UpDock *dock)
-{
- GList *devices;
- GList *l;
- GUdevDevice *native;
- guint count = 0;
-
- /* the metric we're using here is that a machine is docked when
- * there is more than one active output */
- devices = g_udev_client_query_by_subsystem (dock->priv->gudev_client,
- "drm");
- for (l = devices; l != NULL; l = l->next) {
- native = l->data;
- count += up_dock_device_check (native);
- }
- g_list_foreach (devices, (GFunc) g_object_unref, NULL);
- g_list_free (devices);
-
- /* update the daemon state, which causes DBus traffic */
- up_daemon_set_is_docked (dock->priv->daemon, (count > 1));
-
- return TRUE;
-}
-
-/**
- * up_dock_poll_cb:
- **/
-static gboolean
-up_dock_poll_cb (UpDock *dock)
-{
- g_debug ("Doing the dock refresh");
- up_dock_refresh (dock);
- return TRUE;
-}
-
-/**
- * up_dock_coldplug:
- **/
-void
-up_dock_set_should_poll (UpDock *dock, gboolean should_poll)
-{
- if (should_poll && dock->priv->poll_id == 0) {
- dock->priv->poll_id = g_timeout_add_seconds (UP_DOCK_POLL_TIMEOUT,
- (GSourceFunc) up_dock_poll_cb,
- dock);
- g_source_set_name_by_id (dock->priv->poll_id, "[upower] up_dock_poll_cb (linux)");
- } else if (dock->priv->poll_id > 0) {
- g_source_remove (dock->priv->poll_id);
- dock->priv->poll_id = 0;
- }
-}
-
-/**
- * up_dock_coldplug:
- **/
-gboolean
-up_dock_coldplug (UpDock *dock, UpDaemon *daemon)
-{
- /* save daemon */
- dock->priv->daemon = g_object_ref (daemon);
- return up_dock_refresh (dock);
-}
-
-
-/**
- * up_dock_uevent_signal_handler_cb:
- **/
-static void
-up_dock_uevent_signal_handler_cb (GUdevClient *client, const gchar *action,
- GUdevDevice *device, gpointer user_data)
-{
- UpDock *dock = UP_DOCK (user_data);
- up_dock_refresh (dock);
-}
-
-/**
- * up_dock_init:
- **/
-static void
-up_dock_init (UpDock *dock)
-{
- const gchar *subsystems[] = { "drm", NULL};
- dock->priv = UP_DOCK_GET_PRIVATE (dock);
- dock->priv->gudev_client = g_udev_client_new (subsystems);
- g_signal_connect (dock->priv->gudev_client, "uevent",
- G_CALLBACK (up_dock_uevent_signal_handler_cb), dock);
-}
-
-/**
- * up_dock_finalize:
- **/
-static void
-up_dock_finalize (GObject *object)
-{
- UpDock *dock;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (UP_IS_DOCK (object));
-
- dock = UP_DOCK (object);
- g_return_if_fail (dock->priv != NULL);
-
- g_object_unref (dock->priv->gudev_client);
- if (dock->priv->daemon != NULL)
- g_object_unref (dock->priv->daemon);
- if (dock->priv->poll_id != 0)
- g_source_remove (dock->priv->poll_id);
- G_OBJECT_CLASS (up_dock_parent_class)->finalize (object);
-}
-
-/**
- * up_dock_class_init:
- **/
-static void
-up_dock_class_init (UpDockClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = up_dock_finalize;
- g_type_class_add_private (klass, sizeof (UpDockPrivate));
-}
-
-/**
- * up_dock_new:
- **/
-UpDock *
-up_dock_new (void)
-{
- return g_object_new (UP_TYPE_DOCK, NULL);
-}
-
diff --git a/src/linux/up-dock.h b/src/linux/up-dock.h
deleted file mode 100644
index 0c79251..0000000
--- a/src/linux/up-dock.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2010 Richard Hughes <richard@hughsie.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef __UP_DOCK_H__
-#define __UP_DOCK_H__
-
-#include <glib-object.h>
-
-#include "up-daemon.h"
-
-G_BEGIN_DECLS
-
-#define UP_TYPE_DOCK (up_dock_get_type ())
-#define UP_DOCK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_DOCK, UpDock))
-#define UP_DOCK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_DOCK, UpDockClass))
-#define UP_IS_DOCK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_DOCK))
-#define UP_IS_DOCK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_DOCK))
-#define UP_DOCK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_DOCK, UpDockClass))
-
-typedef struct UpDockPrivate UpDockPrivate;
-
-typedef struct
-{
- GObject parent;
- UpDockPrivate *priv;
-} UpDock;
-
-typedef struct
-{
- GObjectClass parent_class;
-} UpDockClass;
-
-GType up_dock_get_type (void);
-UpDock *up_dock_new (void);
-gboolean up_dock_coldplug (UpDock *dock,
- UpDaemon *daemon);
-void up_dock_set_should_poll (UpDock *dock,
- gboolean should_poll);
-
-G_END_DECLS
-
-#endif /* __UP_DOCK_H__ */
-
diff --git a/src/org.freedesktop.UPower.xml b/src/org.freedesktop.UPower.xml
index 141cbac..9b2319d 100644
--- a/src/org.freedesktop.UPower.xml
+++ b/src/org.freedesktop.UPower.xml
@@ -204,8 +204,10 @@ method return sender=:1.386 -> dest=:1.451 reply_serial=2
<doc:description>
<doc:para>
If the system is currently docked.
- Note: the "is-docked" value is the result of a heuristic,
- which may involve testing the display output.
+ Note: the "is-docked" value is now always False.
+ Whether an external display is in use should be checked within
+ the session service applying policy on the presence or absence
+ of an external display, such as gnome-settings-daemon.
</doc:para>
</doc:description>
</doc:doc>
diff --git a/src/up-daemon.c b/src/up-daemon.c
index ef90be4..4a81800 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -78,7 +78,6 @@ struct UpDaemonPrivate
UpDeviceLevel warning_level;
gboolean lid_is_closed;
gboolean lid_is_present;
- gboolean is_docked;
/* PropertiesChanged to be emitted */
GHashTable *changed_props;
@@ -722,20 +721,6 @@ up_daemon_set_lid_is_present (UpDaemon *daemon, gboolean lid_is_present)
}
/**
- * up_daemon_set_is_docked:
- **/
-void
-up_daemon_set_is_docked (UpDaemon *daemon, gboolean is_docked)
-{
- UpDaemonPrivate *priv = daemon->priv;
- g_debug ("is_docked = %s", is_docked ? "yes" : "no");
- priv->is_docked = is_docked;
- g_object_notify (G_OBJECT (daemon), "is-docked");
-
- up_daemon_queue_changed_property (daemon, "IsDocked", g_variant_new_boolean (is_docked));
-}
-
-/**
* up_daemon_set_on_battery:
**/
void
@@ -1196,7 +1181,7 @@ up_daemon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
g_value_set_boolean (value, priv->lid_is_present);
break;
case PROP_IS_DOCKED:
- g_value_set_boolean (value, priv->is_docked);
+ g_value_set_boolean (value, FALSE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/src/up-daemon.h b/src/up-daemon.h
index ba58a00..2d25bb2 100644
--- a/src/up-daemon.h
+++ b/src/up-daemon.h
@@ -77,8 +77,6 @@ void up_daemon_set_lid_is_closed (UpDaemon *daemon,
gboolean lid_is_closed);
void up_daemon_set_lid_is_present (UpDaemon *daemon,
gboolean lid_is_present);
-void up_daemon_set_is_docked (UpDaemon *daemon,
- gboolean is_docked);
void up_daemon_set_on_battery (UpDaemon *daemon,
gboolean on_battery);
void up_daemon_set_warning_level (UpDaemon *daemon,