# Can someone help with a USB gamepad/joystick issue?



## retrogamer (May 1, 2014)

Hello all, first time poster and fairly recent FreeBSD convert after jumping from Slackware. Anyway, I've run into a minor issue with using USB gamepads/joysticks on FreeBSD, and was hoping someone could help or alternatively let me know that I should file a bug report (I'd wager the former is the case). It's a bit complicated, so I will break it down step by step.


  I first tried using an Xbox 360 controller (wired), both an OEM model and a Mad Catz Brawl Pad (made like a Saturn controller and lacking analogue sticks). They are detected and at first seem to be working. But, when I try to assign keys in an emulator (PCSX-R, Snes9x, Hugo), as soon as I try to input the new key value it automatically assigns the 2- axis (which correlates to the right trigger). So in other words, before I can even press a button, the controller is already outputting at that 2- axis as if I had pressed the right trigger.
  I had similar issues under Slackware a few years ago, and solved it by removing xf86-input-joystick based on a post I read over at linuxquestions.org. So, I thought that just maybe it would work on FreeBSD. I therefore tried deinstalling the x11-drivers/xf86-input-joystick port and rebooting, but the issue persisted.
  I decided to try some other USB plug and play gamepads, and see if this was just an issue with the 360 controller driver. So, I reinstalled the xf86-input-joystick port, rebooted, and tried using two older Microsoft Sidewinder gamepads (one with an analogue stick, one even older that only had a d-pad). With both of these, they again are detected, but when I try to assign keys, they output the 1- axis, which correlates to down on their d-pads.
  I tried installing the devel/libgamepad port, the issue persisted with the Sidewinder controllers.
  I was able to find a passable workaround, by manually assigning all of my keys and analogue stick/d-pad axis with the 360 controllers while avoiding 2- (and not being able to use the right analogue trigger as a result), or using the analogue stick (and not the d-pad) on the newer Sidewinder.

I apologize if I'm missing something obvious, I'm no expert on these USB devices, and did a forum and a mailing list search before asking. After trying alternative drivers and making sure the USB hid daemon has started properly, I'm a bit out of ideas. Also, just to clarify, I am on 10.0.

Edit:  I have partially fixed the issue.  First, it turns out that the problem with the Sidewinder controllers only occurs when a 360 controller is plugged in a USB port at the same.  So unplugging the 360 controller, and rebooting with only the Sidewinder connected, solves that.  I have also partially resolved the 360 controller issue; in Snes9x, there is a software joystick calibration option.  Running this allows the 360 controller to work properly with that emulator.  PCSX-R doesn't have any joystick calibration option, and the issue persists with it, so I'm guessing it's some type of issue with the 360 controller driver.


----------



## segfault (May 1, 2014)

Welcome to FreeBSD! I too came from Slackware a few years ago. And like you, have also had some issues with USB gamepads. The NES emulator seemed to work okay for me as well, though the second joystick won't allow itself to be mapped in Xonotic so I am still looking for advice on this topic myself.


----------



## fonz (May 1, 2014)

For what it's worth, I remember having had similar problems: I have a USB adapter for an original SNES controller. While it works fine with Linux and Windows, FreeBSD used to somehow get it wrong: the joystick was recognised but input repeated too quickly to make it even remotely playable. I haven't looked into it for a while, though. Maybe now would be a good time


----------



## retrogamer (May 2, 2014)

Thanks for the welcome and useful information, @segfault and @fonz.   Just picking up on this, I realized what is going on with that 360 controller driver:  The default axis mapping is a bit off.  The right trigger gets mapped as a button (not a 2- axis) when I run the joystick calibration utility in Snes9x, and it works smoothly after that.  The problem is that (AFAIK) the port for devel/linux-jscal has been dead for a while and isn't coming back, so you're only going to be able to fix this for the 360 controller if your emulator has its own calibration utility or that 360 controller driver is tweaked a bit with better axis mapping.  Having said that, the Plug and Play controllers are working great, so I'm just going to use the Sidewinder for now.  The one that bugs me just a bit is not being able to use the Brawl Pad properly for Gngeo (that right trigger is really needed for fighters), but there are some Plug and Play Saturn gamepads made by Sega's ST labs from the mid-2000's that are very good.  The problem is they haven't been made in 10+ years and go for over $80 on eBay; there are some really cheap Plug and Play, Play Sega branded controllers that I have read you can switch out the board from with an original Saturn controller.  So I think I'm going to have to break out my wallet or my soldering iron (to hook up the shoulder triggers when I switch out that controller board).   :e 

Also, just an aside, I really am impressed with the number of emulators in the ports collection, and they are all working great with x11/nvidia-driver.  FreeBSD really is great for retro gaming/emulation enthusiasts, it's just probably better to stick with Plug and Play USB controllers for now.


----------



## retrogamer (Jan 28, 2015)

Well, I realize this is an old thread, but I thought I would update it with a (painfully obvious) solution I worked out for the Brawl Pad.  Just solder the right trigger to the center X button (that would be used to bring up a menu in an XBox 360 game), then you can map it properly and the controller is working great.  If you have basic soldering skills and want a good Sega Saturn/6 button Genesis style pad, this is a solid option.


----------



## nickednamed (Feb 5, 2015)

I don't know if it would help too much in your case, but in case anyone else comes across this thread, I've found the following program useful for mapping keyboard keys to my joypad (in situations where the keyboard worked well, but the joypad did not)

emulators/joytran


----------

