[PATCH 1/2] kdrive: add protocol mouse option

Olivier Blin blino at mandriva.com
Thu May 28 11:57:36 PDT 2009


kdrive probes a lot of PS/2 protocols for the mouse device, which
makes the mouse unusable for some seconds after X startup.
This new "protocol" option allows forcing the mouse protocol.
It can be used this way:
Xfbdev -mouse mouse,,protocol=ps/2 -keybd keyboard

Signed-off-by: Olivier Blin <blino at mandriva.com>
---
 hw/kdrive/linux/mouse.c |    4 +++-
 hw/kdrive/src/kdrive.h  |    1 +
 hw/kdrive/src/kinput.c  |    3 +++
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c
index 02214b3..417fee4 100644
--- a/hw/kdrive/linux/mouse.c
+++ b/hw/kdrive/linux/mouse.c
@@ -961,7 +961,9 @@ MouseInit (KdPointerInfo *pi)
     km = (Kmouse *) xalloc (sizeof (Kmouse));
     if (km) {
         km->iob.avail = km->iob.used = 0;
-        MouseFirstProtocol(km, "exps/2");
+        MouseFirstProtocol(km, pi->protocol ? pi->protocol : "exps/2");
+        if (pi->protocol) 
+                km->state = MouseWorking;
         km->i_prot = 0;
         km->tty = isatty (fd);
         km->iob.fd = -1;
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index c60559a..ce47cf4 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -220,6 +220,7 @@ struct _KdPointerInfo {
     DeviceIntPtr          dixdev;
     char                  *name;
     char                  *path;
+    char                  *protocol;
     InputOption           *options;
     int                   inputClass;
 
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 0d216a9..360739c 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1166,6 +1166,8 @@ KdParsePointerOptions (KdPointerInfo *pi)
             pi->transformCoordinates = FALSE;
         else if (!strcasecmp (option->key, "device"))
             pi->path = strdup(option->value);
+        else if (!strcasecmp (option->key, "protocol"))
+            pi->protocol = strdup(option->value);
         else
             ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", 
                     option->key, option->value);
@@ -1186,6 +1188,7 @@ KdParsePointer (char *arg)
         return NULL;
     pi->emulateMiddleButton = kdEmulateMiddleButton;
     pi->transformCoordinates = !kdRawPointerCoordinates;
+    pi->protocol = NULL;
     pi->nButtons = 5; /* XXX should not be hardcoded */
     pi->inputClass = KD_MOUSE;
 
-- 
1.6.3




More information about the xorg mailing list