[Xcb] [PATCH] one and a half XInput requests

Eamon Walsh ewalsh at tycho.nsa.gov
Fri Nov 9 18:37:13 PST 2007


I need to call ListInputDevices to find out the deviceid's for each
device.  The attached patch gives me enough to do that.  Part of the
reply (specifically the list of class information and the subsequent
list of device names) remains uninterpreted by this description; my
guess is that C code will have to be handwritten to do this.  But
the bytes are there, at least.  I've also attached my test code.

The rest of the extension has 4-5 more unfriendly requests like this
one but most of it seems benign enough.  Ack this and if I have time
I'll push more of it up later.

Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
---

diff --git a/src/xinput.xml b/src/xinput.xml
new file mode 100644
index 0000000..7cb57ca
--- /dev/null
+++ b/src/xinput.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+-->
+<xcb header="xinput" extension-xname="XInputExtension" extension-name="Input"
+     major-version="1" minor-version="4">
+  <import>xproto</import>
+
+  <enum name="DeviceUse">
+    <item name="IsXPointer"><value>0</value></item>
+    <item name="IsXKeyboard"><value>1</value></item>
+    <item name="IsXExtensionDevice"><value>2</value></item>
+  </enum>
+
+  <struct name="DEVICEINFO">
+    <field type="CARD32" name="device_type" />
+    <field type="CARD8" name="device_id" />
+    <field type="CARD8" name="num_class_info" />
+    <field type="CARD8" name="device_use" />
+    <pad bytes="1" />
+  </struct>
+
+  <struct name="INPUTINFO">
+    <field type="CARD8" name="class_id" />
+    <field type="CARD8" name="len" />
+  </struct>
+
+  <struct name="KEYINFO">
+    <field type="CARD8" name="class_id" />
+    <field type="CARD8" name="len" />
+    <field type="CARD8" name="min_keycode" />
+    <field type="CARD8" name="max_keycode" />
+    <field type="CARD16" name="num_keys" />
+  </struct>
+
+  <struct name="BUTTONINFO">
+    <field type="CARD8" name="class_id" />
+    <field type="CARD8" name="len" />
+    <field type="CARD16" name="num_buttons" />
+  </struct>
+
+  <struct name="AXISINFO">
+    <field type="CARD32" name="resolution" />
+    <field type="CARD32" name="minimum" />
+    <field type="CARD32" name="maximum" />
+  </struct>
+
+  <struct name="VALUATORINFO">
+    <field type="CARD8" name="class_id" />
+    <field type="CARD8" name="len" />
+    <field type="CARD8" name="axes_len" />
+    <field type="CARD8" name="mode" />
+    <field type="CARD32" name="motion_size" />
+    <list type="AXISINFO" name="axes">
+      <fieldref>axes_len</fieldref>
+    </list>
+  </struct>
+
+  <request name="GetExtensionVersion" opcode="1">
+    <field type="CARD16" name="name_len" />
+    <pad bytes="2" />
+    <list type="char" name="name">
+      <fieldref>name_len</fieldref>
+    </list>
+    <reply>
+      <field type="CARD8" name="minor_opcode" />
+      <field type="CARD16" name="server_major" />
+      <field type="CARD16" name="server_minor" />
+      <field type="CARD8" name="present" />
+    </reply>
+  </request>
+
+  <request name="ListInputDevices" opcode="2">
+    <reply>
+      <field type="CARD8" name="minor_opcode" />
+      <field type="CARD8" name="devices_len" />
+      <pad bytes="23" />
+      <list type="DEVICEINFO" name="devices">
+	<fieldref>devices_len</fieldref>
+      </list>
+      <!-- Uninterpreted: list of deviceinfo structs of 3 the subtypes -->
+      <!-- Uninterpreted: list of null-terminated strings -->
+    </reply>
+  </request>
+</xcb>

-- 
Eamon Walsh <ewalsh at tycho.nsa.gov>
National Security Agency

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 3156 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/xcb/attachments/20071109/e66d7410/attachment.c 


More information about the Xcb mailing list