From 3daaac264df2f5a587c35cd8e41ecf18900fa9c9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 21 Jan 2010 00:00:02 +0100 Subject: [PATCH] remove remaining traces of Hal The code which used the Hal connection already was disabled, so gdm connected to Hal in vain (which just triggered Hal startup when using D-Bus activation). Remove all remaining traces of hal now. https://bugzilla.gnome.org/show_bug.cgi?id=593787 --- daemon/Makefile.am | 9 -- daemon/gdm-local-display-factory.c | 110 ----------------------- daemon/test-hal-seats.c | 173 ------------------------------------ 3 files changed, 0 insertions(+), 293 deletions(-) delete mode 100644 daemon/test-hal-seats.c diff --git a/daemon/Makefile.am b/daemon/Makefile.am index a122a15..79bb63e 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -75,18 +75,9 @@ gdm-product-display-glue.h: gdm-product-display.xml Makefile.am dbus-binding-tool --prefix=gdm_product_display --mode=glib-server --output=gdm-product-display-glue.h $(srcdir)/gdm-product-display.xml noinst_PROGRAMS = \ - test-hal-seats \ test-session \ $(NULL) -test_hal_seats_SOURCES = \ - test-hal-seats.c \ - $(NULL) - -test_hal_seats_LDADD = \ - $(DAEMON_LIBS) \ - $(NULL) - test_session_SOURCES = \ test-session.c \ gdm-session.c \ diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c index 3984ada..69daf9e 100644 --- a/daemon/gdm-local-display-factory.c +++ b/daemon/gdm-local-display-factory.c @@ -45,12 +45,6 @@ #define GDM_LOCAL_DISPLAY_FACTORY_DBUS_PATH GDM_DBUS_PATH "/LocalDisplayFactory" #define GDM_MANAGER_DBUS_NAME "org.gnome.DisplayManager.LocalDisplayFactory" -#define HAL_DBUS_NAME "org.freedesktop.Hal" -#define HAL_DBUS_MANAGER_PATH "/org/freedesktop/Hal/Manager" -#define HAL_DBUS_MANAGER_INTERFACE "org.freedesktop.Hal.Manager" -#define HAL_DBUS_DEVICE_INTERFACE "org.freedesktop.Hal.Device" -#define SEAT_PCI_DEVICE_CLASS 3 - #define MAX_DISPLAY_FAILURES 5 struct GdmLocalDisplayFactoryPrivate @@ -372,83 +366,6 @@ create_display (GdmLocalDisplayFactory *factory) return display; } -#if 0 -static void -create_display_for_device (GdmLocalDisplayFactory *factory, - DBusGProxy *device_proxy) -{ - create_display (factory); -} - -static void -create_displays_for_pci_devices (GdmLocalDisplayFactory *factory) -{ - char **devices; - const char *key; - const char *value; - GError *error; - gboolean res; - int i; - - g_debug ("GdmLocalDisplayFactory: Getting PCI seat devices"); - - key = "info.bus"; - value = "pci"; - - devices = NULL; - error = NULL; - res = dbus_g_proxy_call (factory->priv->proxy, - "FindDeviceStringMatch", - &error, - G_TYPE_STRING, key, - G_TYPE_STRING, value, - G_TYPE_INVALID, - G_TYPE_STRV, &devices, - G_TYPE_INVALID); - if (! res) { - g_warning ("Unable to query HAL: %s", error->message); - g_error_free (error); - } - - /* now look for pci class 3 */ - key = "pci.device_class"; - for (i = 0; devices [i] != NULL; i++) { - DBusGProxy *device_proxy; - int class_val; - - device_proxy = dbus_g_proxy_new_for_name (factory->priv->connection, - HAL_DBUS_NAME, - devices [i], - HAL_DBUS_DEVICE_INTERFACE); - if (device_proxy == NULL) { - continue; - } - - error = NULL; - res = dbus_g_proxy_call (device_proxy, - "GetPropertyInteger", - &error, - G_TYPE_STRING, key, - G_TYPE_INVALID, - G_TYPE_INT, &class_val, - G_TYPE_INVALID); - if (! res) { - g_warning ("Unable to query HAL: %s", error->message); - g_error_free (error); - } - - if (class_val == SEAT_PCI_DEVICE_CLASS) { - g_debug ("GdmLocalDisplayFactory: Found device: %s", devices [i]); - create_display_for_device (factory, device_proxy); - } - - g_object_unref (device_proxy); - } - - g_strfreev (devices); -} -#endif - static gboolean gdm_local_display_factory_start (GdmDisplayFactory *base_factory) { @@ -525,29 +442,6 @@ register_factory (GdmLocalDisplayFactory *factory) return TRUE; } -static gboolean -connect_to_hal (GdmLocalDisplayFactory *factory) -{ - factory->priv->proxy = dbus_g_proxy_new_for_name (factory->priv->connection, - HAL_DBUS_NAME, - HAL_DBUS_MANAGER_PATH, - HAL_DBUS_MANAGER_INTERFACE); - if (factory->priv->proxy == NULL) { - g_warning ("Couldn't create proxy for HAL Manager"); - return FALSE; - } - - return TRUE; -} - -static void -disconnect_from_hal (GdmLocalDisplayFactory *factory) -{ - if (factory->priv->proxy == NULL) { - g_object_unref (factory->priv->proxy); - } -} - static GObject * gdm_local_display_factory_constructor (GType type, guint n_construct_properties, @@ -565,8 +459,6 @@ gdm_local_display_factory_constructor (GType type, g_warning ("Unable to register local display factory with system bus"); } - connect_to_hal (factory); - return G_OBJECT (factory); } @@ -611,8 +503,6 @@ gdm_local_display_factory_finalize (GObject *object) g_hash_table_destroy (factory->priv->displays); - disconnect_from_hal (factory); - G_OBJECT_CLASS (gdm_local_display_factory_parent_class)->finalize (object); } diff --git a/daemon/test-hal-seats.c b/daemon/test-hal-seats.c deleted file mode 100644 index 9b0c35a..0000000 --- a/daemon/test-hal-seats.c +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * 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., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * cc -o test-hal-seats `pkg-config --cflags --libs glib-2.0 dbus-glib-1` test-hal-seats.c - */ - -#include -#include - -#include -#define DBUS_API_SUBJECT_TO_CHANGE -#include -#include - -#define HAL_DBUS_NAME "org.freedesktop.Hal" -#define HAL_DBUS_MANAGER_PATH "/org/freedesktop/Hal/Manager" -#define HAL_DBUS_MANAGER_INTERFACE "org.freedesktop.Hal.Manager" -#define HAL_DBUS_DEVICE_INTERFACE "org.freedesktop.Hal.Device" -#define SEAT_PCI_DEVICE_CLASS 3 - -static GMainLoop *loop; - -static void -get_pci_seats (DBusGConnection *bus, - DBusGProxy *proxy, - GList *seats) -{ - char **devices; - const char *key; - const char *value; - GError *error; - gboolean res; - int i; - - g_message ("Getting PCI seats"); - - key = "info.bus"; - value = "pci"; - - devices = NULL; - error = NULL; - res = dbus_g_proxy_call (proxy, - "FindDeviceStringMatch", - &error, - G_TYPE_STRING, key, - G_TYPE_STRING, value, - G_TYPE_INVALID, - G_TYPE_STRV, &devices, - G_TYPE_INVALID); - if (! res) { - g_warning ("Unable to query HAL: %s", error->message); - g_error_free (error); - } - - /* now look for pci class 3 */ - key = "pci.device_class"; - for (i = 0; devices [i] != NULL; i++) { - DBusGProxy *device_proxy; - int class_val; - - device_proxy = dbus_g_proxy_new_for_name (bus, - HAL_DBUS_NAME, - devices [i], - HAL_DBUS_DEVICE_INTERFACE); - if (device_proxy == NULL) { - continue; - } - - error = NULL; - res = dbus_g_proxy_call (device_proxy, - "GetPropertyInteger", - &error, - G_TYPE_STRING, key, - G_TYPE_INVALID, - G_TYPE_INT, &class_val, - G_TYPE_INVALID); - if (! res) { - g_warning ("Unable to query HAL: %s", error->message); - g_error_free (error); - } - - if (class_val == SEAT_PCI_DEVICE_CLASS) { - g_message ("Found device: %s", devices [i]); - seats = g_list_prepend (seats, devices [i]); - } - - g_object_unref (device_proxy); - } - - g_strfreev (devices); -} - -static void -list_seats (GList *seats) -{ - GList *l; - for (l = seats; l != NULL; l = l->next) { - g_message ("Found device: %s", (char *)l->data); - } -} - -static gboolean -test_hal_seats (void) -{ - GError *error; - DBusGConnection *bus; - DBusGProxy *proxy; - GList *seats; - - proxy = NULL; - - error = NULL; - bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); - if (bus == NULL) { - g_warning ("Couldn't connect to system bus: %s", - error->message); - g_error_free (error); - goto out; - } - - proxy = dbus_g_proxy_new_for_name (bus, - HAL_DBUS_NAME, - HAL_DBUS_MANAGER_PATH, - HAL_DBUS_MANAGER_INTERFACE); - if (proxy == NULL) { - g_warning ("Couldn't create proxy for HAL Manager"); - goto out; - } - - seats = NULL; - - get_pci_seats (bus, proxy, seats); - - list_seats (seats); - - out: - if (proxy != NULL) { - g_object_unref (proxy); - } - - return FALSE; -} - -int -main (int argc, - char *argv[]) -{ - g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); - - g_type_init (); - - g_idle_add ((GSourceFunc)test_hal_seats, NULL); - - loop = g_main_loop_new (NULL, FALSE); - g_main_loop_run (loop); - g_main_loop_unref (loop); - - return 0; -} -- 1.7.0