<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="Linux Device Drivers" /><link rel="up" href="ch08.html" title="Chapter 8. Input Subsystem" /><link rel="prev" href="re705.html" title="struct input_handle" /><link rel="next" href="re707.html" title="input_event" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>struct ff_device</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re705.html">Prev</a> </td><th width="60%" align="center">Chapter 8. Input Subsystem</th><td width="20%" align="right"> <a accesskey="n" href="re707.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="struct ff_device"><a id="API-struct-ff-device"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct ff_device — force-feedback part of an input device </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><pre class="programlisting"> struct ff_device { int (* upload) (struct input_dev *dev, struct ff_effect *effect,struct ff_effect *old); int (* erase) (struct input_dev *dev, int effect_id); int (* playback) (struct input_dev *dev, int effect_id, int value); void (* set_gain) (struct input_dev *dev, u16 gain); void (* set_autocenter) (struct input_dev *dev, u16 magnitude); void (* destroy) (struct ff_device *); void * private; unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; struct mutex mutex; int max_effects; struct ff_effect * effects; struct file * effect_owners[]; }; </pre></div><div class="refsect1" title="Members"><a id="id2699418"></a><h2>Members</h2><div class="variablelist"><dl><dt><span class="term">upload</span></dt><dd><p> Called to upload an new effect into device </p></dd><dt><span class="term">erase</span></dt><dd><p> Called to erase an effect from device </p></dd><dt><span class="term">playback</span></dt><dd><p> Called to request device to start playing specified effect </p></dd><dt><span class="term">set_gain</span></dt><dd><p> Called to set specified gain </p></dd><dt><span class="term">set_autocenter</span></dt><dd><p> Called to auto-center device </p></dd><dt><span class="term">destroy</span></dt><dd><p> called by input core when parent input device is being destroyed </p></dd><dt><span class="term">private</span></dt><dd><p> driver-specific data, will be freed automatically </p></dd><dt><span class="term">ffbit[BITS_TO_LONGS(FF_CNT)]</span></dt><dd><p> bitmap of force feedback capabilities truly supported by device (not emulated like ones in input_dev->ffbit) </p></dd><dt><span class="term">mutex</span></dt><dd><p> mutex for serializing access to the device </p></dd><dt><span class="term">max_effects</span></dt><dd><p> maximum number of effects supported by device </p></dd><dt><span class="term">effects</span></dt><dd><p> pointer to an array of effects currently loaded into device </p></dd><dt><span class="term">effect_owners[]</span></dt><dd><p> array of effect owners; when file handle owning an effect gets closed the effect is automatically erased </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2699577"></a><h2>Description</h2><p> Every force-feedback device must implement <code class="function">upload</code> and <code class="function">playback</code> methods; <code class="function">erase</code> is optional. <code class="function">set_gain</code> and <code class="function">set_autocenter</code> need only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER bits. </p><p> Note that <code class="function">playback</code>, <code class="function">set_gain</code> and <code class="function">set_autocenter</code> are called with dev->event_lock spinlock held and interrupts off and thus may not sleep. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re705.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch08.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re707.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>struct input_handle</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>input_event</span></td></tr></table></div></body></html>