Knowledgebase: XPForce
Linux Kernel Patch for Force Feedback Support
Posted by Site Admin on 17 January 2015 12:31 PM

Currently (February 2015) the Linux kernel support for PID devices such as the Microsoft Sidewinder Force Feedback 2 is broken, and has been for several years. During the porting of XPForce to Linux, I have fixed several bugs in the kernel driver and am happy to say that it is now fully working. Of course, until that patch makes it into the kernel, you will need to apply the patch yourself.

The following two links are for bug reports, and the code of the patch, for Redhat-based and Debian-based systems respectively. The patch is identical, but you may want to add yourself to the mailing list to get any updates as they happen and to show the maintainers that there is some interest in getting the SWFF2 working under Linux.

You should be comfortable with the process of downloading and building a kernel, and in particular, of how to recover if it goes wrong. The steps below are a rough description of how to complete the process but are undertaken entirely at your own risk. I will under no circumstances provide free support for this process, nor for recovering your system if it goes wrong. In rebuilding the kernel or associated modules you run the risk of making your Linux system unusable. With all due respect to the Linux fundamentalists, if you're going to run it as a desktop system then you have to realise that underneath the desktop gloss it's a complex, Unix-like server O/S and sometimes needs to be treated as such.

  1. Locate the correct device node for your device (as root):
    # lsinput | more

    Scan the output for the device node matching your joystick:

    /dev/input/event4

       bustype : BUS_USB

       vendor  : 0x45e

       product : 0x1b

       version : 256

       name    : "Microsoft SideWinder Force Feedb"

       phys    : "usb-0000:00:1a.0-1.4/input0"

       uniq    : ""

       bits ev : EV_SYN EV_KEY EV_ABS EV_MSC EV_FF


    The device node for this joystick is "/dev/input/event4". This may change on reboot, or if you unplug the joystick!

  2. Test the device using the "fftest" program, either provided or available for most Linux distributions as part of the "joystick" package.
    > fftest /dev/input/event4

    If you get the "Error: Function not implemented" message after "Uploading Effect" and you're sure that you're looking at the right device node then you probably do need to patch your kernel.

  3. Get your source tree. Full instructions for getting, preparing and building for Fedora and Ubuntu can be found at the following locations. Other distributions should have similar pages.

    There is no need to build the full kernel, just get and prepare the source. The aim is to only change two modules rather than install a full custom kernel. Read the documentation provided by your Linux distribution if you don't know how to do this already. The following steps prepare the source tree for building modules on recent versions of Ubuntu - your distribution may well need different steps:

    > cd wherever_the_source_was_put
    > cp /boot/config-`uname -r` .config
    > cp /usr/src/linux-headers-`uname -r`/Module.symvers .
    > make oldconfig scripts prepare

  4. Build the existing USB HID modules just to make sure everything's in place and set up correctly.
    > make SUBDIRS=drivers/hid modules

  5. Download and apply the patch. The latest patch is attached at the bottom of this page.
    > patch -p1 <swff2.patch

  6. Rebuild the changed modules.
    > make SUBDIRS=drivers/hid modules

  7. Test the new modules as root. THIS MAY MAKE YOUR MOUSE AND KEYBOARD STOP WORKING TEMPORARILY!
    # rmmod hid_generic usbhid hid; insmod drivers/hid/hid.ko; insmod drivers/hid/usbhid/usbhid.ko

    If you lose your mouse and keyboard then unplug one of them and plug it back in. Within a few seconds you should get them both back, because Linux will load the normal, unchanged driver modules. If not, reboot.

  8. Locate the device again (see step 1). It may have changed.

  9. Try "fftest" again (see step 2). You should now get "OK" responses to the "Uploading effect" and the effects will work when you start them.

  10. If you're absolutely, positively, 100% sure that it's all working including other USB devices, copy the new modules into place as root:
    # cp --parents drivers/hid/hid.ko drivers/hid/usbhid/usbhid.ko /lib/modules/`uname -r`/kernel/

  11. Update your boot image as root. This contains a second copy of the kernel modules and is used when you first boot. If you don't update this then you will still keep using the original, unchanged modules even though the new ones are in the correct place under /lib/modules/ .
    # update-initramfs -u

  12. Remember that if you update your kernel you may well need to run through this process again.


Attachments 
 
 swff2.patch (1.11 KB)
(362 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako Fusion