mouse-data/spacenav-hack.xml
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:52:34 +0200
branchv_0
changeset 139 0246f4b2c827
parent 137 8e583c8df660
permissions -rw-r--r--
fix license version: GNU GPLv3

<stránka
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
	
	<nadpis>Spacenav Hack</nadpis>
	<perex>An LD_PRELOAD hack that translates socket messages to the X11 events.</perex>
	<pořadí>050</pořadí>

	<text xmlns="http://www.w3.org/1999/xhtml">
		<p>
			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)
			can reach each other:
		</p>
		
		<ul>
			<li>unix domain socket</li>
			<li>X11</li>
		</ul>
		
		<p>
			The client might be compiled with both options (like X11 with fallback to socket interface) or only with one (like X11 only).
			The server can be configured to provide both interfaces (it needs the <code>~/.Xauthority</code> X11 magic cookie)
			or only the socket interface (if the cookie is missing).
		</p>
		
		<p>
			If we have socket-only server and X11-only client, we can of course recompile the client or reconfigure the server.
			Or we can have some fun, hack it in the <code>LD_PRELOAD</code> fashion and translate the socket interface to the X11 one.
			So we make X11 client talking to the socket server.
		</p>
		
		<m:img src="img/spacenavHack-freecad-v0.1.png"/>
		
		<h2>Build and installation</h2>

		<p>We use the CMake build system, so the steps are basically:</p>
		
		<pre><![CDATA[mkdir build && cd build && cmake .. && make]]></pre>
		
		<p>Required libraries:</p>
		
		<ul>
			<li>spnav</li>
		</ul>
		
		<h2>Usage</h2>

		<p>We just run our favourite CAD with our hackish library preloaded:</p>
				
		<pre>LD_PRELOAD="./libspnav-lib-hack.so" freecad</pre>
		
		<p>and it translates the X11 API calls to the socket ones.</p>
		
		<h2>3DConnexion SpaceMouse Wireless</h2>
		<p>Our software works with this mouse:</p>
		<m:img src="img/3DConnexion-SpaceMouse-1.jpeg"/>
		<m:usb-id/>
		
	</text>

</stránka>