Commit Graph
185 Commits
Author SHA1 Message Date
Guido Günther e782032efd tests: Drop unused variable 2022-10-12 10:19:03 +02:00
Guido Günther 14f99d6e67 lfb-event: Untabify 2022-10-12 10:19:03 +02:00
Guido Günther dafb18678b Use g_error() when library is not initalized
This makes sure it still works when asserts are disabled.
2022-10-12 10:19:03 +02:00
Guido Günther 8df5d1606e lfb-event: Use consistent prefix
Make async data use the same prefix.
2022-10-12 10:18:59 +02:00
Guido Günther c659f0adb5 lfb-event: Fix typo
It's LfbEvent
2022-10-12 10:13:08 +02:00
Evangelos Ribeiro Tzaras 7391062b87 lfb-event: Notify state change before completing async task
lfb_event_trigger_feedback_async() internally uses a GTask to handle
invocation of the user provided callback when g_task_return_*() is
called.

Currently GTask is completed first and only afterwards is the state of
the event being updated which can lead to suprising behaviour in code
like this:

static void
on_event_triggered (LfbEvent     *event,
                    GAsyncResult *res,
                    CallsRinger  *self)
{
  g_autoptr (GError) err = NULL;
  gboolean ok;

  g_return_if_fail (LFB_IS_EVENT (event));

  ok = lfb_event_trigger_feedback_finish (event, res, &err);
  if (ok) {
    LfbEventState state = lfb_event_get_state (event);
    /* do something with state */
  }
}

In this case `state` would return a stale value that's about to get
changed. Instead it would be better to *first* change the state and only
afterwards complete the GTask.

This also makes the sync and async variants consistent in terms of when
they change the event state.

Closes: #59
2022-10-11 12:32:43 +02:00
Evangelos Ribeiro Tzaras 21399aec6e test-lfb-integration: Test event state in async callback 2022-10-11 12:32:26 +02:00
Evangelos Ribeiro Tzaras ad7aa5d1b0 lfb-event: Fix SPDX identifier
The library is LGPL-2.1+, not GPL-3.0+
2022-09-24 12:08:19 +02:00
Guido Günther 2e081602f6 data: Drop outdated comment
We use the hints since some time, see lfb_event_set_feedback_profile().
2022-07-20 18:32:47 +00:00
Evangelos Ribeiro Tzaras bdf4403b9d spec: Clarify feedback noisiness
The old wording could be interpreted as the feedback being discarded if
it's noisier than the currently selected profile which is not the case.

Also take the new per application settings into account.
2022-06-24 00:51:51 +02:00
Guido Günther 17c1c2aa24 Document changes and release 0.0.0+git20220209 2022-05-20 10:57:37 +02:00
Luca Weiss e16202eeb5 fbd-dev-leds: support for multicolor LEDs
Add support for multicolor LEDs as supported by the kernel.
Used by Qualcomm devices such as SHIFT 6mq, OnePlus 6, etc.

Documentation:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-class-led-multicolor

Co-Developed-by: Dylan Van Assche <me@dylanvanassche.be>
2022-05-17 20:04:23 +02:00
Dylan Van Assche 510f1b6d6e fbd-dev-leds: rename var to max_brightness_percentage
Improve readability of the code.
2022-05-17 20:02:58 +02:00
Dylan Van Assche 572a027fa6 fbd-dev-leds: use define for max_brightness
All other attributes use a define, let's do the same for max_brightness.
2022-05-17 20:02:51 +02:00
Guido Günther 5a3e501344 udev: Use more generic comment
Make it more obvious that this isn't device specific
2022-03-18 11:08:28 +01:00
Guido Günther 9851d3727f udev: Drop pre L5 pre 5.9 workaround
Not neeed in 2022.
2022-03-18 10:55:15 +01:00
Guido Günther 74b178a363 Document changes and release 0.0.0+git20220208 2022-02-08 11:30:40 +01:00
Guido Günther 16bf78b5a4 manager: Don't sync DBus profile property
This will happen in on_feedbackd_setting_changed() once the
profile was adjusted.
2022-02-04 19:03:00 +01:00
Guido Günther 5c8cbfca39 manager: Sync profile with setting on startup
On startup the GSetting is the relevant input for selecting the profle.

Closes: #52
2022-02-04 19:03:00 +01:00
Guido Günther 2be41ec0ef manager: Set initial profile to unknown
This makes sure we sync the profile with the DBus property after
fetching it from GSettings.
2022-02-04 19:03:00 +01:00
Guido Günther a7a123a0b7 tests: Remove unused variables 2022-02-04 19:03:00 +01:00
Guido Günther ff055cdb35 libfeedback: Remove unused variables 2022-02-04 19:03:00 +01:00
Evangelos Ribeiro Tzaras b2a8061cdc doc: Clarify that the timeout is in seconds 2021-10-29 18:00:02 +02:00
Evangelos Ribeiro Tzaras 5f28638eec fbd-event: Fix return value for fbd_event_get_sender 2021-10-29 17:56:28 +02:00
Evangelos Ribeiro Tzaras ce8118e920 lfb-event: Clarify docstring on lfb_event_set_feedback_profile 2021-10-29 17:52:56 +02:00
Pablo Correa Gómez 8e9bbd9d4c Reload theme on SIGHUP signal
Fixes #28

Allows for users/applications to request a theme reload
by sending SIGHUP signal to the daemon.
2021-10-19 14:24:04 +00:00
Guido Günther 753fff3e7a d/changelog: Bump changes line to a recent date too
It was still stuck at 2021-10-07. Fixup version too while at that.
2021-10-19 13:15:28 +02:00
Guido Günther d11ea0c555 Document changes and release 0.0.0+git20211018 2021-10-18 17:17:12 +02:00
Guido Günther 3a6b573d9b gitlab-ci: Switch to bullseye
Drop support for buster, this can be handled in downstream builds.
2021-10-18 17:16:12 +02:00
Guido Günther c88c6cfff5 fbd-dev-sound: Delay sending ended signal
Remove the feedback and the associated callback data before invoking the
callback (which then triggers FbdFeebackBased:ended) since we otherwise
remove the data from the currently playing sound from the hash table
instead of removing the data from the sound that just finished playing.

Call flow for a repeating sound before:

  on_sound_play_finished_callback()
    data->callback()
      fbd_feedback_get_ended()
        on_fb_ended()
          fbd_feedback_run()
            g_hash_table_insert(..., feedback, data)
            fbd_dev_sound_play()
              gsound_context_play_full() [async]
    g_hash_table_remove (..., data->feedback) <- removes wrong feedback

So (since the feedback is still the same but only the callback data
changes) we end up removing the data from the currently playing sound
from the hash table and any calls to fbd_dev_sound_stop() would fail
to find data and hence not cancel the playing sound.

Call flow for a repeating sound now:

  on_sound_play_finished_callback()
    g_hash_table_remove (..., data->feedback)
    data->callback()
      fbd_feedback_get_ended()
        on_fb_ended()
          fbd_feedback_run()
            g_hash_table_insert(..., feedback, data)
            fbd_dev_sound_play()
              gsound_context_play_full() [async]

So we remove the data of the currently playing sound before adding
the feedback to the hash table again. No ownership is transfered to
the hash table so no cleanusp need to be changed.

Closes: https://source.puri.sm/Librem5/feedbackd/-/issues/46
2021-10-15 15:12:55 +02:00
Guido Günther 05bd9ae0cb fbd-dev-sounce: Name data consistently
We name it `data` elsewhere. Don't call it `object` in one function.
2021-10-15 15:10:31 +02:00
Guido Günther 48c05be29d fbd-dev-sound: Rename cancellable to cancel
The current name is just confusing
2021-10-15 15:10:31 +02:00
Pablo Correa Gómez f13c7484bf README: dbus calls not usable to trigger feedback
Fixes #45
2021-10-15 13:06:59 +02:00
Pablo Correa Gómez fe0036e339 Fix typos in documentation 2021-10-14 02:06:39 +02:00
Evangelos Ribeiro Tzaras 82a5eceec3 naming-spec: Document newly added phone-* events 2021-10-08 14:12:42 +00:00
Evangelos Ribeiro Tzaras b3d6a0d6f6 naming-spec: Fix upper cases, whitespaces and punctuation. 2021-10-08 14:12:42 +00:00
Evangelos Ribeiro Tzaras 5a439107bc feedback-theme: Add phone-outgoing-busy event
Named after the corresponding notification from the sound naming spec:
http://0pointer.de/public/sound-naming-spec.html
2021-10-08 14:12:42 +00:00
Evangelos Ribeiro Tzaras 48892de89a feedback-theme: Add phone-failure event
Named after the corresponding notification from the sound naming spec:
http://0pointer.de/public/sound-naming-spec.html
2021-10-08 14:12:42 +00:00
Evangelos Ribeiro Tzaras c783918f5b feedback-theme: Add phone-hangup event
Named after the corresponding notification from the sound naming spec:
http://0pointer.de/public/sound-naming-spec.html
2021-10-08 14:12:42 +00:00
Evangelos Ribeiro Tzaras 8e24ead69d d/control: Add json-glib-tools as build dependency
This will make sure that the json theme file gets validated in CI.
2021-10-07 18:52:11 +02:00
Guido Günther 83ba584a53 feedback-theme: Add camera related events 2021-09-06 12:49:41 +02:00
Guido Günther 587cbf3188 cli: Fix changing global profile
For that we must not set a default event.
2021-08-09 11:49:30 +02:00
Guido Günther 3503fe0293 docs: Fix --profile short option
It's '-P', not '-p'.
2021-08-09 11:46:30 +02:00
Guido Günther 4f5d3cc253 examples: Unbreak python example
The method is `trigger_feedback` not `trigger`.
2021-07-23 15:07:13 +02:00
Evangelos Ribeiro Tzaras 1ed04e409d fbd-dev-sound: Honour sound theme name for all GNOME based desktops
Phosh recently changed to XDG_CURRENT_DESKTOP=GNOME:Phosh and has since stopped
using the configured theme and instead used the fallback freedesktop theme.

Closes #41
2021-07-23 04:35:21 +02:00
Pablo Correa Gómez 3802c89e67 feedback-manager: Search for default theme under XDG_CONFIG_HOME first
This would allow users to create their own feedback profiles
without editing system files or using root privileges

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
2021-06-08 16:17:41 +02:00
Andreas Hartmann b45468080e README: Add explanation on custom theme paths
The README currently states that feedbackd uses the `default.json` theme, whose
location is hardcoded into the application. This doesn't reflect the current
state of the code.

Explain the ability to add custom themes and give some examples to the user.
Also mention the `feedbackd-device-themes` repository explicitly for users
looking to modify the current `default.json` theme. Adds explanations about the
correct naming of custom theme files and theme file precedence when multiple
themes exist.
2021-05-31 11:31:36 +02:00
Andreas Hartmann 1c53464090 fbd-feedback-manager: Make sure theme path components are '/' separated
Previously, assembly of the theme paths for custom paths (based on
`XDG_DATA_DIRS`) was performed using `g_strconcat`, which produced erroneous
file paths with missing path separators due to a typo in the code.

Instead, make use of `g_build_filename` to assemble the theme paths from
`XDG_DATA_DIRS` to look for custom themes, which automatically introduces
host-specific path separators between individual path components. This
introduces another temporary variable to ensure that the filename (which is
itself assembled from a name and the file ending) isn't mangled by introduction
of a path separator between these two "parts".
2021-05-31 11:31:30 +02:00
Evangelos Ribeiro Tzaras 63eba5d715 fbd-dev-sound: whitespace 2021-05-04 10:54:46 +02:00
Guido Günther 48b4bb97d6 Document changes and release 0.0.0+git20210426 2021-04-26 12:36:05 +02:00