STRUCT FF_ENVELOPE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct ff_envelope(9) πŸ’–

okay so this is straight out of the Kernel API Manual, section 9, and it's literally the blueprint for making your controller shake with drama β€” it's the generic force-feedback effect envelope, no cap πŸŽ€


✨ NAME ✨

struct ff_envelope β€” the generic force-feedback effect envelope, bestie. it's the thing that decides how hard your rumble starts and how gently it fades out πŸ’…


🌸 SYNOPSIS 🌸

struct ff_envelope {
    __u16 attack_length;
    __u16 attack_level;
    __u16 fade_length;
    __u16 fade_level;
 };

like, four little fields. four. and they control the whole ~emotional arc~ of your vibration. iconic πŸ¦‹


πŸŽ€ Members πŸŽ€

  • attack_length β€” how long the attack lasts, in ms. it's giving "the buildup" ✨
  • attack_level β€” the level right at the beginning of the attack. the opening number, the main character entrance πŸ‘‘
  • fade_length β€” duration of the fade, in ms. the slow, graceful exit 🌈
  • fade_level β€” the level at the end of the fade. where it all lands πŸ“

πŸ’œ Description πŸ’œ

okay this is the important bit so pay attention bestie 🫢

attack_level and fade_level are absolute values. when the envelope is actually being applied, the force-feedback core converts them into a positive/negative value β€” and it does that based on the polarity of the default level of the effect. so like, the core does the math, you just hand it the magnitude ✨

the valid range for the attack and fade levels is 0x0000 - 0x7fff. that's it. that's the range. don't go outside it πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

kernel file ./include/uapi/linux/input.h, plus the whole friend group:

  • struct input_absinfo(9)
  • struct input_keymap_entry(9)
  • EVIOCGMTSLOTS(9)
  • EVIOCGMASK(9)
  • EVIOCSMASK(9)
  • struct ff_replay(9)
  • struct ff_trigger(9)
  • struct ff_constant_effect(9)
  • struct ff_ramp_effect(9)
  • struct ff_condition_effect(9)
  • struct ff_periodic_effect(9)
  • struct ff_rumble_effect(9)
  • struct ff_haptic_effect(9)
  • struct ff_effect(9)

fr fr go read struct ff_effect(9) next, it's the parent friend of this whole situation πŸ’€

and that's the whole page, bestie! it lives at ./include/uapi/linux, dated October 2026 β€” so yeah, it's from the future and it still slays πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from