1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct ff_device</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="input_subsystem.html#idp1114168316" title="Input core"><link rel="prev" href="API-input-set-events-per-packet.html" title="input_set_events_per_packet"><link rel="next" href="API-input-event.html" title="input_event"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct ff_device</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-input-set-events-per-packet.html">Prev</a>&#160;</td><th width="60%" align="center">Input core</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-input-event.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-ff-device"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct ff_device &#8212; 
2     force-feedback part of an input device
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct ff_device {
5  int (* upload) (struct input_dev *dev, struct ff_effect *effect,struct ff_effect *old);
6  int (* erase) (struct input_dev *dev, int effect_id);
7  int (* playback) (struct input_dev *dev, int effect_id, int value);
8  void (* set_gain) (struct input_dev *dev, u16 gain);
9  void (* set_autocenter) (struct input_dev *dev, u16 magnitude);
10  void (* destroy) (struct ff_device *);
11  void * private;
12  unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
13  struct mutex mutex;
14  int max_effects;
15  struct ff_effect * effects;
16  struct file * effect_owners[];
17};  </pre></div><div class="refsect1"><a name="idp1114263812"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">upload</span></dt><dd><p>
18   Called to upload an new effect into device
19      </p></dd><dt><span class="term">erase</span></dt><dd><p>
20   Called to erase an effect from device
21      </p></dd><dt><span class="term">playback</span></dt><dd><p>
22   Called to request device to start playing specified effect
23      </p></dd><dt><span class="term">set_gain</span></dt><dd><p>
24   Called to set specified gain
25      </p></dd><dt><span class="term">set_autocenter</span></dt><dd><p>
26   Called to auto-center device
27      </p></dd><dt><span class="term">destroy</span></dt><dd><p>
28   called by input core when parent input device is being
29   destroyed
30      </p></dd><dt><span class="term">private</span></dt><dd><p>
31   driver-specific data, will be freed automatically
32      </p></dd><dt><span class="term">ffbit[BITS_TO_LONGS(FF_CNT)]</span></dt><dd><p>
33   bitmap of force feedback capabilities truly supported by
34   device (not emulated like ones in input_dev-&gt;ffbit)
35      </p></dd><dt><span class="term">mutex</span></dt><dd><p>
36   mutex for serializing access to the device
37      </p></dd><dt><span class="term">max_effects</span></dt><dd><p>
38   maximum number of effects supported by device
39      </p></dd><dt><span class="term">effects</span></dt><dd><p>
40   pointer to an array of effects currently loaded into device
41      </p></dd><dt><span class="term">effect_owners[]</span></dt><dd><p>
42   array of effect owners; when file handle owning
43   an effect gets closed the effect is automatically erased
44      </p></dd></dl></div></div><div class="refsect1"><a name="idp1114273332"></a><h2>Description</h2><p>
45   Every force-feedback device must implement <code class="function">upload</code> and <code class="function">playback</code>
46   methods; <code class="function">erase</code> is optional. <code class="function">set_gain</code> and <code class="function">set_autocenter</code> need
47   only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
48   bits.
49   </p><p>
50
51   Note that <code class="function">playback</code>, <code class="function">set_gain</code> and <code class="function">set_autocenter</code> are called with
52   dev-&gt;event_lock spinlock held and interrupts off and thus may not
53   sleep.
54</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-input-set-events-per-packet.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="input_subsystem.html#idp1114168316">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-input-event.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">input_set_events_per_packet</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">input_event</span></td></tr></table></div></body></html>
55