[PATCH:xf86-input-keyboard] Set XI_PROP_DEVICE_NODE property to string from "Device" option

Alan Coopersmith alan.coopersmith at oracle.com
Fri Apr 27 17:53:09 PDT 2012


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 man/kbd.man |    2 +-
 src/kbd.c   |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/man/kbd.man b/man/kbd.man
index c8d70cc..b1bd082 100644
--- a/man/kbd.man
+++ b/man/kbd.man
@@ -40,7 +40,7 @@ are supported:
 .TP 7
 .BI "Option \*qDevice\*q \*q" string \*q
 Specify the keyboard device.  Default: the OS's default console keyboard
-input source.
+input source.  Property: "Device Node" (read-only).
 .TP 7
 .BI "Option \*qProtocol\*q \*q" string \*q
 Specify the keyboard protocol.  Valid protocol types include:
diff --git a/src/kbd.c b/src/kbd.c
index e04c340..f77bc95 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -38,6 +38,10 @@
 #include "xf86OSKbd.h"
 #include "compiler.h"
 
+#include "exevents.h"
+#include <X11/Xatom.h>
+#include "xserver-properties.h"
+
 #include "xkbstr.h"
 #include "xkbsrv.h"
 
@@ -328,6 +332,21 @@ KbdProc(DeviceIntPtr device, int what)
                  return BadValue;
              }
          }
+# ifdef XI_PROP_DEVICE_NODE
+	 {
+             const char *device_node =
+                 xf86CheckStrOption(pInfo->options, "Device", NULL);
+
+             if (device_node)
+             {
+                 Atom prop_device = MakeAtom(XI_PROP_DEVICE_NODE,
+                                             strlen(XI_PROP_DEVICE_NODE), TRUE);
+                 XIChangeDeviceProperty(device, prop_device, XA_STRING, 8,
+                                        PropModeReplace, strlen(device_node),
+                                        device_node, FALSE);
+             }
+         }
+# endif /* XI_PROP_DEVICE_NODE */
 #else
          {
              XkbComponentNamesRec xkbnames;
-- 
1.7.9.2



More information about the xorg-devel mailing list