--- xlibre-server-25.0.0.12.orig/hw/xfree86/common/xf86Events.c
+++ xlibre-server-25.0.0.12/hw/xfree86/common/xf86Events.c
@@ -90,6 +90,7 @@
 #endif
 
 #include "xf86platformBus.h"
+#include "seatd-libseat.h"
 
 #include "../os-support/linux/systemd-logind.h"
 
@@ -183,7 +184,9 @@ xf86ProcessActionEvent(ActionEvent actio
             int vtno = *((int *) arg);
 
             if (vtno != xf86Info.vtno) {
-                if (!xf86VTActivate(vtno)) {
+                if (seatd_libseat_controls_session()) {
+                    seatd_libseat_switch_session(vtno);
+                } else if (!xf86VTActivate(vtno)) {
                     ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
                            xf86Info.vtno, vtno, strerror(errno));
                 }
@@ -192,7 +195,9 @@ xf86ProcessActionEvent(ActionEvent actio
         break;
     case ACTION_SWITCHSCREEN_NEXT:
         if (!xf86Info.dontVTSwitch) {
-            if (!xf86VTActivate(xf86Info.vtno + 1)) {
+            if (seatd_libseat_controls_session()) {
+                seatd_libseat_switch_session(xf86Info.vtno + 1);
+            } else if (!xf86VTActivate(xf86Info.vtno + 1)) {
                 /* If first try failed, assume this is the last VT and
                  * try wrapping around to the first vt.
                  */
@@ -205,7 +210,9 @@ xf86ProcessActionEvent(ActionEvent actio
         break;
     case ACTION_SWITCHSCREEN_PREV:
         if (!xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
-            if (!xf86VTActivate(xf86Info.vtno - 1)) {
+            if (seatd_libseat_controls_session()) {
+                seatd_libseat_switch_session(xf86Info.vtno - 1);
+            } else if (!xf86VTActivate(xf86Info.vtno - 1)) {
                 /* Don't know what the maximum VT is, so can't wrap around */
                 ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
                        xf86Info.vtno, strerror(errno));
@@ -225,8 +232,9 @@ xf86ProcessActionEvent(ActionEvent actio
 /* ARGSUSED */
 void
 xf86Wakeup(void *blockData, int err)
-{
-    if (xf86VTSwitchPending())
+{ 
+    if (xf86VTSwitchPending() ||
+        (dispatchException & DE_TERMINATE))
         xf86VTSwitch();
 }
 
@@ -305,6 +313,7 @@ static void xf86DisableInputDeviceForVTS
 
     xf86ReleaseKeys(pInfo->dev);
     ProcessInputEvents();
+    seatd_libseat_close_device(pInfo);
     DisableDevice(pInfo->dev, TRUE);
 }
 
@@ -368,7 +377,7 @@ void xf86DisableGeneralHandler(void *han
     _xf86DisableGeneralHandler(handler);
 }
 
-static void
+void
 xf86VTLeave(void)
 {
     int i;
@@ -494,9 +503,10 @@ xf86VTEnter(void)
     dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
     for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
-        /* Devices with server managed fds get enabled on logind resume */
-        if (!(pInfo->flags & XI86_SERVER_FD))
+        /* Devices with server managed fds get enabled on logind/libseat resume */
+        if (!(pInfo->flags & XI86_SERVER_FD)) {
             xf86EnableInputDeviceForVTSwitch(pInfo);
+        }
     }
 
     for (ih = InputHandlers; ih; ih = ih->next) {
@@ -524,6 +534,9 @@ xf86VTSwitch(void)
 {
     DebugF("xf86VTSwitch()\n");
 
+    if(!(dispatchException & DE_TERMINATE))
+        assert(!seatd_libseat_controls_session());
+
 #ifdef XFreeXDGA
     if (!DGAVTSwitch())
         return;
--- xlibre-server-25.0.0.12.orig/hw/xfree86/common/xf86Init.c
+++ xlibre-server-25.0.0.12/hw/xfree86/common/xf86Init.c
@@ -66,6 +66,7 @@
 #include "windowstr.h"
 #include "scrnintstr.h"
 #include "../os-support/linux/systemd-logind.h"
+#include "seatd-libseat.h"
 #include "xf86VGAarbiter_priv.h"
 #include "loaderProcs.h"
 
@@ -340,6 +341,7 @@ InitOutput(ScreenInfo * pScreenInfo, int
             DoShowOptions();
 
         dbus_core_init();
+        seatd_libseat_init();
         systemd_logind_init();
 
         /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
@@ -432,10 +434,11 @@ InitOutput(ScreenInfo * pScreenInfo, int
             if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0() && xf86HasTTYs())
                 xorgHWOpenConsole = TRUE;
         }
-
-        if (xorgHWOpenConsole)
-            xf86OpenConsole();
-        else
+    
+        if (xorgHWOpenConsole) {
+            if (!seatd_libseat_controls_session())
+                xf86OpenConsole();
+        } else
             xf86Info.dontVTSwitch = TRUE;
 
 	/* Enable full I/O access */
@@ -568,7 +571,9 @@ InitOutput(ScreenInfo * pScreenInfo, int
         /*
          * serverGeneration != 1; some OSs have to do things here, too.
          */
-        if (xorgHWOpenConsole)
+
+    if (xorgHWOpenConsole &&
+        !seatd_libseat_controls_session())
             xf86OpenConsole();
 
         /*
@@ -848,6 +853,7 @@ ddxGiveUp(enum ExitCode error)
     if (xorgHWOpenConsole)
         xf86CloseConsole();
 
+    seatd_libseat_fini();
     systemd_logind_fini();
     dbus_core_fini();
 
--- xlibre-server-25.0.0.12.orig/hw/xfree86/common/xf86Xinput.c
+++ xlibre-server-25.0.0.12/hw/xfree86/common/xf86Xinput.c
@@ -70,6 +70,7 @@
 #include "mipointer.h"
 #include "loaderProcs.h"
 #include "../os-support/linux/systemd-logind.h"
+#include "seatd-libseat.h"
 #include "exevents.h"           /* AddInputDevice */
 #include "exglobals.h"
 #include "eventstr.h"
@@ -820,8 +821,10 @@ xf86DeleteInput(InputInfoPtr pInp, int f
 
     FreeInputAttributes(pInp->attrs);
 
-    if (pInp->flags & XI86_SERVER_FD)
-        systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd);
+    if (pInp->flags & XI86_SERVER_FD) {
+        seatd_libseat_close_device(pInp);
+         systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd);
+    }
 
     /* Remove the entry from the list. */
     if (pInp == xf86InputDevs)
@@ -946,7 +949,8 @@ xf86NewInputDevice(InputInfoPtr pInfo, D
     if (path && pInfo->major == 0 && pInfo->minor == 0)
         xf86stat(path, &pInfo->major, &pInfo->minor);
 
-    if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){
+    if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)) {
+        seatd_libseat_open_device(pInfo);
         int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor,
                                         path, &paused);
         if (fd != -1) {
--- xlibre-server-25.0.0.12.orig/hw/xfree86/common/xf86_priv.h
+++ xlibre-server-25.0.0.12/hw/xfree86/common/xf86_priv.h
@@ -64,6 +64,7 @@ InputHandlerProc xf86SetConsoleHandler(I
 void xf86ProcessActionEvent(ActionEvent action, void *arg);
 Bool xf86VTOwner(void);
 void xf86VTEnter(void);
+void xf86VTLeave(void);
 void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo);
 void xf86Wakeup(void *blockData, int err);
 void xf86HandlePMEvents(int fd, void *data);
--- xlibre-server-25.0.0.12.orig/hw/xfree86/meson.build
+++ xlibre-server-25.0.0.12/hw/xfree86/meson.build
@@ -99,6 +99,7 @@ xorg_deps = [
     xshmfence_dep,
     config_dep,
     libdrm_dep,
+    libseat_dep,
 ]
 
 if get_option('suid_wrapper')
--- /dev/null
+++ xlibre-server-25.0.0.12/hw/xfree86/os-support/linux/seatd-libseat.c
@@ -0,0 +1,389 @@
+/*
+ * Copyright © 2022 Mark Hindley, Ralph Ronnquist.
+ *
+ * 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.
+ *
+ * Authors: Mark Hindley <mark@hindley.org.uk>
+ *          Ralph Ronnquist <ralph.ronnquist@gmail.com>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <libseat.h>
+#include "config/hotplug_priv.h"
+
+#include "os.h"
+#include "linux.h"
+#include "xf86.h"
+#include "xf86_priv.h"
+#include "xf86platformBus.h"
+#include "xf86Xinput.h"
+#include "xf86Xinput_priv.h"
+#include "xf86Priv.h"
+#include "globals.h"
+#include "../../../../include/seatd-libseat.h"
+
+// ============ libseat client adapter ======================
+
+struct libseat_info {
+    char *session;
+    Bool active;
+    Bool vt_active;
+    /*
+     * This pointer gets initialised to the actual libseat client instance
+     * provided by libseat_open_seat.
+     */
+    struct libseat *client;
+    int graphics_id;
+};
+static struct libseat_info seat_info;
+
+/*
+ * The seat has been enabled, and is now valid for use. Re-open all
+ * seat devices to ensure that they are operational, as existing fds
+ * may have had their functionality blocked or revoked.
+ */
+static void
+enable_seat(struct libseat *seat, void *userdata)
+{
+    InputInfoPtr pInfo;
+    (void) userdata;
+    LogMessage(X_INFO, "seatd_libseat enable\n");
+    seat_info.active = TRUE;
+    seat_info.vt_active = TRUE;
+
+    xf86VTEnter();
+    /* Reactivate all input devices */
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        if (pInfo->flags & XI86_SERVER_FD){
+            if (xf86CheckIntOption(pInfo->options, "libseat_id", -1) > 0){
+                seatd_libseat_open_device(pInfo);
+                xf86EnableInputDeviceForVTSwitch(pInfo);
+            }
+        }
+    xf86platformVTProbe();
+}
+
+/*
+ * The seat has been disabled. This event signals that the application
+ * is going to lose its seat access. The event *must* be acknowledged
+ * with libseat_disable_seat shortly after receiving this event.
+ *
+ * If the recepient fails to acknowledge the event in time, seat
+ * devices may be forcibly revoked by the seat provider.
+ */
+static void
+disable_seat(struct libseat *seat, void *userdata)
+{
+    (void) userdata;
+    LogMessage(X_INFO, "seatd_libseat disable\n");
+    xf86VTLeave();
+    seat_info.vt_active = FALSE;
+    if (libseat_disable_seat(seat)) {
+        LogMessage(X_ERROR, "seatd_libseat disable failed: %d\n", errno);
+    }
+}
+
+/*
+ * Callbacks for handling the libseat events.
+ */
+static struct
+libseat_seat_listener client_callbacks = {
+    .enable_seat = enable_seat,
+    .disable_seat = disable_seat,
+};
+
+/*
+ * Check libseat is initialised and active.
+ */
+static Bool
+libseat_active(void)
+{
+    if (!seat_info.client) {
+        LogMessageVerb(X_DEBUG, 5, "seatd_libseat not initialised!\n");
+        return FALSE;
+    }
+    if (!seat_info.active) {
+        LogMessage(X_DEBUG, "seatd_libseat not active\n");
+        return FALSE;
+    }
+    return TRUE;
+}
+
+/*
+ * Handle libseat events
+ */
+static int
+libseat_handle_events(int timeout)
+{
+    int ret;
+
+    while ((ret = libseat_dispatch(seat_info.client, timeout)) > 0)
+        LogMessage(X_INFO, "seatd_libseat handled %i events\n", ret);
+    if (ret == -1) {
+        LogMessage(X_ERROR, "libseat_dispatch() failed: %s\n", strerror(errno));
+        return -1;
+    }
+    return ret;
+}
+
+static void
+event_handler(int fd, int ready, void *data)
+{
+    LogMessage(X_INFO, "seatd_libseat event handler\n");
+    libseat_handle_events(0);
+}
+
+/*
+ * Handle libseat logging.
+ */
+static void
+log_libseat(enum libseat_log_level level, const char *fmt, va_list args)
+{
+    MessageType xmt;
+    size_t xfmt_size = strlen(fmt) + 2;
+    char *xfmt;
+
+    xfmt = malloc(xfmt_size);
+    if (xfmt == NULL)
+        return;
+    snprintf(xfmt, xfmt_size, "%s\n", fmt);
+
+    switch (level) {
+    case LIBSEAT_LOG_LEVEL_INFO:
+        xmt = X_INFO;
+        break;
+    case LIBSEAT_LOG_LEVEL_ERROR:
+        xmt = X_ERROR;
+        break;
+    default:
+        xmt = X_DEBUG;
+    }
+    LogVMessageVerb(xmt, 0, xfmt, args);
+
+    free(xfmt);
+}
+
+// ============== seatd-libseat.h API functions =============
+
+/*
+ * Initialise the libseat client.
+ *
+ * Returns:
+ *   0 if all ok
+ *   1 if not possible
+ *   -EPERM (-1) if it was already initialised
+ *   -EPIPE (-32) if the seat opening failed.
+ */
+int
+seatd_libseat_init(void)
+{
+    if (!ServerIsNotSeat0() && xf86HasTTYs() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) {
+        LogMessage(X_INFO,
+            "seat-libseat: libseat integration requires -keeptty and "
+            "-keeptty was not provided, disabling libseat integration\n");
+        return 1;
+    }
+
+    libseat_set_log_level(LIBSEAT_LOG_LEVEL_DEBUG);
+    libseat_set_log_handler(log_libseat);
+    LogMessage(X_INFO, "seatd_libseat init\n");
+    if (libseat_active()) {
+        LogMessage(X_ERROR, "seatd_libseat already initialised\n");
+        return -EPERM;
+    }
+    seat_info.graphics_id = -1;
+    seat_info.client = libseat_open_seat(&client_callbacks, NULL);
+    if (!seat_info.client) {
+        LogMessage(X_ERROR, "Cannot set up seatd_libseat client\n");
+        return -EPIPE;
+    }
+    SetNotifyFd(libseat_get_fd(seat_info.client), event_handler, X_NOTIFY_READ, NULL);
+
+    if (libseat_handle_events(100) < 0) {
+        libseat_close_seat(seat_info.client);
+        return -EPIPE;
+    }
+    LogMessage(X_INFO, "seatd_libseat client activated\n");
+    return 0;
+}
+
+/*
+ * Shutdown the libseat client.
+ */
+void
+seatd_libseat_fini(void)
+{
+    if (seat_info.client) {
+        LogMessage(X_INFO, "seatd_libseat finish\n");
+        libseat_close_seat(seat_info.client);
+    }
+    seat_info.graphics_id = -1;
+    seat_info.active = FALSE;
+    seat_info.client = NULL;
+}
+
+/*
+ * Open the graphics device
+ *
+ * Return
+ *   file descriptor (>=0) if all is ok.
+ *   -EPERM (-1) if the libseat client is not activated
+ *   -EAGAIN (-11) if the VT is not active
+ *   -errno from libseat_open_device if device access failed
+ */
+int
+seatd_libseat_open_graphics(const char *path)
+{
+    int fd, id;
+
+    if (!libseat_active()) {
+        return -EPERM;
+    }
+    LogMessage(X_INFO, "seatd_libseat try open graphics %s\n", path);
+    if ((id = libseat_open_device(seat_info.client, path, &fd)) == -1) {
+        fd = -errno;
+        LogMessage(X_ERROR, "seatd_libseat open graphics %s (%d) failed: %d\n",
+                   path, id, fd);
+    }
+    else {
+        LogMessage(X_INFO, "seatd_libseat opened graphics: %s (%d:%d)\n", path,
+                   id, fd);
+    }
+    seat_info.graphics_id = id;
+    return fd;
+}
+
+/*
+ * Find duplicate devices with same major:minor number and assigned
+ * "libseat_id" and, if any, return its file descriptor.
+ */
+static int
+check_duplicate_device(int maj, int min) {
+
+    InputInfoPtr pInfo;
+
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+        if (pInfo->major == maj && pInfo->minor == min &&
+            xf86CheckIntOption(pInfo->options, "libseat_id", -1) >= 0) {
+            return pInfo->fd;
+        }
+    }
+    return -1;
+}
+
+/*
+ * Open an input device.
+ *
+ * The function sets the p->options "libseat_id" for the device when
+ * successful.
+ */
+void
+seatd_libseat_open_device(InputInfoPtr p)
+{
+    int id, fd;
+    char *path = xf86CheckStrOption(p->options, "Device", NULL);
+
+    if (!libseat_active()) {
+        return;
+    }
+    fd = check_duplicate_device(p->major,p->minor);
+    if (fd < 0) {
+        LogMessage(X_INFO, "seatd_libseat try open %s\n", path);
+        if ((id = libseat_open_device(seat_info.client, path, &fd)) == -1) {
+            fd = -errno;
+            LogMessage(X_ERROR, "seatd_libseat open %s (%d) failed: %d\n",
+                       path, id, fd);
+            return;
+        }
+    }
+    else {
+        LogMessage(X_INFO, "seatd_libseat reuse %d for %s\n", fd, path);
+    }
+    p->flags |= XI86_SERVER_FD;
+    p->fd = fd;
+    p->options = xf86ReplaceIntOption(p->options, "fd", fd);
+    p->options = xf86ReplaceIntOption(p->options, "libseat_id", id);
+    LogMessage(X_INFO, "seatd_libseat opened %s (%d:%d)\n", path, id, fd);
+}
+
+/*
+ * Release an input device.
+ */
+void
+seatd_libseat_close_device(InputInfoPtr p)
+{
+    char *path = xf86CheckStrOption(p->options, "Device", NULL);
+    int fd = xf86CheckIntOption(p->options, "fd", -1);
+    int id = xf86CheckIntOption(p->options, "libseat_id", -1);
+
+    if (!libseat_active())
+        return;
+    LogMessage(X_INFO, "seatd_libseat try close %s (%d:%d)\n", path, id, fd);
+    if (fd < 0) {
+        LogMessage(X_ERROR, "seatd_libseat device not open (%s)\n", path);
+        return;
+    }
+    if (id < 0) {
+        LogMessage(X_ERROR, "seatd_libseat no libseat ID\n");
+        return;
+    }
+    if (libseat_close_device(seat_info.client, id)) {
+        LogMessage(X_ERROR, "seatd_libseat close failed %d\n", -errno);
+    }
+    else {
+        close(fd);
+        p->fd = -1;
+        p->options = xf86ReplaceIntOption(p->options, "fd", -1);
+    }
+}
+
+/*
+ * Libseat controls session
+ */
+
+Bool
+seatd_libseat_controls_session(void){
+    return libseat_active();
+}
+
+/*
+ * Switch VT
+ */
+int
+seatd_libseat_switch_session(int session)
+{
+    int ret=0;
+
+    LogMessage(X_INFO, "seatd_libseat switch VT %d\n", session);
+    if ((ret = libseat_switch_session(seat_info.client, session)) < 0) {
+        LogMessage(X_ERROR, "seatd_libseat switch VT failed with %d\n", -errno);
+        goto ret;
+    }
+ ret:
+    return ret;
+}
--- xlibre-server-25.0.0.12.orig/hw/xfree86/os-support/meson.build
+++ xlibre-server-25.0.0.12/hw/xfree86/os-support/meson.build
@@ -50,6 +50,9 @@ if host_machine.system() == 'linux'
     if build_systemd_logind
         srcs_xorg_os_support += 'linux/systemd-logind.c'
     endif
+    if build_seatd_libseat
+        srcs_xorg_os_support += 'linux/seatd-libseat.c'
+    endif
 
     # this is ugly because the code is also
     if build_apm or build_acpi
--- xlibre-server-25.0.0.12.orig/hw/xfree86/os-support/shared/VTsw_usl.c
+++ xlibre-server-25.0.0.12/hw/xfree86/os-support/shared/VTsw_usl.c
@@ -34,6 +34,8 @@
 #include "xf86_os_support.h"
 #include "xf86_OSlib.h"
 
+#include "seatd-libseat.h"
+
 /*
  * Handle the VT-switching interface for OSs that use USL-style ioctl()s
  * (this used to include the sysv, sco, and linux subdirs, but only linux
@@ -62,6 +64,8 @@ Bool
 xf86VTSwitchAway(void)
 {
     xf86Info.vtRequestsPending = FALSE;
+    if (seatd_libseat_controls_session())
+        return TRUE;
     if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
         return FALSE;
     else
@@ -72,6 +76,8 @@ Bool
 xf86VTSwitchTo(void)
 {
     xf86Info.vtRequestsPending = FALSE;
+    if (seatd_libseat_controls_session())
+        return TRUE;
     if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
         return FALSE;
     else
--- xlibre-server-25.0.0.12.orig/hw/xfree86/os-support/shared/drm_platform.c
+++ xlibre-server-25.0.0.12/hw/xfree86/os-support/shared/drm_platform.c
@@ -21,17 +21,24 @@
 #include "xf86Bus.h"
 
 #include "../linux/systemd-logind.h"
+#include "seatd-libseat.h"
 
 static Bool
 get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
 {
     drmVersionPtr v;
-    int fd;
+    int fd = -1;
     int err = 0;
     Bool paused = FALSE, server_fd = FALSE;
 
     LogMessage(X_INFO, "Platform probe for %s\n", attribs->syspath);
 
+    fd = seatd_libseat_open_graphics(path);
+    if (fd != -1) {
+        attribs->fd = fd;
+        server_fd = TRUE;
+    }
+
     fd = systemd_logind_take_fd(attribs->major, attribs->minor, path, &paused);
     if (fd != -1) {
         if (paused) {
@@ -44,11 +51,15 @@ get_drm_info(struct OdevAttributes *attr
         server_fd = TRUE;
     }
 
-    if (fd == -1)
+    if (fd == -1) {
+        // Try opening the path directly
         fd = open(path, O_RDWR | O_CLOEXEC, 0);
 
-    if (fd == -1)
-        return FALSE;
+        if (fd == -1) {
+            xf86Msg(X_ERROR, "cannot open %s\n", path);
+            return FALSE;
+        }
+    }
 
     /* for a delayed probe we've already added the device */
     if (delayed_index == -1) {
--- xlibre-server-25.0.0.12.orig/include/meson.build
+++ xlibre-server-25.0.0.12/include/meson.build
@@ -90,11 +90,12 @@ endif
 
 conf_data.set('HAVE_LIBBSD', libbsd_dep.found() ? '1' : false)
 # Note: this symbol is used by libXtrans.
-conf_data.set('HAVE_SYSTEMD_DAEMON', build_systemd ? '1' : false)
+conf_data.set('HAVE_SYSTEMD_DAEMON', false)
 conf_data.set('CONFIG_UDEV', build_udev ? '1' : false)
 conf_data.set('CONFIG_UDEV_KMS', build_udev_kms ? '1' : false)
 conf_data.set('HAVE_DBUS', build_dbus ? '1' : false)
 conf_data.set('CONFIG_HAL', build_hal ? '1' : false)
+conf_data.set('SEATD_LIBSEAT', build_seatd_libseat ? '1' : false)
 conf_data.set('SYSTEMD_LOGIND', build_systemd_logind ? '1' : false)
 conf_data.set('NEED_DBUS', build_systemd_logind or build_hal ? '1' : false)
 conf_data.set('CONFIG_WSCONS', host_machine.system() in ['openbsd', 'netbsd'] ? '1' : false)
@@ -472,6 +473,7 @@ if build_xorg
             'rgb.h',
             'screenint.h',
             'scrnintstr.h',
+            'seatd-libseat.h',
             'servermd.h',
             'validate.h',
             'displaymode.h',
--- /dev/null
+++ xlibre-server-25.0.0.12/include/seatd-libseat.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2022 Mark Hindley, Ralph Ronnquist.
+ *
+ * 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.
+ *
+ * Authors: Mark Hindley <mark@hindley.org.uk>
+ *          Ralph Ronnquist <ralph.ronnquist@gmail.com>
+ */
+
+#ifndef SEATD_LIBSEAT_H
+#define SEATD_LIBSEAT_H
+
+#ifdef SEATD_LIBSEAT
+#include <xf86Xinput.h>
+extern int seatd_libseat_init(void);
+extern void seatd_libseat_fini(void);
+extern int seatd_libseat_open_graphics(const char *path);
+extern void seatd_libseat_open_device(InputInfoPtr p);
+extern void seatd_libseat_close_device(InputInfoPtr p);
+extern int seatd_libseat_switch_session(int session);
+extern Bool seatd_libseat_controls_session(void);
+#else
+#define seatd_libseat_init()
+#define seatd_libseat_fini()
+#define seatd_libseat_open_graphics(path) -1
+#define seatd_libseat_open_device(p)
+#define seatd_libseat_close_device(p)
+#define seatd_libseat_switch_session(int) -1
+#define seatd_libseat_controls_session() FALSE
+#endif
+
+#endif
--- xlibre-server-25.0.0.12.orig/meson.build
+++ xlibre-server-25.0.0.12/meson.build
@@ -106,6 +106,7 @@ libbsd_dep = dependency('libbsd-overlay'
 xkbcomp_dep = dependency('xkbcomp', required: false)
 xkbfile_dep = dependency('xkbfile')
 xfont2_dep = dependency('xfont2', version: '>= 2.0')
+libseat_dep = dependency('libseat', version: '>= 0.7.0')
 
 dbus_required = get_option('systemd_logind') == 'true'
 dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required)
@@ -192,8 +193,14 @@ endif
 build_udev = (udev_option != 'false')
 build_udev_kms = (udev_kms_option != 'false')
 
+if get_option('seatd_libseat') == 'auto'
+    build_seatd_libseat = build_udev_kms
+else
+    build_seatd_libseat = get_option('seatd_libseat') == 'true'
+endif
+
 if get_option('systemd_logind') == 'auto'
-    build_systemd_logind = build_udev_kms and dbus_dep.found()
+    build_systemd_logind = build_udev_kms and dbus_dep.found() and not build_seatd_libseat
 else
     build_systemd_logind = get_option('systemd_logind') == 'true'
 endif
--- xlibre-server-25.0.0.12.orig/meson_options.txt
+++ xlibre-server-25.0.0.12/meson_options.txt
@@ -74,6 +74,8 @@ option('systemd_notify', type: 'combo',
        description: 'Enable systemd-notify support')
 option('systemd_logind', type: 'combo', choices: ['true', 'false', 'auto'], value: 'false',
        description: 'Enable systemd-logind integration')
+option('seatd_libseat', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
+       description: 'Enable seatd-libseat integration')
 option('vgahw', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
        description: 'Xorg VGA access module')
 option('dpms', type: 'boolean', value: true,
--- xlibre-server-25.0.0.12.orig/test/meson.build
+++ xlibre-server-25.0.0.12/test/meson.build
@@ -233,7 +233,7 @@ if build_xorg
     unit = executable('tests',
          unit_sources,
          c_args: unit_c_args,
-         dependencies: [x11_dep, pixman_dep, randrproto_dep, inputproto_dep, libxcvt_dep],
+         dependencies: [x11_dep, pixman_dep, randrproto_dep, inputproto_dep, libxcvt_dep, libseat_dep],
          include_directories: unit_includes,
          link_args: ldwraps,
          link_with: xorg_link,
