The carefree developer might try running meson test
before meson compile, leaving them with a failing integration test:
Start of lfb-integration tests
dbus-daemon[326641]: [session uid=1000 pid=326641 pidfd=8] Activating service name='org.sigxcpu.Feedback' requested by ':1.0' (uid=1000 pid=326640 comm="$(pwd)/_build/tests/te")
+ exec $(pwd)/_build/src/feedbackd
$(pwd)/_build/run: 18: exec: $(pwd)/_build/src/feedbackd: not found
Signed-off-by: Evangelos Ribeiro Tzaras <devrtz@fortysixandtwo.eu>
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.
If a custom sound is provided for the event, use that instead of the one
from the theme. We always add the sound event, even when the theme
doesn't have sound feedback for that event honoring the users choice.
Closes: https://source.puri.sm/Librem5/feedbackd/-/merge_requests/150
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Just check the elements on the event list. This makes it easier to
extend as we can't forget to toggle the variable.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
To trigger a 200ms rumble at 100%, a 50ms pause and a 300ms rumble at 50%:
busctl call --user org.sigxcpu.Feedback /org/sigxcpu/Feedback org.sigxcpu.Feedback.Haptic Vibrate 'sa(du)' org.foo.app 3 1.0 200 0.0 50 0.5 300
To cancel an ongoing pattern:
busctl call --user org.sigxcpu.Feedback /org/sigxcpu/Feedback org.sigxcpu.Feedback.Haptic Vibrate 'sa(du)' org.foo.app 0
The API has lower priority than the event based API to e.g. not miss
incoming phone calls or cell broadast messages.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
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>
This allows the derived classes to perform the length duration
calculation. The parent class can thus still keep track of the total
feedback length.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
This just gives odd vibration. Later on we should use priorities to
allow for higher priority events like phone calls to override lower
priority events like e.g. button presses. This is similar to how we want
to handle LED patterns.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
This tracks the alert slider on OnePlus 6/6T devices
and adjusts the profile level accordingly.
This is based on a script by "isyourbrain foss" in the Phosh matrix
channel.
If the feedback is in our list of feedbacks disconnect signals
and drop the reference we hold.
As we have removed the signal handler that would invoke `check_ended()`
we invoke this manually when the list becomes empty.
Camera flashes are also exported via the LED subsystem. We use a
separate LED type so they're not picked by default.
We don't use them as fallbacks either.
So far we didn't create any FbdDevLeds if there wasn't at least one
usable LED. Once we introduce flash LEDs we might probe the LED but the
LED might not be usable as the user hasn't enabled using it. Prepare for
that scenario.
The FbdDevLedColor enum defines the hardware color of the LED. We used
it for the feedbacks color value as long as the kernel mostly had
single color LEDs. As multicolor LEDs are common nowadays switch the
color to a string which will allow us to use RGB values later on.