[PATCH input-vmmouse] Enable hardware access during vmmouse preinit.

Michal Srb msrb at suse.com
Thu May 3 08:55:24 PDT 2012


Vmmouse driver uses outl calls but never requests hardware access.
In case there are no other drivers that requests it, vmmouse 
initialization will fail. (Found on KVM virtual machine with fbdev 
graphics driver and vmmouse input driver.)

Request hardware access in same way xf86-input-keyboard does.
---
 src/vmmouse.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/vmmouse.c b/src/vmmouse.c
index 285ba26..7778923 100644
--- a/src/vmmouse.c
+++ b/src/vmmouse.c
@@ -65,6 +65,7 @@
 #include "xf86Xinput.h"
 #include "xf86_OSproc.h"
 #include "xf86OSmouse.h"
+#include "xf86Priv.h"
 #include "compiler.h"
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
@@ -339,6 +340,16 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 #endif
 
    /*
+    * enable hardware access
+    */
+   if (!xorgHWAccess) {
+      if (xf86EnableIO())
+          xorgHWAccess = TRUE;
+      else
+          return NULL;
+   }
+
+   /*
     * try to enable vmmouse here
     */
    if (!VMMouseClient_Enable()) {
@@ -399,6 +410,16 @@ VMMousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
    VMMousePrivPtr mPriv = NULL;
    int rc = Success;
 
+   /* Enable hardware access. */
+   if (!xorgHWAccess) {
+      if (xf86EnableIO())
+          xorgHWAccess = TRUE;
+      else {
+          rc = BadValue;
+          goto error;
+      }
+   }
+
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
    /* For ABI < 12, we need to return the wrapped driver's pInfo (see
     * above). ABI 12, we call NIDR and are done */
-- 
1.7.7


More information about the xorg-devel mailing list