---
name: "struct_ff_device"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/struct_ff_device"
---

# struct\_ff\_device(9)

force-feedback part of an input device

## NAME

struct\_ff\_device - force-feedback part of an input device

## SYNOPSIS

```
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[];
};
```

## MEMBERS

upload

Called to upload an new effect into device

erase

Called to erase an effect from device

playback

Called to request device to start playing specified effect

set\_gain

Called to set specified gain

set\_autocenter

Called to auto-center device

destroy

called by input core when parent input device is being destroyed

private

driver-specific data, will be freed automatically

ffbit\[BITS\_TO\_LONGS(FF\_CNT)\]

bitmap of force feedback capabilities truly supported by device (not emulated like ones in input\_dev-\>ffbit)

mutex

mutex for serializing access to the device

max\_effects

maximum number of effects supported by device

effects

pointer to an array of effects currently loaded into device

effect\_owners\[\]

array of effect owners; when file handle owning an effect gets closed the effect is automatically erased

## DESCRIPTION

Every force-feedback device must implement **upload** and **playback** methods; **erase** is optional. **set\_gain** and **set\_autocenter** need only be implemented if driver sets up FF\_GAIN and FF\_AUTOCENTER bits.

Note that **playback**, **set\_gain** and **set\_autocenter** are called with dev-\>event\_lock spinlock held and interrupts off and thus may not sleep.

## COPYRIGHT
