xserver: Branch 'master' - 2 commits

Tiago Vignatti vignatti at kemper.freedesktop.org
Wed Jul 4 22:51:13 PDT 2007


 hw/kdrive/src/kinput.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

New commits:
diff-tree 9131d560a0d42067cc4e726e445e060216c9acdc (from 41b485d5507821e41c3281c3c565647ae7582101)
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Thu Jul 5 02:47:34 2007 -0300

    Postpone options variable assignment to fix segfault when we got a device but
    its driver is incorrect. Also if (!ki && !pi) can never be true.
    
    This one also adds the device option field.

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index efbf260..e3c3abc 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2317,13 +2317,11 @@ NewInputDeviceRequest(InputOption *optio
                 pi = KdNewPointer();
                 if (!pi)
                     return BadAlloc;
-                pi->options = options;
             }
             else if (strcmp(option->value, "keyboard") == 0) {
                 ki = KdNewKeyboard();
                 if (!ki)
                     return BadAlloc;
-                ki->options = options;
             }
             else {
                 ErrorF("unrecognised device type!\n");
@@ -2332,8 +2330,19 @@ NewInputDeviceRequest(InputOption *optio
         }
     }
 
+    if (!ki && !pi) {
+        ErrorF("unrecognised device identifier!\n");
+        return BadValue;
+    }
+
     for (option = options; option; option = option->next) {
-        if (strcmp(option->key, "driver") == 0) {
+        if (strcmp(option->key, "device") == 0) {
+            if (pi && option->value)
+                pi->path = KdSaveString(option->value);
+            else if (ki && option->value)
+                ki->path = KdSaveString(option->value);
+        }
+        else if (strcmp(option->key, "driver") == 0) {
             if (pi) {
                 pi->driver = KdFindPointerDriver(option->value);
                 if (!pi->driver) {
@@ -2341,6 +2350,7 @@ NewInputDeviceRequest(InputOption *optio
                     KdFreePointer(pi);
                     return BadValue;
                 }
+                pi->options = options;
             }
             else if (ki) {
                 ki->driver = KdFindKeyboardDriver(option->value);
@@ -2349,6 +2359,7 @@ NewInputDeviceRequest(InputOption *optio
                     KdFreeKeyboard(ki);
                     return BadValue;
                 }
+                ki->options = options;
             }
         }
     }
diff-tree 41b485d5507821e41c3281c3c565647ae7582101 (from a92dc6b5295e4f352115fed2856169929819863f)
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Thu Jul 5 02:40:07 2007 -0300

    kdrive must to know that devices are unplugged.

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 372ffc8..efbf260 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2382,4 +2382,5 @@ NewInputDeviceRequest(InputOption *optio
 void
 DeleteInputDeviceRequest(DeviceIntPtr pDev)
 {
+    RemoveDevice(pDev);
 }


More information about the xorg-commit mailing list