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>
This makes sure we e.g. prefer multicolor leds over single color ones
and those that can be on insuspend (qcom) over those that can't.
We can extend this to allow to set the priority via udev/hwdb in the
future.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
While in theory we could have themes with only freq = 0 values we
currently assume there can be patterns.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
We assume that multicolor LEDs are RGB so reject those that don't
have three components.
E.g. the Framework Laptop exposes a power button LED as multicolor
that only has a white component. This way it gets treated as single color LED.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
If lfb_init() wasn't called before lfb_uninit() we'd otherwise raise a
critical which isn't nice for a library.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
We switch `message-new-cellbroadcast` to VibraPeriodic as that is better
recognizable than the periodic pattern.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Lets start at zero when not specified otherwise and also set an
arbitrary fade-in-time as setting it to the duration isn't very helpful.
While at that move the defaults to the feedback rather than the device
so we ensure consistency over different device implementations.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Lets not artificially cap the magnitude in the device specific
implementation.
Since the default magnitude for the common rumble feedback was set to
0.5 in the previous commit the effective magnitude in existing themes
remains unchanged for that event.
The pattern feedbacks didn't make it into a release yet so there's
nothing that could get broken.
The change doubles the effective when using the Vibra DBus API but as it
seems that libmanette didn't land support yet lets just ignore that
here.
Periodic feedback is unaffected as it uses a different internal API.
Signed-off-by: Guido Günther <agx@sigxcpu.org>