R761's commentary

8 January 2009

Force Feedback on Linux with a Logitech momo wheel, part 2

Filed under: Games, Linux, Ubuntu — r761 @ 6:28 pm

Force feedback does work with 2.6.28. Here’s what evtest has to say when running 2.6.28:

evtest /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick
Input driver version is 1.0.0
Input device ID: bus 0x3 vendor 0x46d product 0xca03 version 0x100
Input device name: "Logitech Logitech MOMO Racing "
Supported events:
Event type 0 (Reset)
Event code 0 (Reset)
Event code 1 (Key)
Event code 3 (Absolute)
Event code 4 (?)
Event code 21 (ForceFeedback)
Event type 1 (Key)
Event code 288 (Trigger)
Event code 289 (ThumbBtn)
Event code 290 (ThumbBtn2)
Event code 291 (TopBtn)
Event code 292 (TopBtn2)
Event code 293 (PinkieBtn)
Event code 294 (BaseBtn)
Event code 295 (BaseBtn2)
Event code 296 (BaseBtn3)
Event code 297 (BaseBtn4)
Event type 3 (Absolute)
Event code 0 (X)
Value 0
Min 0
Max 1023
Fuzz 3
Flat 63
Event code 1 (Y)
Value 0
Min 0
Max 255
Flat 15
Event type 4 (?)
Event code 4 (?)
Event type 21 (ForceFeedback)
Event code 82 (?)
Event code 96 (?)
Event code 97 (?)
Testing ... (interrupt to exit)
Event: time 1231403438.348166, type 3 (Absolute), code 0 (X), value 56
Event: time 1231403438.348183, type 0 (Reset), code 0 (Reset), value 0
Event: time 1231403438.356172, type 3 (Absolute), code 0 (X), value 516
Event: time 1231403438.356190, type 3 (Absolute), code 1 (Y), value 127
Event: time 1231403438.356192, type 0 (Reset), code 0 (Reset), value 0
^C

Note the addition (after kernel upgrade) of “Event code 21 (ForceFeedback)”. fftest only acknowledges one type of event:

./fftest /dev/input/event4
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES

Device /dev/input/event4 opened
Axes query:
Effects: Constant
Number of simultaneous effects: 16
Upload effects[0]: Invalid argument
Upload effects[2]: Invalid argument
Upload effects[3]: Invalid argument
Upload effects[4]: Invalid argument
Upload effects[5]: Invalid argument
Enter effect number, -1 to exit
0
Now Playing: Sine vibration
Enter effect number, -1 to exit
1
Now Playing: Constant Force
Enter effect number, -1 to exit
2
Now Playing: Spring Condition
Enter effect number, -1 to exit
3
Now Playing: Damping Condition
Enter effect number, -1 to exit
4
Now Playing: Strong Rumble
Enter effect number, -1 to exit
5
Now Playing: Weak Rumble
Enter effect number, -1 to exit
6
No such effect
Enter effect number, -1 to exit
-1
No such effect

None of these effects make a noticeable difference to the wheel. The force feedback device is normally /dev/input/event4, though this changes occasionally between plugins. /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick is a symbolic link to the device (usually to ../event4). Most commands appear to work with either the link, or the actual device. fftest only works with the device (event4), and will fail to run if the link is specified. By default /dev/input/event4 is only accessible by root. The simple, one off fix, is to run

sudo chgrp plugdev /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick

This can be made permanent with the help of udev rules. Here’s what my /etc/udev/rules.d/80-logitech-mom-wheel.rules looks like now:

ACTION!="add", GOTO="event_end"
SUBSYSTEM!="input", GOTO="event_end"

KERNEL!="js[0-9]*", GOTO="js_end"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/logger udev Logitech momo wheel: running jscal"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/jscal -s 2,1,0,507,507,1058885,1044464,1,0,127,127,4227201,4194176 $tempnode"
LABEL="js_end"

KERNEL!="event[0-9], GOTO="event_end"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", RUN+="/usr/bin/logger udev Logitech momo wheel: setting feedback group"
SYSFS{idProduct}=="ca03", SYSFS{idVendor}=="046d", GROUP="plugdev"
LABEL="event_end"

According to the output in syslog (from the logger command) the group is set 3 times. From what I can tell by watching debug statements in udev rules, the momo wheel is 8 different devices (a joystick, a force feedback device, and I’m not sure what the others are). The auto-centre feedback force can be set with the ffset command:

ffset -a 100 /dev/input/event4

Will make the wheel harder to turn away from the centre. When released it will return to the centre quickly.

ffset -a 20 /dev/input/event4

Will make the wheel easier to turn. It will also return to centre more slowly. What Linux games support force feedback? The only one I know of is vdrift. To get vdrift working make sure the permissions are set (see above) and then edit the [ joystick ] section of ~/.vdrift/VDrivf.config to look like:

[ joystick ]
calibrated = off
deadzone = off
ff_device = /dev/input/by-id/usb-Logitech_Logitech_MOMO_Racing-event-joystick
ff_gain = 1.500000
ff_invert = off
selected_index = 0
touchcomp = off
two_hundred = on
type = wheel

That’s it – you are now ready to enjoy vdrift with force feedback.

Advertisements

3 Comments »

  1. What Linux games support force feedback? The only one I know of is vdrift.

    If you include “rumble” as “force feedback,” then Word War vi and Be The Wumpus are two games (well, Be The Wumpus is only _barely_ a game) that can use the xbox 360 controller’s rumble feature. Full disclosure, I’m the author of both of those.

    Comment by scaryreasoner — 9 January 2009 @ 11:56 am

  2. Word Wav vi makes an interesting game when played with a wheel. I can see it was designed with a joystick in mind.

    It appears that my wheel doesn’t support the rumble effects (which is consistent with the command line output in the original post).

    bash> wordwarvi
    bt_audio_service_open: connect() failed: Connection refused (111)
    bt_audio_service_open: connect() failed: Connection refused (111)
    Portaudio reports 14 sound devices.
    Portaudio says the default device is: 0
    Decoding audio data…done.
    Device /dev/input/event4 opened
    Axes query:
    Effects: Constant
    Number of simultaneous effects: 16
    /dev/input/event4: failed to upload sine effect: Invalid argument
    /dev/input/event4: failed to upload strong rumbling effect: Invalid argument
    /dev/input/event4: failed to upload weak rumbling effect: Invalid argument

    Comment by r761 — 10 January 2009 @ 11:49 am

  3. Hi,

    Did you test your Momo with ffcfstress? (also from ff-utils)

    I noticed my wheel is only turning to left, but using Windows test program it is working fine.

    It is really strange, maybe some issue in the driver or ffcfstress …

    I’m using Ubuntu 10.04. I’ll be glad if you could test it and tell me your results.

    BR,

    Alan

    Comment by acassis — 13 February 2011 @ 6:37 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: