<commit_before>Force feedback for Linux.
By <NAME> <<EMAIL>> on 2001/04/22.
Updated by <NAME> <<EMAIL>> on 2006/04/09.
You may redistribute this file. Please remember to include shape.fig and
interactive.fig as well.
----------------------------------------------------------------------------

1. Introduction
~~~~~~~~~~~~~~~
This document describes how to use force feedback devices under Linux. The
goal is not to support these devices as if they were simple input-only devices
(as it is already the case), but to really enable the rendering of force
effects.
This document only describes the force feedback part of the Linux input
interface. Please read joystick.txt and input.txt before reading further this
document.

2. Instructions to the user
~~~~~~~~~~~~~~~~~~~~~~~~~~~
To enable force feedback, you have to:

1. have your kernel configured with evdev and a driver that supports your
   device.
2. make sure evdev module is loaded and /dev/input/event* device files are
   created.

Before you start, let me WARN you that some devices shake violently during the
initialisation phase. This happens for example with my "AVB Top Shot Pegasus".
To stop this annoying behaviour, move you joystick to its limits. Anyway, you
should keep a hand on your device, in order to avoid it to break down if
something goes wrong.

If you have a serial iforce device, you need to start inputattach. See
joystick.txt for details.

2.1 Does it work ?
~~~~~~~~~~~~~~~~~~
There is an utility called fftest that will allow you to test the driver.
% fftest /dev/input/eventXX

3. Instructions to the developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All interactions are done using the event API. That is, you can use ioctl()
and write() on /dev/input/eventXX.
This information is subject to change.

3.1 Querying device capabilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <linux/input.h>
#include <sys/ioctl.h>

unsigned long features[1 + FF_MAX/sizeof(unsigned long)];
int ioctl(int file_descriptor, int request, unsigned long *features);

"request" must be EVIOCGBIT(EV_FF, size of features array in bytes )

Returns the features supported by the device. features is a bitfield with the
following bits:
- FF_CONSTANT	can render constant force effects
- FF_PERIODIC	can render periodic effects with the following waveforms:
  - FF_SQUARE	  square waveform<commit_msg>Input: fix force feedback capability query example<commit_after>Force feedback for Linux.
By <NAME> <<EMAIL>> on 2001/04/22.
Updated by <NAME> <<EMAIL>> on 2006/04/09.
You may redistribute this file. Please remember to include shape.fig and
interactive.fig as well.
----------------------------------------------------------------------------

1. Introduction
~~~~~~~~~~~~~~~
This document describes how to use force feedback devices under Linux. The
goal is not to support these devices as if they were simple input-only devices
(as it is already the case), but to really enable the rendering of force
effects.
This document only describes the force feedback part of the Linux input
interface. Please read joystick.txt and input.txt before reading further this
document.

2. Instructions to the user
~~~~~~~~~~~~~~~~~~~~~~~~~~~
To enable force feedback, you have to:

1. have your kernel configured with evdev and a driver that supports your
   device.
2. make sure evdev module is loaded and /dev/input/event* device files are
   created.

Before you start, let me WARN you that some devices shake violently during the
initialisation phase. This happens for example with my "AVB Top Shot Pegasus".
To stop this annoying behaviour, move you joystick to its limits. Anyway, you
should keep a hand on your device, in order to avoid it to break down if
something goes wrong.

If you have a serial iforce device, you need to start inputattach. See
joystick.txt for details.

2.1 Does it work ?
~~~~~~~~~~~~~~~~~~
There is an utility called fftest that will allow you to test the driver.
% fftest /dev/input/eventXX

3. Instructions to the developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All interactions are done using the event API. That is, you can use ioctl()
and write() on /dev/input/eventXX.
This information is subject to change.

3.1 Querying device capabilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <linux/input.h>
#include <sys/ioctl.h>

#define BITS_TO_LONGS(x) \
	(((x) + 8 * sizeof (unsigned long) - 1) / (8 * sizeof (unsigned long)))
unsigned long features[BITS_TO_LONGS(FF_CNT)];
int ioctl(int file_descriptor, int request, unsigned long *features);

"request" must be EVIOCGBIT(EV_FF, size of features array in bytes )

Returns the features supported by the device. features is a bitfield with the
following bits:
- FF_CONSTANT	can render constant force effects
- FF_PERIODIC	can render periodic effects with the following waveforms:
  - FF_SQUARE	  square waveform
{'fraction_non_alphanumeric': 0.1353476821192053, 'fraction_numerical': 0.011175496688741722, 'mean_word_length': 3.847542627883651, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6687435', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1228, 'n_words': 657}