6 <perex>An LD_PRELOAD hack that translates socket messages to the X11 events.</perex> |
6 <perex>An LD_PRELOAD hack that translates socket messages to the X11 events.</perex> |
7 <pořadí>050</pořadí> |
7 <pořadí>050</pořadí> |
8 |
8 |
9 <text xmlns="http://www.w3.org/1999/xhtml"> |
9 <text xmlns="http://www.w3.org/1999/xhtml"> |
10 <p> |
10 <p> |
|
11 There are two ways how the <a href="http://spacenav.sourceforge.net/">Spacenav</a> client (e.g. Blender, OpenSCAD or FreeCAD) and the Spacenav server (Spacenav daemon connected to the 6DoF 3D mouse or our simulator) |
|
12 can reach each other: |
11 </p> |
13 </p> |
|
14 |
|
15 <ul> |
|
16 <li>unix domain socket</li> |
|
17 <li>X11</li> |
|
18 </ul> |
|
19 |
|
20 <p> |
|
21 The client might be compiled with both options (like X11 with fallback to socket interface) or only with one (like X11 only). |
|
22 The server can be configured to provide both interfaces (it needs the <code>~/.Xauthority</code> X11 magic cookie) |
|
23 or only the socket interface (if the cookie is missing). |
|
24 </p> |
|
25 |
|
26 <p> |
|
27 If we have socket-only server and X11-only client, we can of course recompile the client or reconfigure the server. |
|
28 Or we can have some fun, hack it in the <code>LD_PRELOAD</code> fashion and translate the socket interface to the X11 one. |
|
29 So we make X11 client talking to the socket server. |
|
30 </p> |
|
31 |
|
32 <m:img src="img/spacenavHack-freecad-v0.1.png"/> |
|
33 |
|
34 <h2>Build and installation</h2> |
|
35 |
|
36 <p>We use the CMake build system, so the steps are basically:</p> |
|
37 |
|
38 <pre><![CDATA[mkdir build && cd build && cmake .. && make]]></pre> |
|
39 |
|
40 <p>Required libraries:</p> |
|
41 |
|
42 <ul> |
|
43 <li>spnav</li> |
|
44 </ul> |
|
45 |
|
46 <h2>Usage</h2> |
|
47 |
|
48 <p>We just run our favourite CAD with our hackish library preloaded:</p> |
|
49 |
|
50 <pre>LD_PRELOAD="./libspnav-lib-hack.so" freecad</pre> |
|
51 |
|
52 <p>and it translates the X11 API calls to the socket ones.</p> |
|
53 |
|
54 <h2>3DConnexion SpaceMouse Wireless</h2> |
|
55 <p>Our software works with this mouse:</p> |
|
56 <m:img src="img/3DConnexion-SpaceMouse-1.jpeg"/> |
|
57 <m:usb-id/> |
|
58 |
12 </text> |
59 </text> |
13 |
60 |
14 </stránka> |
61 </stránka> |
15 |
62 |