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.
Try first the QCOM hardware LED types which require the most features of
LED drivers. Try until we have a single color GPIO LED which is the
minimal LED driver support we require. If the LED does not meet that
expectation either, we ignore the LED.
QCOM LPG LEDs can also operate in a multicolor fashion.
Re-use the probing sequence of multicolor LEDs and the hw_pattern
configuration of single color QCOM LPG LEDs.
QCOM LPG LEDs expose a hw_pattern sysfs entry which accepts a limited
set of patterns but allows to use dedicated hardware for blinking the
LED. This way, battery life can be improved and the LED still blinks,
even if the device is suspended.
Provide our own supports_color method to specify which colors are
actually implemented by the driver. RGB LEDs could provide different
colors as well such as orange, purple, etc. but those are not supported
yet.
Drop has_color API since supported colors are set during probing
and can be handled completely separately from the classes for
each type of hardware.
Rename set_color to set_supported_color because the usage
of this API is to check if the color is supported, but not
setting it. Setting the color is also separated from
start_periodic API to re-use multicolor across multiple LED types
with a set_color API. Multicolor LEDs are actually the same as
regular LEDs but they require a few additional sysfs entries to
actually set the color. Single color LEDs only have a single color
so the set_color method just returns TRUE for these LEDs.
Supported colors are advertised through the supports_color API now.
This way, each LED driver define which colors are supported
through supports_color API. RGB multicolor LEDs will report only fixed colors
like red, blue, green and white until the kernel can expose if a diffusor
is present to mix these colors.