1STRUCT FF_DEVICE(9) Input Subsystem STRUCT FF_DEVICE(9)
2
3
4
6 struct_ff_device - force-feedback part of an input device
7
9 struct ff_device {
10 int (* upload) (struct input_dev *dev, struct ff_effect *effect,struct ff_effect *old);
11 int (* erase) (struct input_dev *dev, int effect_id);
12 int (* playback) (struct input_dev *dev, int effect_id, int value);
13 void (* set_gain) (struct input_dev *dev, u16 gain);
14 void (* set_autocenter) (struct input_dev *dev, u16 magnitude);
15 void (* destroy) (struct ff_device *);
16 void * private;
17 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
18 struct mutex mutex;
19 int max_effects;
20 struct ff_effect * effects;
21 struct file * effect_owners[];
22 };
23
25 upload
26 Called to upload an new effect into device
27
28 erase
29 Called to erase an effect from device
30
31 playback
32 Called to request device to start playing specified effect
33
34 set_gain
35 Called to set specified gain
36
37 set_autocenter
38 Called to auto-center device
39
40 destroy
41 called by input core when parent input device is being destroyed
42
43 private
44 driver-specific data, will be freed automatically
45
46 ffbit[BITS_TO_LONGS(FF_CNT)]
47 bitmap of force feedback capabilities truly supported by device
48 (not emulated like ones in input_dev->ffbit)
49
50 mutex
51 mutex for serializing access to the device
52
53 max_effects
54 maximum number of effects supported by device
55
56 effects
57 pointer to an array of effects currently loaded into device
58
59 effect_owners[]
60 array of effect owners; when file handle owning an effect gets
61 closed the effect is automatically erased
62
64 Every force-feedback device must implement upload and playback methods;
65 erase is optional. set_gain and set_autocenter need only be
66 implemented if driver sets up FF_GAIN and FF_AUTOCENTER bits.
67
68 Note that playback, set_gain and set_autocenter are called with
69 dev->event_lock spinlock held and interrupts off and thus may not
70 sleep.
71
73Kernel Hackers Manual 3.10 June 2019 STRUCT FF_DEVICE(9)