Joytran
Documentation
Not logged in

Home

Rationale

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.

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 xjoypad. (xjoypad was decent at the time, though a bit minimal in features) Unfortunately, linux-js 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.

Problems with existing programs:

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.

The problem was that there were very few joystick translation programs that fit this criteria, and none were suitable for my needs.

Xorg.conf MapAxisN / MapButtonN

First, I tried using InputDevice MapAxisN / MapButtonN in the xorg.conf. This has several problems:

  1. I couldn't get hotplug to work, and HAL is hard to understand (and deprecated)

  2. It doesn't support Joystick Hats, or at least I couldn't figure how to get it working

  3. 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)

  4. 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

Rejoystick / jojsticken

Next, I tried porting rejoystick to FreeBSD. This was not difficult, since it is based on SDL. However, there were many issues with rejoystick.

  1. It had a critical drifting bug (which I fixed but by rewriting the entire backend)

  2. Issues with xauth/xhost that required xhost, at least until I made many changes

  3. No support for mouse emulation

  4. No support for joystick hats

  5. 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)

Conclusion

Ultimately, I ended up writing a large patch that fixed most of my issues with rejoystick. 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.

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.

As per licensing requirements, Joytran was written from scratch; it contains no code from rejoystick at all. The main similarity is that the configuration file syntax shows influence from rejoystick, as well as from the Xorg.conf syntax.

So, in conclusion, these reasons are why I wrote Joytran.

Home