rpms/xorg-x11-server/devel xserver-1.5.2-disable-kbd-mouse.patch, NONE, 1.1 xserver-1.5.2-enable-RAW-console.patch, NONE, 1.1 xorg-x11-server.spec, 1.368, 1.369

Dave Airlie airlied at fedoraproject.org
Thu Oct 16 06:50:06 UTC 2008


Author: airlied

Update of /cvs/pkgs/rpms/xorg-x11-server/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14058

Modified Files:
	xorg-x11-server.spec 
Added Files:
	xserver-1.5.2-disable-kbd-mouse.patch 
	xserver-1.5.2-enable-RAW-console.patch 
Log Message:
* Thu Oct 16 2008 Peter Hutterer <peter.hutterer at redhat.com> 1.5.2-5
- xserver-1.5.2-enable-RAW-console.patch: enable RAW mode for console, no need
  for grabbing the evdev device anymore.
- xserver-1.5.2-disable-kbd-mouse.patch: if AllowEmptyInput is on, don't allow
  mouse or keyboard drivers.


xserver-1.5.2-disable-kbd-mouse.patch:

--- NEW FILE xserver-1.5.2-disable-kbd-mouse.patch ---
>From 64db18dbc3a28e5b81140df0c76d1e1c38e9b225 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at redhat.com>
Date: Thu, 16 Oct 2008 11:22:29 +1030
Subject: [PATCH] xfree86: If AEI is on, disable "kbd" and "mouse" devices.

This consists of two parts:
In the implicit server layout, ignore those drivers when looking for a core
device.

And after finishing the server layout, run through the list of devices and
remove any that use mouse or kbd.

AEI is mutually exclusive with the kbd and mouse drivers, so pick either - or.
---
 hw/xfree86/common/xf86Config.c |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index a1c2e34..ac80add 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1340,7 +1340,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
     }
 
     /* 4. First pointer with 'mouse' as the driver. */
-    if (!foundPointer && (!xf86Info.allowEmptyInput || implicitLayout)) {
+    if (!foundPointer && !xf86Info.allowEmptyInput) {
 	confInput = xf86findInput(CONF_IMPLICIT_POINTER,
 				  xf86configptr->conf_input_lst);
 	if (!confInput) {
@@ -1480,7 +1480,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
     }
 
     /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
-    if (!foundKeyboard && (!xf86Info.allowEmptyInput || implicitLayout)) {
+    if (!foundKeyboard && !xf86Info.allowEmptyInput) {
 	confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
 				  xf86configptr->conf_input_lst);
 	if (!confInput) {
@@ -2481,6 +2481,41 @@ addDefaultModes(MonPtr monitorp)
 static void
 checkInput(serverLayoutPtr layout, Bool implicit_layout) {
     checkCoreInputDevices(layout, implicit_layout);
+
+    /* AllowEmptyInput and the "kbd" and "mouse" drivers are mutually
+     * exclusive. Trawl the list for mouse/kbd devices and disable them.
+     */
+    if (xf86Info.allowEmptyInput && layout->inputs)
+    {
+        IDevPtr *dev = layout->inputs;
+        BOOL warned = FALSE;
+
+        while(*dev)
+        {
+            if (strcmp((*dev)->driver, "kbd") == 0 ||
+                strcmp((*dev)->driver, "mouse") == 0)
+            {
+                IDevPtr *current;
+                if (!warned)
+                {
+                    xf86Msg(X_WARNING, "AllowEmtpyInput is on, devices using "
+                            "drivers 'kbd' or 'mouse' will be disabled.\n");
+                    warned = TRUE;
+                }
+
+                xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
+
+                current = dev;
+                xfree(*dev);
+
+                do {
+                    *current = *(current + 1);
+                    current++;
+                } while(*current);
+            } else
+                dev++;
+        }
+    }
 }
 
 /*
-- 
1.6.0.1


xserver-1.5.2-enable-RAW-console.patch:

--- NEW FILE xserver-1.5.2-enable-RAW-console.patch ---
>From 934dab76d01afb3a77439b94631eae37bf05c954 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at redhat.com>
Date: Sun, 12 Oct 2008 21:58:30 +1030
Subject: [PATCH] xfree86: if AllowEmptyInput is true, enable RAW mode on the console.

Usually, the console is set to RAW in the kbd driver. If we hotplug all input
devices (i.e. the evdev driver for keyboards) and the console is left as-is.
As a result, the evdev driver must put an EVIOCGRAB on the device to avoid
characters leaking onto the console. This again breaks many things, amongst
them lirc, in-kernel mouse button emulation and HAL.

This patch sets the console to RAW if AllowEmptyInput is on.

Use-cases:
1. AEI is off
  1.1. Only kbd driver is used - behaviour as-is.
  1.2. kbd and evdev driver is used: if evdev does not grab the device,
       duplicate events are generated.
2. AEI is on
  2.1. Only evdev driver is used - behaviour as-is, but evdev does not need
       to grab the device anymore.
  2.2. evdev and kbd are used: duplicate key events are generated if evdev
       does not grab the device.

1.2 is a marginal use-case that can be fixed by adding a "grab" option to the
evdev driver (update of xorg.conf is needed).

2.2 is an issue. If we have no ServerLayout section, AEI is on, but devices
specified in the xorg.conf are still added [1], resulting in duplicate events.
This is a common configuration and needs sorting out.

[1] 2eaed4a10fe5bf727579bca4ab8d4a47c8763a7d

Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
Signed-off-by: Adam Jackson <ajax at redhat.com>

---
 hw/xfree86/os-support/linux/lnx_init.c |   35 +++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 4c36b7c..6f68ba5 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -53,6 +53,8 @@ static int activeVT = -1;
 
 static int vtPermSave[4];
 static char vtname[11];
+static struct termios tty_attr; /* tty state to restore */
+static int tty_mode; /* kbd mode to restore */
 
 static int
 saveVtPerms(void)
@@ -272,6 +274,34 @@ xf86OpenConsole(void)
 	        FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
 		           strerror(errno));
 
+	    /* Set the keyboard to RAW mode. If we're using the keyboard
+	     * driver, the driver does it for us. If we have AEI on, then
+	     * we're expecting the devices to be added (i.e. evdev) and we
+	     * have to set it manually.
+	     */
+	    if (xf86Info.allowEmptyInput)
+	    {
+		struct termios nTty;
+
+		tcgetattr(xf86Info.consoleFd, &tty_attr);
+		ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
+
+		if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
+		    FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+			    strerror(errno));
+
+		nTty = tty_attr;
+		nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+		nTty.c_oflag = 0;
+		nTty.c_cflag = CREAD | CS8;
+		nTty.c_lflag = 0;
+		nTty.c_cc[VTIME]=0;
+		nTty.c_cc[VMIN]=1;
+		cfsetispeed(&nTty, 9600);
+		cfsetospeed(&nTty, 9600);
+		tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+	    }
+
 	    /* we really should have a InitOSInputDevices() function instead
 	     * of Init?$#*&Device(). So I just place it here */
 	
@@ -328,7 +358,10 @@ xf86CloseConsole()
     if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
 	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
 		strerror(errno));
-	
+
+    ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
+    tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+
     if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) 
 	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
 		strerror(errno));
-- 
1.6.0.1



Index: xorg-x11-server.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-server/devel/xorg-x11-server.spec,v
retrieving revision 1.368
retrieving revision 1.369
diff -u -r1.368 -r1.369
--- xorg-x11-server.spec	14 Oct 2008 18:22:20 -0000	1.368
+++ xorg-x11-server.spec	16 Oct 2008 06:49:35 -0000	1.369
@@ -19,7 +19,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.5.2
-Release:   4%{?dist}
+Release:   5%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -87,6 +87,10 @@
 Patch6006: xserver-1.5.2-backtrace-defines.patch
 Patch6007: xserver-1.5.2-lies-damn-lies-and-aspect-ratios.patch
 
+# No evdev grab, disable kbd/mouse
+Patch6008: xserver-1.5.2-enable-RAW-console.patch
+Patch6009: xserver-1.5.2-disable-kbd-mouse.patch
+
 %define moduledir	%{_libdir}/xorg/modules
 %define drimoduledir	%{_libdir}/dri
 %define sdkdir		%{_includedir}/xorg
@@ -517,6 +521,12 @@
 
 
 %changelog
+* Thu Oct 16 2008 Peter Hutterer <peter.hutterer at redhat.com> 1.5.2-5
+- xserver-1.5.2-enable-RAW-console.patch: enable RAW mode for console, no need
+  for grabbing the evdev device anymore.
+- xserver-1.5.2-disable-kbd-mouse.patch: if AllowEmptyInput is on, don't allow
+  mouse or keyboard drivers.
+
 * Tue Oct 14 2008 Adam Jackson <ajax at redhat.com> 1.5.2-4
 - xserver-1.5.2-lies-damn-lies-and-aspect-ratios.patch: Catch even more
   cases of the monitor encoding aspect ratio for size. (#458747)




More information about the scm-commits mailing list