Joytran
Artifact [196d628e57]
Not logged in

Artifact 196d628e571e8cb60922a84c55bfccdea0c81f0c:

Wiki page [Rationale] by beyert 2012-03-02 08:49:10.
D 2012-03-02T08:49:10.314
L Rationale
P 48d21e2552346f4594b84c53a0199f0f1c1d123a
U beyert
W 3339
[Joytran|Home]

<h2>Rationale</h2>

On the FreeBSD operating system, there are not many programs available for joystick to keyboard translation.  I believe that users of other BSD operating systems might find this project useful as well.
<P>
For old versions of the FreeBSD USB stack prior to 8.0-RELEASE, there was a Linux joystick compatibility layer (devel/linux-js), which opened up support for a wide variety of such applications native to Linux, such as <I>xjoypad.</I> (xjoypad was decent at the time, though a bit minimal in features)  Unfortunately, <I>linux-js</I> no longer works in the current USB stack on FreeBSD, and the original author of linux-js disappeared from the internet.  I decided to look for other solutions.
<P>
<h3>Problems with existing programs:</h3>
<P>
Since I no longer had access to the Linux joystick API on FreeBSD, I was restricted to either use programs which were based on a high level portable joystick API, or to use programs which offered support for the native *BSD joystick interface.
<P>
The problem was that there were very few joystick translation programs that fit this criteria, and none were suitable for my needs.

<h4>Xorg.conf MapAxisN / MapButtonN</h4>

First, I tried using InputDevice MapAxisN / MapButtonN in the xorg.conf.  This has several problems:
<P>
  #  I couldn't get hotplug to work, and HAL is hard to understand (and deprecated)
<P>
  #  It doesn't support Joystick Hats, or at least I couldn't figure how to get it working
<P>
  #  Its axis translation code doesn't work well for anything other than up/down/left/right (eg. trying to go diagonal results in unpleasant jitters)
<P>
  #  I couldn't turn off its keyboard/mouse emulation when I just wanted to use the native joystick support for applications such as emulators/zsnes

<P>

<h4>Rejoystick / jojsticken</h4>

Next, I tried porting <I>rejoystick</I> to FreeBSD.  This was not difficult, since it is based on SDL.  However, there were many issues with rejoystick.
<P>
  #  It had a critical drifting bug (which I fixed but by rewriting the entire backend)
<P>
  #  Issues with xauth/xhost that required xhost, at least until I made many changes
<P>
  #  No support for mouse emulation
<P>
  #  No support for joystick hats
<P>
  #  The author moved on to another project, which I couldn't get to work, (jojsticken) due to issues with an out of date SDL binding.  (Although I am more proficient in Java than in C)

<P>

<h3>Conclusion</h3>

Ultimately, I ended up writing a large patch that fixed most of my issues with <I>rejoystick.</I>  However, at that time, I decided that I might as well just write a similar application from scratch.  My improvements didn't fit the architecture of rejoystick properly, and hence would be difficult to maintain.
<P>
Surprisingly, it took me only two days to write Joytran, and additionally, I discovered many gaps in my understanding of the problem domain.  This allowed me to avoid almost all of the bugs existent in rejoystick.
<P>
As per licensing requirements, <I>Joytran</I> was written from scratch; it contains no code from <I>rejoystick</I> at all.  The main similarity is that the configuration file syntax shows influence from rejoystick, as well as from the Xorg.conf syntax.
<P>
So, in conclusion, these reasons are why I wrote <I>Joytran.</I>

[Joytran|Home]

Z 8cb1a050fdd8cd25e5390955f0b5eb7b