Commit Graph
8 Commits
Author SHA1 Message Date
Guido Günther ee8a9dd553 vibra-pattern: Don't overwrite magnitudes
When determining the value for the rumble we assigned the result to the
value in the array thus potentially overwriting the value from the theme.

This goes unnoticed as long as we don't lower the global `max_strength`
below the magnitude. But when we e.g. set the `max_strength` to
zero the device will fail to rumble when we increase `max_strength`
later on again.

Steps to reproduce:

  - Use an event that used `VibraRumble`, e.g. `button-press`
    in the oneplus,fajita device theme
  - `fbcli -E button-pressed` -> works
  - set haptic feedback to 0%:
    `gsettings set org.sigxcpu.feedbackd max-haptic-strength 0.0`
  - set it back to 100%:
    `gsettings set org.sigxcpu.feedbackd max-haptic-strength 1.0`
  - `fbcli -E button-pressed` -> no feedback

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-09 19:37:41 +00:00
Guido Günther 32cf0758d2 vibra: Some style and comment fixes
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-09 19:37:41 +00:00
Guido Günther cc02a4d48a vibra-pattern: Honor max haptic strength
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-09 12:28:08 +01:00
Guido Günther 7b19feb25f fbd-feedback-vibra-pattern: Deserialize properties
This allows us to use them in feedback themes

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-06 11:00:04 +01:00
Guido Günther 54060b4e38 vibra-pattern: End pending vibra when a new one is triggered
This wasn't much of an issue for the DBus API but when using
it as event feedback it matters as we might start the new
feedback just before the old one ended due to timers being
slighlty late.
2025-03-06 10:57:37 +01:00
Guido Günther e92df04e80 vibra-pattern: Check for NULL dev
When running e.g. in the theme validator we might not have a vibra dev.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-06 10:57:37 +01:00
Guido Günther 88dd60413e vibra-pattern: Reset pos when done
This allows to reuse the feedback.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-06 10:57:37 +01:00
Guido Günther 9cebb2c081 feedback-vibra: Add support for patterns
Add a new class that takes an array of durations and magnitudes.
A magnitude of 0 indicates a pause.

We can consider dropping the VibraRumble class at some point as that
is a special case of VibraPeriodic now however as the feedbacks are
encoded in the themes let's make sure VibraPattern is good API before
deprecating VibraRumble.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-12-15 18:35:58 +01:00