xserver: Branch 'master' - 8 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Jan 29 16:21:14 PST 2014


 config/Makefile.am             |   24 --
 config/config-backends.h       |   35 ---
 config/config.c                |   25 --
 config/dbus-core.c             |   32 +--
 config/dbus.c                  |  407 -----------------------------------------
 config/hal.c                   |    7 
 config/xorg-server.conf        |   13 -
 configure.ac                   |   54 ++---
 hw/xfree86/common/xf86.h       |    6 
 hw/xfree86/common/xf86Events.c |  299 +++++++++++++++---------------
 hw/xfree86/common/xf86Init.c   |    8 
 include/Makefile.am            |    2 
 include/dbus-core.h            |   56 +++++
 include/dix-config.h.in        |   10 -
 14 files changed, 294 insertions(+), 684 deletions(-)

New commits:
commit bf83843b92ce21d11f6ff1a407ff3d014e017c9b
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Dec 19 14:10:18 2013 +0100

    xf86Events: add Enable/DisableInputDeviceForVTSwitch functions
    
    Factor this code out into functions so that it can be re-used for the
    systemd-logind device pause/resume paths.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 537d1d1..cec3135 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -215,6 +215,8 @@ extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
 
 /* xf86Events.c */
 
+typedef struct _InputInfoRec *InputInfoPtr;
+
 extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
 extern _X_EXPORT void *xf86AddInputHandler(int fd, InputHandlerProc proc,
                                              void *data);
@@ -236,6 +238,8 @@ extern _X_EXPORT void xf86PrintBacktrace(void);
 extern _X_EXPORT Bool xf86VTOwner(void);
 extern _X_EXPORT void xf86VTLeave(void);
 extern _X_EXPORT void xf86VTEnter(void);
+extern _X_EXPORT void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo);
 
 /* xf86Helper.c */
 
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index e0ec768..7b53949 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -408,6 +408,28 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
 }
 
 void
+xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo)
+{
+    if (!pInfo->dev)
+        return;
+
+    if (!pInfo->dev->enabled)
+        pInfo->flags |= XI86_DEVICE_DISABLED;
+
+    xf86ReleaseKeys(pInfo->dev);
+    ProcessInputEvents();
+    DisableDevice(pInfo->dev, TRUE);
+}
+
+void
+xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
+{
+    if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
+        EnableDevice(pInfo->dev, TRUE);
+    pInfo->flags &= ~XI86_DEVICE_DISABLED;
+}
+
+void
 xf86VTLeave(void)
 {
     int i;
@@ -436,15 +458,8 @@ xf86VTLeave(void)
         else
             xf86DisableGeneralHandler(ih);
     }
-    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
-        if (pInfo->dev) {
-            if (!pInfo->dev->enabled)
-                pInfo->flags |= XI86_DEVICE_DISABLED;
-            xf86ReleaseKeys(pInfo->dev);
-            ProcessInputEvents();
-            DisableDevice(pInfo->dev, TRUE);
-        }
-    }
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        xf86DisableInputDeviceForVTSwitch(pInfo);
 
     OsBlockSIGIO();
     for (i = 0; i < xf86NumScreens; i++)
@@ -494,13 +509,8 @@ switch_failed:
     }
     dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
-    pInfo = xf86InputDevs;
-    while (pInfo) {
-        if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
-            EnableDevice(pInfo->dev, TRUE);
-        pInfo->flags &= ~XI86_DEVICE_DISABLED;
-        pInfo = pInfo->next;
-    }
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        xf86EnableInputDeviceForVTSwitch(pInfo);
     for (ih = InputHandlers; ih; ih = ih->next) {
         if (ih->is_input)
             xf86EnableInputHandler(ih);
@@ -546,14 +556,8 @@ xf86VTEnter(void)
     /* Turn screen saver off when switching back */
     dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
-    pInfo = xf86InputDevs;
-    while (pInfo) {
-        if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
-            EnableDevice(pInfo->dev, TRUE);
-        pInfo->flags &= ~XI86_DEVICE_DISABLED;
-        pInfo = pInfo->next;
-    }
-
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        xf86EnableInputDeviceForVTSwitch(pInfo);
     for (ih = InputHandlers; ih; ih = ih->next) {
         if (ih->is_input)
             xf86EnableInputHandler(ih);
commit 48b489769e78fa20911630173ab708feecb0fb0e
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Dec 19 11:28:40 2013 +0100

    xf86Events: refactor xf86VTLeave error handling
    
    Use kernel goto style error handling for xf86VTSwitchAway() failure. This
    makes it much easier to read the straight path.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index e4ec177..e0ec768 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -454,62 +454,60 @@ xf86VTLeave(void)
 
     xf86AccessLeave();      /* We need this here, otherwise */
 
-    if (!xf86VTSwitchAway()) {
+    if (!xf86VTSwitchAway())
+        goto switch_failed;
+
+#ifdef XF86PM
+    if (xf86OSPMClose)
+        xf86OSPMClose();
+    xf86OSPMClose = NULL;
+#endif
+
+    for (i = 0; i < xf86NumScreens; i++) {
         /*
-         * switch failed
+         * zero all access functions to
+         * trap calls when switched away.
          */
+        xf86Screens[i]->vtSema = FALSE;
+    }
+    if (xorgHWAccess)
+        xf86DisableIO();
 
-        DebugF("xf86VTSwitch: Leave failed\n");
-        xf86AccessEnter();
-        for (i = 0; i < xf86NumScreens; i++) {
-            if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
-                FatalError("EnterVT failed for screen %d\n", i);
-        }
-        for (i = 0; i < xf86NumGPUScreens; i++) {
-            if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
-                FatalError("EnterVT failed for gpu screen %d\n", i);
-        }
-        if (!(dispatchException & DE_TERMINATE)) {
-            for (i = 0; i < xf86NumScreens; i++) {
-                if (xf86Screens[i]->EnableDisableFBAccess)
-                    (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
-            }
-        }
-        dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
-
-        pInfo = xf86InputDevs;
-        while (pInfo) {
-            if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
-                EnableDevice(pInfo->dev, TRUE);
-            pInfo->flags &= ~XI86_DEVICE_DISABLED;
-            pInfo = pInfo->next;
-        }
-        for (ih = InputHandlers; ih; ih = ih->next) {
-            if (ih->is_input)
-                xf86EnableInputHandler(ih);
-            else
-                xf86EnableGeneralHandler(ih);
-        }
-        OsReleaseSIGIO();
+    return;
 
+switch_failed:
+    DebugF("xf86VTSwitch: Leave failed\n");
+    xf86AccessEnter();
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
+            FatalError("EnterVT failed for screen %d\n", i);
     }
-    else {
-#ifdef XF86PM
-        if (xf86OSPMClose)
-            xf86OSPMClose();
-        xf86OSPMClose = NULL;
-#endif
-
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+            FatalError("EnterVT failed for gpu screen %d\n", i);
+    }
+    if (!(dispatchException & DE_TERMINATE)) {
         for (i = 0; i < xf86NumScreens; i++) {
-            /*
-             * zero all access functions to
-             * trap calls when switched away.
-             */
-            xf86Screens[i]->vtSema = FALSE;
+            if (xf86Screens[i]->EnableDisableFBAccess)
+                (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
         }
-        if (xorgHWAccess)
-            xf86DisableIO();
     }
+    dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+    pInfo = xf86InputDevs;
+    while (pInfo) {
+        if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
+            EnableDevice(pInfo->dev, TRUE);
+        pInfo->flags &= ~XI86_DEVICE_DISABLED;
+        pInfo = pInfo->next;
+    }
+    for (ih = InputHandlers; ih; ih = ih->next) {
+        if (ih->is_input)
+            xf86EnableInputHandler(ih);
+        else
+            xf86EnableGeneralHandler(ih);
+    }
+    OsReleaseSIGIO();
 }
 
 void
commit 78f0667d6df9cc43a397d9f1490e540936a435d6
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Dec 19 11:26:36 2013 +0100

    xf86Events: split xf86VTSwitch into xf86VTLeave and xf86VTEnter functions
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 89025fe..537d1d1 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -234,6 +234,8 @@ extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
 extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
 extern _X_EXPORT void xf86PrintBacktrace(void);
 extern _X_EXPORT Bool xf86VTOwner(void);
+extern _X_EXPORT void xf86VTLeave(void);
+extern _X_EXPORT void xf86VTEnter(void);
 
 /* xf86Helper.c */
 
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index cae7873..e4ec177 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -407,155 +407,74 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
     }
 }
 
-/*
- * xf86VTSwitch --
- *      Handle requests for switching the vt.
- */
-static void
-xf86VTSwitch(void)
+void
+xf86VTLeave(void)
 {
     int i;
     InputInfoPtr pInfo;
     IHPtr ih;
 
-    DebugF("xf86VTSwitch()\n");
-
-#ifdef XFreeXDGA
-    if (!DGAVTSwitch())
-        return;
+    DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+           BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
+#ifdef DPMSExtension
+    if (DPMSPowerLevel != DPMSModeOn)
+        DPMSSet(serverClient, DPMSModeOn);
 #endif
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (!(dispatchException & DE_TERMINATE))
+            if (xf86Screens[i]->EnableDisableFBAccess)
+                (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
+    }
 
     /*
-     * Since all screens are currently all in the same state it is sufficient
-     * check the first.  This might change in future.
+     * Keep the order: Disable Device > LeaveVT
+     *                        EnterVT > EnableDevice
      */
-    if (xf86VTOwner()) {
-
-        DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
-               BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
-#ifdef DPMSExtension
-        if (DPMSPowerLevel != DPMSModeOn)
-            DPMSSet(serverClient, DPMSModeOn);
-#endif
-        for (i = 0; i < xf86NumScreens; i++) {
-            if (!(dispatchException & DE_TERMINATE))
-                if (xf86Screens[i]->EnableDisableFBAccess)
-                    (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
-        }
-
-        /*
-         * Keep the order: Disable Device > LeaveVT
-         *                        EnterVT > EnableDevice
-         */
-        for (ih = InputHandlers; ih; ih = ih->next) {
-            if (ih->is_input)
-                xf86DisableInputHandler(ih);
-            else
-                xf86DisableGeneralHandler(ih);
-        }
-        for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
-            if (pInfo->dev) {
-                if (!pInfo->dev->enabled)
-                    pInfo->flags |= XI86_DEVICE_DISABLED;
-                xf86ReleaseKeys(pInfo->dev);
-                ProcessInputEvents();
-                DisableDevice(pInfo->dev, TRUE);
-            }
+    for (ih = InputHandlers; ih; ih = ih->next) {
+        if (ih->is_input)
+            xf86DisableInputHandler(ih);
+        else
+            xf86DisableGeneralHandler(ih);
+    }
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+        if (pInfo->dev) {
+            if (!pInfo->dev->enabled)
+                pInfo->flags |= XI86_DEVICE_DISABLED;
+            xf86ReleaseKeys(pInfo->dev);
+            ProcessInputEvents();
+            DisableDevice(pInfo->dev, TRUE);
         }
+    }
 
-        OsBlockSIGIO();
-        for (i = 0; i < xf86NumScreens; i++)
-            xf86Screens[i]->LeaveVT(xf86Screens[i]);
-        for (i = 0; i < xf86NumGPUScreens; i++)
-            xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
-
-        xf86AccessLeave();      /* We need this here, otherwise */
-
-        if (!xf86VTSwitchAway()) {
-            /*
-             * switch failed
-             */
-
-            DebugF("xf86VTSwitch: Leave failed\n");
-            xf86AccessEnter();
-            for (i = 0; i < xf86NumScreens; i++) {
-                if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
-                    FatalError("EnterVT failed for screen %d\n", i);
-            }
-            for (i = 0; i < xf86NumGPUScreens; i++) {
-                if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
-                    FatalError("EnterVT failed for gpu screen %d\n", i);
-            }
-            if (!(dispatchException & DE_TERMINATE)) {
-                for (i = 0; i < xf86NumScreens; i++) {
-                    if (xf86Screens[i]->EnableDisableFBAccess)
-                        (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
-                }
-            }
-            dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
-
-            pInfo = xf86InputDevs;
-            while (pInfo) {
-                if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
-                    EnableDevice(pInfo->dev, TRUE);
-                pInfo->flags &= ~XI86_DEVICE_DISABLED;
-                pInfo = pInfo->next;
-            }
-            for (ih = InputHandlers; ih; ih = ih->next) {
-                if (ih->is_input)
-                    xf86EnableInputHandler(ih);
-                else
-                    xf86EnableGeneralHandler(ih);
-            }
-            OsReleaseSIGIO();
-
-        }
-        else {
-#ifdef XF86PM
-            if (xf86OSPMClose)
-                xf86OSPMClose();
-            xf86OSPMClose = NULL;
-#endif
+    OsBlockSIGIO();
+    for (i = 0; i < xf86NumScreens; i++)
+        xf86Screens[i]->LeaveVT(xf86Screens[i]);
+    for (i = 0; i < xf86NumGPUScreens; i++)
+        xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
 
-            for (i = 0; i < xf86NumScreens; i++) {
-                /*
-                 * zero all access functions to
-                 * trap calls when switched away.
-                 */
-                xf86Screens[i]->vtSema = FALSE;
-            }
-            if (xorgHWAccess)
-                xf86DisableIO();
-        }
-    }
-    else {
-        DebugF("xf86VTSwitch: Entering\n");
-        if (!xf86VTSwitchTo())
-            return;
+    xf86AccessLeave();      /* We need this here, otherwise */
 
-#ifdef XF86PM
-        xf86OSPMClose = xf86OSPMOpen();
-#endif
+    if (!xf86VTSwitchAway()) {
+        /*
+         * switch failed
+         */
 
-        if (xorgHWAccess)
-            xf86EnableIO();
+        DebugF("xf86VTSwitch: Leave failed\n");
         xf86AccessEnter();
         for (i = 0; i < xf86NumScreens; i++) {
-            xf86Screens[i]->vtSema = TRUE;
             if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                 FatalError("EnterVT failed for screen %d\n", i);
         }
         for (i = 0; i < xf86NumGPUScreens; i++) {
-            xf86GPUScreens[i]->vtSema = TRUE;
             if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
                 FatalError("EnterVT failed for gpu screen %d\n", i);
         }
-        for (i = 0; i < xf86NumScreens; i++) {
-            if (xf86Screens[i]->EnableDisableFBAccess)
-                (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
+        if (!(dispatchException & DE_TERMINATE)) {
+            for (i = 0; i < xf86NumScreens; i++) {
+                if (xf86Screens[i]->EnableDisableFBAccess)
+                    (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
+            }
         }
-
-        /* Turn screen saver off when switching back */
         dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
         pInfo = xf86InputDevs;
@@ -565,20 +484,114 @@ xf86VTSwitch(void)
             pInfo->flags &= ~XI86_DEVICE_DISABLED;
             pInfo = pInfo->next;
         }
-
         for (ih = InputHandlers; ih; ih = ih->next) {
             if (ih->is_input)
                 xf86EnableInputHandler(ih);
             else
                 xf86EnableGeneralHandler(ih);
         }
-#ifdef XSERVER_PLATFORM_BUS
-        /* check for any new output devices */
-        xf86platformVTProbe();
+        OsReleaseSIGIO();
+
+    }
+    else {
+#ifdef XF86PM
+        if (xf86OSPMClose)
+            xf86OSPMClose();
+        xf86OSPMClose = NULL;
 #endif
 
-        OsReleaseSIGIO();
+        for (i = 0; i < xf86NumScreens; i++) {
+            /*
+             * zero all access functions to
+             * trap calls when switched away.
+             */
+            xf86Screens[i]->vtSema = FALSE;
+        }
+        if (xorgHWAccess)
+            xf86DisableIO();
+    }
+}
+
+void
+xf86VTEnter(void)
+{
+    int i;
+    InputInfoPtr pInfo;
+    IHPtr ih;
+
+    DebugF("xf86VTSwitch: Entering\n");
+    if (!xf86VTSwitchTo())
+        return;
+
+#ifdef XF86PM
+    xf86OSPMClose = xf86OSPMOpen();
+#endif
+
+    if (xorgHWAccess)
+        xf86EnableIO();
+    xf86AccessEnter();
+    for (i = 0; i < xf86NumScreens; i++) {
+        xf86Screens[i]->vtSema = TRUE;
+        if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
+            FatalError("EnterVT failed for screen %d\n", i);
+    }
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        xf86GPUScreens[i]->vtSema = TRUE;
+        if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+            FatalError("EnterVT failed for gpu screen %d\n", i);
+    }
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (xf86Screens[i]->EnableDisableFBAccess)
+            (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
+    }
+
+    /* Turn screen saver off when switching back */
+    dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+    pInfo = xf86InputDevs;
+    while (pInfo) {
+        if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
+            EnableDevice(pInfo->dev, TRUE);
+        pInfo->flags &= ~XI86_DEVICE_DISABLED;
+        pInfo = pInfo->next;
+    }
+
+    for (ih = InputHandlers; ih; ih = ih->next) {
+        if (ih->is_input)
+            xf86EnableInputHandler(ih);
+        else
+            xf86EnableGeneralHandler(ih);
     }
+#ifdef XSERVER_PLATFORM_BUS
+    /* check for any new output devices */
+    xf86platformVTProbe();
+#endif
+
+    OsReleaseSIGIO();
+}
+
+/*
+ * xf86VTSwitch --
+ *      Handle requests for switching the vt.
+ */
+static void
+xf86VTSwitch(void)
+{
+    DebugF("xf86VTSwitch()\n");
+
+#ifdef XFreeXDGA
+    if (!DGAVTSwitch())
+        return;
+#endif
+
+    /*
+     * Since all screens are currently all in the same state it is sufficient
+     * check the first.  This might change in future.
+     */
+    if (xf86VTOwner())
+        xf86VTLeave();
+    else
+        xf86VTEnter();
 }
 
 /* Input handler registration */
commit 33cec8af55d829cd77b297ae356ed7a00ce8523c
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Tue Dec 17 09:29:07 2013 +0100

    dbus-core: Attempt to connect to dbus ASAP
    
    For systemd-logind integration we need the dbus connection to be available
    before enumerating input and gfx devices.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/config/dbus-core.c b/config/dbus-core.c
index 43d6281..b0fd92d 100644
--- a/config/dbus-core.c
+++ b/config/dbus-core.c
@@ -233,8 +233,8 @@ dbus_core_init(void)
     memset(&bus_info, 0, sizeof(bus_info));
     bus_info.fd = -1;
     bus_info.hooks = NULL;
-    bus_info.connection = NULL;
-    bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
+    if (!connect_to_bus())
+        bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
 
     return 1;
 }
commit 480590b90c3966536451d2a2fecc42a66082ed77
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Dec 4 11:10:06 2013 +0100

    dbus-core: Make dbus-core no longer mutually exclusive with udev
    
    With systemd-logind the dbus-core will be used for more then just config, so
    it should be possible to build it even when using a non dbus dependent config
    backend.
    
    This patch also removes the config_ prefix from the dbus-core symbols.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/config/Makefile.am b/config/Makefile.am
index 0740e46..e0f0a8d 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -2,12 +2,19 @@ AM_CFLAGS = $(DIX_CFLAGS)
 
 noinst_LTLIBRARIES = libconfig.la
 libconfig_la_SOURCES = config.c config-backends.h
+libconfig_la_LIBADD =
+
+if NEED_DBUS
+AM_CFLAGS += $(DBUS_CFLAGS)
+libconfig_la_SOURCES += dbus-core.c
+libconfig_la_LIBADD += $(DBUS_LIBS)
+endif
 
 if CONFIG_UDEV
 
 AM_CFLAGS += $(UDEV_CFLAGS)
 libconfig_la_SOURCES += udev.c
-libconfig_la_LIBADD = $(UDEV_LIBS)
+libconfig_la_LIBADD += $(UDEV_LIBS)
 
 if XORG
 xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR)
@@ -16,16 +23,10 @@ endif
 
 else
 
-if CONFIG_NEED_DBUS
-AM_CFLAGS += $(DBUS_CFLAGS)
-libconfig_la_SOURCES += dbus-core.c
-libconfig_la_LIBADD = $(DBUS_LIBS)
-
 if CONFIG_HAL
 AM_CFLAGS += $(HAL_CFLAGS)
 libconfig_la_SOURCES += hal.c
 libconfig_la_LIBADD += $(HAL_LIBS)
-endif
 
 else
 
@@ -33,7 +34,7 @@ if CONFIG_WSCONS
 libconfig_la_SOURCES += wscons.c
 endif # CONFIG_WSCONS
 
-endif # CONFIG_NEED_DBUS
+endif # !CONFIG_HAL
 
 endif # !CONFIG_UDEV
 
diff --git a/config/config-backends.h b/config/config-backends.h
index 5a715b3..5f07557 100644
--- a/config/config-backends.h
+++ b/config/config-backends.h
@@ -37,36 +37,10 @@ int config_udev_pre_init(void);
 int config_udev_init(void);
 void config_udev_fini(void);
 void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback);
-#else
-
-#ifdef CONFIG_NEED_DBUS
-#include <dbus/dbus.h>
-
-typedef void (*config_dbus_core_connect_hook) (DBusConnection * connection,
-                                               void *data);
-typedef void (*config_dbus_core_disconnect_hook) (void *data);
-
-struct config_dbus_core_hook {
-    config_dbus_core_connect_hook connect;
-    config_dbus_core_disconnect_hook disconnect;
-    void *data;
-
-    struct config_dbus_core_hook *next;
-};
-
-int config_dbus_core_init(void);
-void config_dbus_core_fini(void);
-int config_dbus_core_add_hook(struct config_dbus_core_hook *hook);
-void config_dbus_core_remove_hook(struct config_dbus_core_hook *hook);
-#endif
-
-#ifdef CONFIG_HAL
+#elif defined(CONFIG_HAL)
 int config_hal_init(void);
 void config_hal_fini(void);
-#endif
-#endif
-
-#ifdef CONFIG_WSCONS
+#elif defined(CONFIG_WSCONS)
 int config_wscons_init(void);
 void config_wscons_fini(void);
 #endif
diff --git a/config/config.c b/config/config.c
index 554069f..760cf19 100644
--- a/config/config.c
+++ b/config/config.c
@@ -47,16 +47,9 @@ config_init(void)
 #ifdef CONFIG_UDEV
     if (!config_udev_init())
         ErrorF("[config] failed to initialise udev\n");
-#elif defined(CONFIG_NEED_DBUS)
-    if (config_dbus_core_init()) {
-#ifdef CONFIG_HAL
-        if (!config_hal_init())
-            ErrorF("[config] failed to initialise HAL\n");
-#endif
-    }
-    else {
-        ErrorF("[config] failed to initialise D-Bus core\n");
-    }
+#elif defined(CONFIG_HAL)
+    if (!config_hal_init())
+        ErrorF("[config] failed to initialise HAL\n");
 #elif defined(CONFIG_WSCONS)
     if (!config_wscons_init())
         ErrorF("[config] failed to initialise wscons\n");
@@ -68,11 +61,8 @@ config_fini(void)
 {
 #if defined(CONFIG_UDEV)
     config_udev_fini();
-#elif defined(CONFIG_NEED_DBUS)
-#ifdef CONFIG_HAL
+#elif defined(CONFIG_HAL)
     config_hal_fini();
-#endif
-    config_dbus_core_fini();
 #elif defined(CONFIG_WSCONS)
     config_wscons_fini();
 #endif
diff --git a/config/dbus-core.c b/config/dbus-core.c
index 768a984..43d6281 100644
--- a/config/dbus-core.c
+++ b/config/dbus-core.c
@@ -30,9 +30,9 @@
 #include <dbus/dbus.h>
 #include <sys/select.h>
 
-#include "config-backends.h"
 #include "dix.h"
 #include "os.h"
+#include "dbus-core.h"
 
 /* How often to attempt reconnecting when we get booted off the bus. */
 #define RECONNECT_DELAY (10 * 1000)     /* in ms */
@@ -41,7 +41,7 @@ struct dbus_core_info {
     int fd;
     DBusConnection *connection;
     OsTimerPtr timer;
-    struct config_dbus_core_hook *hooks;
+    struct dbus_core_hook *hooks;
 };
 static struct dbus_core_info bus_info;
 
@@ -74,7 +74,7 @@ block_handler(void *data, struct timeval **tv, void *read_mask)
 static void
 teardown(void)
 {
-    struct config_dbus_core_hook *hook;
+    struct dbus_core_hook *hook;
 
     if (bus_info.timer) {
         TimerFree(bus_info.timer);
@@ -112,7 +112,7 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
      * reconnect immediately (assuming it's just a restart).  The
      * connection isn't valid at this point, so throw it out immediately. */
     if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
-        DebugF("[config/dbus-core] disconnected from bus\n");
+        DebugF("[dbus-core] disconnected from bus\n");
         bus_info.connection = NULL;
         teardown();
 
@@ -136,12 +136,12 @@ static int
 connect_to_bus(void)
 {
     DBusError error;
-    struct config_dbus_core_hook *hook;
+    struct dbus_core_hook *hook;
 
     dbus_error_init(&error);
     bus_info.connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
     if (!bus_info.connection || dbus_error_is_set(&error)) {
-        DebugF("[config/dbus-core] error connecting to system bus: %s (%s)\n",
+        LogMessage(X_ERROR, "dbus-core: error connecting to system bus: %s (%s)\n",
                error.name, error.message);
         goto err_begin;
     }
@@ -150,13 +150,13 @@ connect_to_bus(void)
     dbus_connection_set_exit_on_disconnect(bus_info.connection, FALSE);
 
     if (!dbus_connection_get_unix_fd(bus_info.connection, &bus_info.fd)) {
-        ErrorF("[config/dbus-core] couldn't get fd for system bus\n");
+        ErrorF("[dbus-core] couldn't get fd for system bus\n");
         goto err_unref;
     }
 
     if (!dbus_connection_add_filter(bus_info.connection, message_filter,
                                     &bus_info, NULL)) {
-        ErrorF("[config/dbus-core] couldn't add filter: %s (%s)\n", error.name,
+        ErrorF("[dbus-core] couldn't add filter: %s (%s)\n", error.name,
                error.message);
         goto err_fd;
     }
@@ -198,9 +198,9 @@ reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg)
 }
 
 int
-config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
+dbus_core_add_hook(struct dbus_core_hook *hook)
 {
-    struct config_dbus_core_hook **prev;
+    struct dbus_core_hook **prev;
 
     for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next);
 
@@ -215,9 +215,9 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
 }
 
 void
-config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
+dbus_core_remove_hook(struct dbus_core_hook *hook)
 {
-    struct config_dbus_core_hook **prev;
+    struct dbus_core_hook **prev;
 
     for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) {
         if (*prev == hook) {
@@ -228,7 +228,7 @@ config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
 }
 
 int
-config_dbus_core_init(void)
+dbus_core_init(void)
 {
     memset(&bus_info, 0, sizeof(bus_info));
     bus_info.fd = -1;
@@ -240,7 +240,7 @@ config_dbus_core_init(void)
 }
 
 void
-config_dbus_core_fini(void)
+dbus_core_fini(void)
 {
     teardown();
 }
diff --git a/config/hal.c b/config/hal.c
index 2ead556..94cb6e7 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -33,6 +33,7 @@
 #include <string.h>
 #include <sys/select.h>
 
+#include "dbus-core.h"
 #include "input.h"
 #include "inputstr.h"
 #include "hotplug.h"
@@ -631,7 +632,7 @@ connect_hook(DBusConnection * connection, void *data)
 
 static struct config_hal_info hal_info;
 
-static struct config_dbus_core_hook hook = {
+static struct dbus_core_hook hook = {
     .connect = connect_hook,
     .disconnect = disconnect_hook,
     .data = &hal_info,
@@ -644,7 +645,7 @@ config_hal_init(void)
     hal_info.system_bus = NULL;
     hal_info.hal_ctx = NULL;
 
-    if (!config_dbus_core_add_hook(&hook)) {
+    if (!dbus_core_add_hook(&hook)) {
         LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n");
         return 0;
     }
@@ -658,5 +659,5 @@ config_hal_init(void)
 void
 config_hal_fini(void)
 {
-    config_dbus_core_remove_hook(&hook);
+    dbus_core_remove_hook(&hook);
 }
diff --git a/configure.ac b/configure.ac
index 15edd3c..c6764f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -897,14 +897,14 @@ if test "x$CONFIG_HAL" = xyes; then
 	fi
 
 	AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
-	CONFIG_NEED_DBUS="yes"
+	NEED_DBUS="yes"
 fi
 AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
 
-if test "x$CONFIG_NEED_DBUS" = xyes; then
-        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
+if test "x$NEED_DBUS" = xyes; then
+        AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core])
 fi
-AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
+AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes])
 
 if test "x$CONFIG_WSCONS" = xauto; then
 	case $host_os in
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 952bf37..ff4d38f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -53,6 +53,7 @@
 #include "scrnintstr.h"
 #include "site.h"
 #include "mi.h"
+#include "dbus-core.h"
 
 #include "compiler.h"
 
@@ -456,6 +457,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         if (xf86DoShowOptions)
             DoShowOptions();
 
+        dbus_core_init();
+
         /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
         xf86BusProbe();
 
@@ -1059,6 +1062,8 @@ ddxGiveUp(enum ExitCode error)
     if (xorgHWOpenConsole)
         xf86CloseConsole();
 
+    dbus_core_fini();
+
     xf86CloseLog(error);
 
     /* If an unexpected signal was caught, dump a core for debugging */
diff --git a/include/Makefile.am b/include/Makefile.am
index 93d8616..fa6da00 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -68,7 +68,7 @@ endif
 AM_CFLAGS = $(DIX_CFLAGS)
 
 EXTRA_DIST = 	\
-	busfault.h	\
+	busfault.h dbus-core.h \
 	dix-config-apple-verbatim.h \
 	dixfontstubs.h eventconvert.h eventstr.h inpututils.h \
 	protocol-versions.h \
diff --git a/include/dbus-core.h b/include/dbus-core.h
new file mode 100644
index 0000000..b2d6d1b
--- /dev/null
+++ b/include/dbus-core.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Hans de Goede <hdegoede at redhat.com>
+ */
+
+#ifndef DBUS_CORE_H
+#define DBUS_CORE_H
+
+#ifdef NEED_DBUS
+typedef struct DBusConnection DBusConnection;
+
+typedef void (*dbus_core_connect_hook) (DBusConnection * connection,
+                                               void *data);
+typedef void (*dbus_core_disconnect_hook) (void *data);
+
+struct dbus_core_hook {
+    dbus_core_connect_hook connect;
+    dbus_core_disconnect_hook disconnect;
+    void *data;
+
+    struct dbus_core_hook *next;
+};
+
+int dbus_core_init(void);
+void dbus_core_fini(void);
+int dbus_core_add_hook(struct dbus_core_hook *hook);
+void dbus_core_remove_hook(struct dbus_core_hook *hook);
+
+#else
+
+#define dbus_core_init()
+#define dbus_core_fini()
+
+#endif
+
+#endif
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 8ffb53e..7c77956 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -414,8 +414,8 @@
 /* Use udev_enumerate_add_match_tag() */
 #undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
 
-/* Use D-Bus for input hotplug */
-#undef CONFIG_NEED_DBUS
+/* Enable D-Bus core */
+#undef NEED_DBUS
 
 /* Support HAL for hotplug */
 #undef CONFIG_HAL
commit c29454ae9d2e8e647732077fdfd97b351095f122
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Dec 12 12:48:57 2013 +1000

    config: drop the dbus API
    
    This API has been disabled by default since 1.4, the first release it came in.
    There a no known users of it and even its direct replacement (HAL) has
    been superseeded by udev on supported platforms since 1.8.
    
    This code is untested, probably hasn't been compiled in years and should not
    be shipped.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/config/Makefile.am b/config/Makefile.am
index 327d07e..0740e46 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -21,13 +21,6 @@ AM_CFLAGS += $(DBUS_CFLAGS)
 libconfig_la_SOURCES += dbus-core.c
 libconfig_la_LIBADD = $(DBUS_LIBS)
 
-if CONFIG_DBUS_API
-dbusconfigdir = $(sysconfdir)/dbus-1/system.d
-dbusconfig_DATA = xorg-server.conf
-
-libconfig_la_SOURCES += dbus.c
-endif
-
 if CONFIG_HAL
 AM_CFLAGS += $(HAL_CFLAGS)
 libconfig_la_SOURCES += hal.c
diff --git a/config/config-backends.h b/config/config-backends.h
index 6423701..5a715b3 100644
--- a/config/config-backends.h
+++ b/config/config-backends.h
@@ -60,11 +60,6 @@ int config_dbus_core_add_hook(struct config_dbus_core_hook *hook);
 void config_dbus_core_remove_hook(struct config_dbus_core_hook *hook);
 #endif
 
-#ifdef CONFIG_DBUS_API
-int config_dbus_init(void);
-void config_dbus_fini(void);
-#endif
-
 #ifdef CONFIG_HAL
 int config_hal_init(void);
 void config_hal_fini(void);
diff --git a/config/config.c b/config/config.c
index d0889a3..554069f 100644
--- a/config/config.c
+++ b/config/config.c
@@ -49,10 +49,6 @@ config_init(void)
         ErrorF("[config] failed to initialise udev\n");
 #elif defined(CONFIG_NEED_DBUS)
     if (config_dbus_core_init()) {
-#ifdef CONFIG_DBUS_API
-        if (!config_dbus_init())
-            ErrorF("[config] failed to initialise D-Bus API\n");
-#endif
 #ifdef CONFIG_HAL
         if (!config_hal_init())
             ErrorF("[config] failed to initialise HAL\n");
@@ -76,9 +72,6 @@ config_fini(void)
 #ifdef CONFIG_HAL
     config_hal_fini();
 #endif
-#ifdef CONFIG_DBUS_API
-    config_dbus_fini();
-#endif
     config_dbus_core_fini();
 #elif defined(CONFIG_WSCONS)
     config_wscons_fini();
diff --git a/config/dbus.c b/config/dbus.c
deleted file mode 100644
index 99a1537..0000000
--- a/config/dbus.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright © 2006-2007 Daniel Stone
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Author: Daniel Stone <daniel at fooishbar.org>
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <dbus/dbus.h>
-#include <string.h>
-
-#include <X11/X.h>
-
-#include "config-backends.h"
-#include "opaque.h"             /* for 'display': there should be a better way. */
-#include "input.h"
-#include "inputstr.h"
-
-#define API_VERSION 2
-
-#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
-
-#define MALFORMED_MSG "[config/dbus] malformed message, dropping"
-#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
-                            ret = BadValue; \
-                            goto unwind; }
-#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \
-                                       error->name, error->message); \
-                                  ret = BadValue; \
-                                  goto unwind; }
-
-struct connection_info {
-    char busobject[32];
-    char busname[64];
-    DBusConnection *connection;
-};
-
-static void
-reset_info(struct connection_info *info)
-{
-    info->connection = NULL;
-    info->busname[0] = '\0';
-    info->busobject[0] = '\0';
-}
-
-static int
-add_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    DBusMessageIter iter, reply_iter, subiter;
-    InputOption *input_options = NULL;
-    int ret, err;
-    DeviceIntPtr dev = NULL;
-
-    dbus_message_iter_init_append(reply, &reply_iter);
-
-    if (!dbus_message_iter_init(message, &iter)) {
-        ErrorF("[config/dbus] couldn't initialise iterator\n");
-        MALFORMED_MESSAGE();
-    }
-
-    input_options = input_option_new(input_options, "_source", "client/dbus");
-    if (!input_options) {
-        ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
-        ret = BadAlloc;
-        goto unwind;
-    }
-
-    /* signature should be [ss][ss]... */
-    while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
-        char *key, *value;
-
-        dbus_message_iter_recurse(&iter, &subiter);
-
-        if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
-            MALFORMED_MESSAGE();
-
-        dbus_message_iter_get_basic(&subiter, &key);
-        if (!key)
-            MALFORMED_MESSAGE();
-        /* The _ prefix refers to internal settings, and may not be given by
-         * the client. */
-        if (key[0] == '_') {
-            ErrorF("[config/dbus] attempted subterfuge: option name %s given\n",
-                   key);
-            MALFORMED_MESSAGE();
-        }
-
-        if (!dbus_message_iter_has_next(&subiter))
-            MALFORMED_MESSAGE();
-        dbus_message_iter_next(&subiter);
-        if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
-            MALFORMED_MESSAGE();
-
-        dbus_message_iter_get_basic(&subiter, &value);
-        if (!value)
-            MALFORMED_MESSAGE();
-
-        input_options = input_option_new(input_options, key, value);
-
-        dbus_message_iter_next(&iter);
-    }
-
-    ret = NewInputDeviceRequest(input_options, NULL, &dev);
-    if (ret != Success) {
-        DebugF("[config/dbus] NewInputDeviceRequest failed\n");
-        goto unwind;
-    }
-
-    if (!dev) {
-        DebugF("[config/dbus] NewInputDeviceRequest provided no device\n");
-        ret = BadImplementation;
-        goto unwind;
-    }
-
-    /* XXX: If we fail halfway through, we don't seem to have any way to
-     *      empty the iterator, so you'll end up with some device IDs,
-     *      plus an error.  This seems to be a shortcoming in the D-Bus
-     *      API. */
-    for (; dev; dev = dev->next) {
-        if (!dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32,
-                                            &dev->id)) {
-            ErrorF("[config/dbus] couldn't append to iterator\n");
-            ret = BadAlloc;
-            goto unwind;
-        }
-    }
-
- unwind:
-    if (ret != Success) {
-        if (dev)
-            RemoveDevice(dev, TRUE);
-
-        err = -ret;
-        dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
-    }
-
-    input_option_free_list(&input_options);
-
-    return ret;
-}
-
-static int
-remove_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    int deviceid, ret, err;
-    DeviceIntPtr dev;
-    DBusMessageIter iter, reply_iter;
-
-    dbus_message_iter_init_append(reply, &reply_iter);
-
-    if (!dbus_message_iter_init(message, &iter)) {
-        ErrorF("[config/dbus] failed to init iterator\n");
-        MALFORMED_MESSAGE();
-    }
-
-    if (!dbus_message_get_args(message, error, DBUS_TYPE_UINT32,
-                               &deviceid, DBUS_TYPE_INVALID)) {
-        MALFORMED_MESSAGE_ERROR();
-    }
-
-    dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess);
-    if (!dev) {
-        DebugF("[config/dbus] bogus device id %d given\n", deviceid);
-        ret = BadMatch;
-        goto unwind;
-    }
-
-    DebugF("[config/dbus] removing device %s (id %d)\n", dev->name, deviceid);
-
-    /* Call PIE here so we don't try to dereference a device that's
-     * already been removed. */
-    OsBlockSignals();
-    ProcessInputEvents();
-    DeleteInputDeviceRequest(dev);
-    OsReleaseSignals();
-
-    ret = Success;
-
- unwind:
-    err = (ret == Success) ? ret : -ret;
-    dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
-
-    return ret;
-}
-
-static int
-list_devices(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    DeviceIntPtr dev;
-    DBusMessageIter iter, subiter;
-
-    dbus_message_iter_init_append(reply, &iter);
-
-    for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, NULL,
-                                              &subiter)) {
-            ErrorF("[config/dbus] couldn't init container\n");
-            return BadAlloc;
-        }
-        if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UINT32,
-                                            &dev->id)) {
-            ErrorF("[config/dbus] couldn't append to iterator\n");
-            return BadAlloc;
-        }
-        if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING,
-                                            &dev->name)) {
-            ErrorF("[config/dbus] couldn't append to iterator\n");
-            return BadAlloc;
-        }
-        if (!dbus_message_iter_close_container(&iter, &subiter)) {
-            ErrorF("[config/dbus] couldn't close container\n");
-            return BadAlloc;
-        }
-    }
-
-    return Success;
-}
-
-static int
-get_version(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    DBusMessageIter iter;
-    unsigned int version = API_VERSION;
-
-    dbus_message_iter_init_append(reply, &iter);
-    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &version)) {
-        ErrorF("[config/dbus] couldn't append version\n");
-        return BadAlloc;
-    }
-
-    return Success;
-}
-
-static DBusHandlerResult
-message_handler(DBusConnection * connection, DBusMessage * message, void *data)
-{
-    DBusError error;
-    DBusMessage *reply;
-    struct connection_info *info = data;
-
-    /* ret is the overall D-Bus handler result, whereas err is the internal
-     * X error from our individual functions. */
-    int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    int err;
-
-    DebugF("[config/dbus] received a message for %s\n",
-           dbus_message_get_interface(message));
-
-    dbus_error_init(&error);
-
-    reply = dbus_message_new_method_return(message);
-    if (!reply) {
-        ErrorF("[config/dbus] failed to create reply\n");
-        ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
-        goto err_start;
-    }
-
-    if (strcmp(dbus_message_get_member(message), "add") == 0)
-        err = add_device(message, reply, &error);
-    else if (strcmp(dbus_message_get_member(message), "remove") == 0)
-        err = remove_device(message, reply, &error);
-    else if (strcmp(dbus_message_get_member(message), "listDevices") == 0)
-        err = list_devices(message, reply, &error);
-    else if (strcmp(dbus_message_get_member(message), "version") == 0)
-        err = get_version(message, reply, &error);
-    else
-        goto err_reply;
-
-    /* Failure to allocate is a special case. */
-    if (err == BadAlloc) {
-        ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
-        goto err_reply;
-    }
-
-    /* While failure here is always an OOM, we don't return that,
-     * since that would result in devices being double-added/removed. */
-    if (dbus_connection_send(info->connection, reply, NULL))
-        dbus_connection_flush(info->connection);
-    else
-        ErrorF("[config/dbus] failed to send reply\n");
-
-    ret = DBUS_HANDLER_RESULT_HANDLED;
-
- err_reply:
-    dbus_message_unref(reply);
- err_start:
-    dbus_error_free(&error);
-
-    return ret;
-}
-
-static void
-connect_hook(DBusConnection * connection, void *data)
-{
-    DBusError error;
-    DBusObjectPathVTable vtable = {.message_function = message_handler, };
-    struct connection_info *info = data;
-
-    info->connection = connection;
-
-    dbus_error_init(&error);
-
-    dbus_bus_request_name(info->connection, info->busname, 0, &error);
-    if (dbus_error_is_set(&error)) {
-        ErrorF("[config/dbus] couldn't take over org.x.config: %s (%s)\n",
-               error.name, error.message);
-        goto err_start;
-    }
-
-    /* blocks until we get a reply. */
-    dbus_bus_add_match(info->connection, MATCH_RULE, &error);
-    if (dbus_error_is_set(&error)) {
-        ErrorF("[config/dbus] couldn't add match: %s (%s)\n", error.name,
-               error.message);
-        goto err_name;
-    }
-
-    if (!dbus_connection_register_object_path(info->connection,
-                                              info->busobject, &vtable, info)) {
-        ErrorF("[config/dbus] couldn't register object path\n");
-        goto err_match;
-    }
-
-    DebugF("[dbus] registered %s, %s\n", info->busname, info->busobject);
-
-    dbus_error_free(&error);
-
-    return;
-
- err_match:
-    dbus_bus_remove_match(info->connection, MATCH_RULE, &error);
- err_name:
-    dbus_bus_release_name(info->connection, info->busname, &error);
- err_start:
-    dbus_error_free(&error);
-
-    reset_info(info);
-}
-
-static void
-disconnect_hook(void *data)
-{
-}
-
-#if 0
-void
-pre_disconnect_hook(void)
-{
-    DBusError error;
-
-    dbus_error_init(&error);
-    dbus_connection_unregister_object_path(connection_data->connection,
-                                           connection_data->busobject);
-    dbus_bus_remove_match(connection_data->connection, MATCH_RULE, &error);
-    dbus_bus_release_name(connection_data->connection,
-                          connection_data->busname, &error);
-    dbus_error_free(&error);
-}
-#endif
-
-static struct connection_info connection_data;
-
-static struct config_dbus_core_hook core_hook = {
-    .connect = connect_hook,
-    .disconnect = disconnect_hook,
-    .data = &connection_data,
-};
-
-int
-config_dbus_init(void)
-{
-    snprintf(connection_data.busname, sizeof(connection_data.busname),
-             "org.x.config.display%d", atoi(display));
-    snprintf(connection_data.busobject, sizeof(connection_data.busobject),
-             "/org/x/config/%d", atoi(display));
-
-    return config_dbus_core_add_hook(&core_hook);
-}
-
-void
-config_dbus_fini(void)
-{
-    config_dbus_core_remove_hook(&core_hook);
-    connection_data.busname[0] = '\0';
-    connection_data.busobject[0] = '\0';
-}
diff --git a/config/xorg-server.conf b/config/xorg-server.conf
deleted file mode 100644
index 47a9a78..0000000
--- a/config/xorg-server.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-	<policy context="default">
-		<allow own="org.x.config.display0"/>
-		<allow send_destination="org.x.config.display0"/>
-		<allow send_interface="org.x.config.display0"/>
-		<allow own="org.x.config.display1"/>
-		<allow send_destination="org.x.config.display1"/>
-		<allow send_interface="org.x.config.display1"/>
-	</policy>
-</busconfig>
diff --git a/configure.ac b/configure.ac
index d15f1a1..15edd3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -614,7 +614,6 @@ AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86
 AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
 AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
 AC_ARG_ENABLE(config-udev-kms,    AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto])
-AC_ARG_ENABLE(config-dbus,    AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
 AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
 AC_ARG_ENABLE(config-wscons,  AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto])
 AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
@@ -703,7 +702,6 @@ dnl DDX Detection... Yes, it's ugly to have it here... but we need to
 dnl handle this early on so that we don't require unsupported extensions
 case $host_os in
 	cygwin* | mingw*)
-		CONFIG_DBUS_API=no
 		CONFIG_HAL=no
 		CONFIG_UDEV=no
 		CONFIG_UDEV_KMS=no
@@ -851,9 +849,8 @@ if test "x$WITH_SYSTEMD_DAEMON" = xyes; then
 fi
 AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
 
-if test "x$CONFIG_UDEV" = xyes &&
- { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
-	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
+if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then
+	AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed])
 fi
 
 PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
@@ -862,7 +859,6 @@ if test "x$CONFIG_UDEV" = xauto; then
 fi
 AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
 if test "x$CONFIG_UDEV" = xyes; then
-	CONFIG_DBUS_API=no
 	CONFIG_HAL=no
 	if test "x$CONFIG_UDEV_KMS" = xauto; then
 		CONFIG_UDEV_KMS="$HAVE_LIBUDEV"
@@ -885,28 +881,12 @@ if test "x$CONFIG_UDEV" = xyes; then
 fi
 AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes])
 
-dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
-dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
-dnl API.
 PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
 if test "x$HAVE_DBUS" = xyes; then
 	AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
 fi
 AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
 
-if test "x$CONFIG_DBUS_API" = xauto; then
-	CONFIG_DBUS_API="$HAVE_DBUS"
-fi
-if test "x$CONFIG_DBUS_API" = xyes; then
-	if ! test "x$HAVE_DBUS" = xyes; then
-		AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
-	fi
-
-	AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
-	CONFIG_NEED_DBUS="yes"
-fi
-AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
-
 PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
 if test "x$CONFIG_HAL" = xauto; then
 	CONFIG_HAL="$HAVE_HAL"
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index acb55f8..8ffb53e 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -417,9 +417,6 @@
 /* Use D-Bus for input hotplug */
 #undef CONFIG_NEED_DBUS
 
-/* Support the D-Bus hotplug API */
-#undef CONFIG_DBUS_API
-
 /* Support HAL for hotplug */
 #undef CONFIG_HAL
 
commit 46cf2a60934076bf568062eb83121ce90b6ff596
Author: Laércio de Sousa <lbsousajr at gmail.com>
Date:   Thu Dec 12 14:22:48 2013 -0200

    xfree86: Keep a non-seat0 X server from touching VTs (#71258)
    
    Updated patch following Hans de Goede's advice.
    
    If -seat option is passed with a value different from seat0,
    X server won't call xf86OpenConsole().
    
    This is needed to avoid any race condition between seat0 and
    non-seat0 X servers. If a non-seat0 X server opens a given VT
    before a seat0 one which expects to open the same VT, one can
    get an inactive systemd-logind graphical session for seat0.
    
    This patch was first tested in a multiseat setup with multiple
    video cards and works quite well.
    
    I suppose it can also make things like DontVTSwitch and -sharevts
    meaningless for non-seat0 seats, so it may fix bug #69477, too.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71258
           https://bugs.freedesktop.org/show_bug.cgi?id=69477 (maybe)
    
    See also: http://lists.x.org/archives/xorg-devel/2013-October/038391.html
              https://bugzilla.redhat.com/show_bug.cgi?id=1018196
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 9c8a86a..952bf37 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -544,7 +544,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
             if (NEED_IO_ENABLED(flags))
                 want_hw_access = TRUE;
 
-            if (!(flags & HW_SKIP_CONSOLE))
+            /* Non-seat0 X servers should not open console */
+            if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0())
                 xorgHWOpenConsole = TRUE;
         }
 
commit b3d3ffd19937827bcbdb833a628f9b1814a6e189
Author: Łukasz Stelmach <l.stelmach at samsung.com>
Date:   Mon Nov 25 11:54:07 2013 +0100

    configure.ac: enable systemd socket activation in libxtrans
    
    Signed-off-by: Łukasz Stelmach <l.stelmach at samsung.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Acked-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index d5f8b68..d15f1a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -800,7 +800,7 @@ FIXESPROTO="fixesproto >= 5.0"
 DAMAGEPROTO="damageproto >= 1.1"
 XCMISCPROTO="xcmiscproto >= 1.2.0"
 BIGREQSPROTO="bigreqsproto >= 1.1.0"
-XTRANS="xtrans >= 1.3.2"
+XTRANS="xtrans >= 1.3.3"
 PRESENTPROTO="presentproto >= 1.0"
 
 dnl List of libraries that require a specific version
@@ -831,6 +831,26 @@ AC_SUBST(SDK_REQUIRED_MODULES)
 
 REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
 
+dnl systemd socket activation
+dnl activate the code in libxtrans that grabs systemd's socket fds
+AC_ARG_WITH([systemd-daemon],
+	AS_HELP_STRING([--with-systemd-daemon],
+		[support systemd socket activation (default: auto)]),
+	[WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
+PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
+                  [HAVE_SYSTEMD_DAEMON=yes], [HAVE_SYSTEMD_DAEMON=no])
+if test "x$WITH_SYSTEMD_DAEMON" = xauto; then
+	WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON"
+fi
+if test "x$WITH_SYSTEMD_DAEMON" = xyes; then
+	if "x$HAVE_SYSTEMD_DAEMON" = xno; then
+		AC_MSG_ERROR([systemd support requested but no library has been found])
+	fi
+	AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
+	REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon"
+fi
+AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
+
 if test "x$CONFIG_UDEV" = xyes &&
  { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
 	AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index ced3ba1..acb55f8 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -199,6 +199,9 @@
 /* Define to 1 if you have the `strndup' function. */
 #undef HAVE_STRNDUP
 
+/* Define to 1 if libsystemd-daemon is available */
+#undef HAVE_SYSTEMD_DAEMON
+
 /* Define to 1 if SYSV IPC is available */
 #undef HAVE_SYSV_IPC
 


More information about the xorg-commit mailing list