[PATCH] XFbdev: disable probing I/O devices on serial ports

dmitry pervushin <[email protected]>
Newsgroups gmane.comp.xfree86.devel
Message-ID <[email protected]>
Hello all,

Please find inlined patch that disables probing for mouse on serial
ports if -no-serial-probe is specified in command line.

Signed-off-by: dmitry pervushin <[email protected]>
Index: xc/programs/Xserver/hw/tinyx/linux/mouse.c
===================================================================
--- xc.orig/programs/Xserver/hw/tinyx/linux/mouse.c
+++ xc/programs/Xserver/hw/tinyx/linux/mouse.c
@@ -82,6 +82,9 @@
 #undef DEBUG_BYTES
 #define KBUFIO_SIZE 256
 
+extern Bool noSerialProbe; /* if switched on, ttyS* devices will be never */
+ 			    /* probed for mouse                            */
+
 typedef struct _kbufio {
     int		    fd;
     unsigned char   buf[KBUFIO_SIZE];
@@ -977,6 +980,8 @@ MouseInit (void)
 	{
 	    for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
 	    {
+		if (noSerialProbe && strstr(kdefaultMouse[i], "/dev/ttyS"))
+			continue;
 		fd = open (kdefaultMouse[i], 2);
 		if (fd >= 0)
 		{
Index: xc/programs/Xserver/os/utils.c
===================================================================
--- xc.orig/programs/Xserver/os/utils.c
+++ xc/programs/Xserver/os/utils.c
@@ -178,6 +178,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
 Bool CoreDump;
 Bool noTestExtensions;
 
+Bool noSerialProbe = FALSE;
 #ifdef PANORAMIX
 Bool noPanoramiXExtension = TRUE;
 Bool PanoramiXVisibilityNotifySent = FALSE;
@@ -639,6 +640,7 @@ void UseMsg(void)
     ErrorF("-dumbSched             Disable smart scheduling, enable old behavior\n");
     ErrorF("-schedInterval int     Set scheduler interval in msec\n");
 #endif
+    ErrorF("-no-serial-probe	   Disable probing of serial ports for mice\n");
 #ifdef XDMCP
     XdmcpUseMsg();
 #endif
@@ -891,6 +893,10 @@ ProcessCommandLine(int argc, char *argv[
 	    logoScreenSaver = 0;
 	}
 #endif
+	else if ( strcmp( argv[i], "-no-serial-probe") == 0)
+	{
+	    noSerialProbe = TRUE;
+	}
 	else if ( strcmp( argv[i], "-nolisten") == 0)
 	{
             if(++i < argc) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.