^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Force feedback for Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) :Author: Johann Deneux <johann.deneux@gmail.com> on 2001/04/22.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) :Updated: Anssi Hannula <anssi.hannula@gmail.com> on 2006/04/09.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) You may redistribute this file. Please remember to include shape.svg and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) interactive.svg as well.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) ~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) This document describes how to use force feedback devices under Linux. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) goal is not to support these devices as if they were simple input-only devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) (as it is already the case), but to really enable the rendering of force
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) effects.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) This document only describes the force feedback part of the Linux input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) interface. Please read joystick.txt and input.txt before reading further this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) document.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Instructions to the user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) ~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) To enable force feedback, you have to:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 1. have your kernel configured with evdev and a driver that supports your
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 2. make sure evdev module is loaded and /dev/input/event* device files are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) created.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Before you start, let me WARN you that some devices shake violently during the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) initialisation phase. This happens for example with my "AVB Top Shot Pegasus".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) To stop this annoying behaviour, move your joystick to its limits. Anyway, you
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) should keep a hand on your device, in order to avoid it to break down if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) something goes wrong.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) If you have a serial iforce device, you need to start inputattach. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) joystick.txt for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) Does it work ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) There is an utility called fftest that will allow you to test the driver::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) % fftest /dev/input/eventXX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) Instructions to the developer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) All interactions are done using the event API. That is, you can use ioctl()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) and write() on /dev/input/eventXX.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) This information is subject to change.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) Querying device capabilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #include <sys/ioctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define BITS_TO_LONGS(x) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) (((x) + 8 * sizeof (unsigned long) - 1) / (8 * sizeof (unsigned long)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) unsigned long features[BITS_TO_LONGS(FF_CNT)];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) int ioctl(int file_descriptor, int request, unsigned long *features);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) "request" must be EVIOCGBIT(EV_FF, size of features array in bytes )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) Returns the features supported by the device. features is a bitfield with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) following bits:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) - FF_CONSTANT can render constant force effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) - FF_PERIODIC can render periodic effects with the following waveforms:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) - FF_SQUARE square waveform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) - FF_TRIANGLE triangle waveform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) - FF_SINE sine waveform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) - FF_SAW_UP sawtooth up waveform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) - FF_SAW_DOWN sawtooth down waveform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) - FF_CUSTOM custom waveform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) - FF_RAMP can render ramp effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) - FF_SPRING can simulate the presence of a spring
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) - FF_FRICTION can simulate friction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) - FF_DAMPER can simulate damper effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) - FF_RUMBLE rumble effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) - FF_INERTIA can simulate inertia
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) - FF_GAIN gain is adjustable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) - FF_AUTOCENTER autocenter is adjustable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) - In most cases you should use FF_PERIODIC instead of FF_RUMBLE. All
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) devices that support FF_RUMBLE support FF_PERIODIC (square, triangle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) sine) and the other way around.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) - The exact syntax FF_CUSTOM is undefined for the time being as no driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) supports it yet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int ioctl(int fd, EVIOCGEFFECTS, int *n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) Returns the number of effects the device can keep in its memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) Uploading effects to the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #include <sys/ioctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) int ioctl(int file_descriptor, int request, struct ff_effect *effect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) "request" must be EVIOCSFF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) "effect" points to a structure describing the effect to upload. The effect is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) uploaded, but not played.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) The content of effect may be modified. In particular, its field "id" is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) to the unique id assigned by the driver. This data is required for performing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) some operations (removing an effect, controlling the playback).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) The "id" field must be set to -1 by the user in order to tell the driver to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) allocate a new effect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) Effects are file descriptor specific.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) See <uapi/linux/input.h> for a description of the ff_effect struct. You
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) should also find help in a few sketches, contained in files shape.svg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) and interactive.svg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) .. kernel-figure:: shape.svg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) Shape
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) .. kernel-figure:: interactive.svg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) Interactive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) Removing an effect from the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) ----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int ioctl(int fd, EVIOCRMFF, effect.id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) This makes room for new effects in the device's memory. Note that this also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) stops the effect if it was playing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) Controlling the playback of effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) -----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) Control of playing is done with write(). Below is an example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct input_event play;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct input_event stop;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct ff_effect effect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) int fd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) fd = open("/dev/input/eventXX", O_RDWR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /* Play three times */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) play.type = EV_FF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) play.code = effect.id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) play.value = 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) write(fd, (const void*) &play, sizeof(play));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /* Stop an effect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) stop.type = EV_FF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) stop.code = effect.id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) stop.value = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) write(fd, (const void*) &stop, sizeof(stop));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) Setting the gain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) Not all devices have the same strength. Therefore, users should set a gain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) factor depending on how strong they want effects to be. This setting is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) persistent across access to the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /* Set the gain of the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) int gain; /* between 0 and 100 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct input_event ie; /* structure used to communicate with the driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ie.type = EV_FF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) ie.code = FF_GAIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ie.value = 0xFFFFUL * gain / 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (write(fd, &ie, sizeof(ie)) == -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) perror("set gain");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) Enabling/Disabling autocenter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) -----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) The autocenter feature quite disturbs the rendering of effects in my opinion,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) and I think it should be an effect, which computation depends on the game
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) type. But you can enable it if you want.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int autocenter; /* between 0 and 100 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct input_event ie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) ie.type = EV_FF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ie.code = FF_AUTOCENTER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) ie.value = 0xFFFFUL * autocenter / 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (write(fd, &ie, sizeof(ie)) == -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) perror("set auto-center");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) A value of 0 means "no auto-center".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) Dynamic update of an effect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ---------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) Proceed as if you wanted to upload a new effect, except that instead of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) setting the id field to -1, you set it to the wanted effect id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) Normally, the effect is not stopped and restarted. However, depending on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) type of device, not all parameters can be dynamically updated. For example,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) the direction of an effect cannot be updated with iforce devices. In this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) case, the driver stops the effect, up-load it, and restart it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) Therefore it is recommended to dynamically change direction while the effect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) is playing only when it is ok to restart the effect with a replay count of 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) Information about the status of effects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) ---------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) Every time the status of an effect is changed, an event is sent. The values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) and meanings of the fields of the event are as follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) struct input_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) /* When the status of the effect changed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct timeval time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /* Set to EV_FF_STATUS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) unsigned short type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /* Contains the id of the effect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) unsigned short code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /* Indicates the status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) unsigned int value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) FF_STATUS_STOPPED The effect stopped playing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) FF_STATUS_PLAYING The effect started to play
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) - Status feedback is only supported by iforce driver. If you have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) a really good reason to use this, please contact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) linux-joystick@atrey.karlin.mff.cuni.cz or anssi.hannula@gmail.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) so that support for it can be added to the rest of the drivers.