Commit Graph
157 Commits
Author SHA1 Message Date
Guido Günther 678ae7a22d fbd-feedback-manager: Don't leak device list 2021-04-26 09:34:23 +00:00
Guido Günther 9c9f767986 fbd-feedback-manager: Don't leak config_path
It's assigned multiple times.
2021-04-26 09:34:23 +00:00
Guido Günther 437b19edd4 fbd-feedback-manager: Make sure to dispose sound device as well
Fixes another leak.
2021-04-26 09:34:23 +00:00
Guido Günther 11aa38baba fbd-dev-sound: Use correct cleanup for hash table
This went unnoticed since the manager forgot to cleanup
this at all (see follow up commit).
2021-04-26 09:34:23 +00:00
Guido Günther 4c30fafc6e fbd-dev-leds: Use automatic deep cleanup for device list
The current logic was fragile and failed e.g. when the
FEEDBACKD_UDEV_VAL_LED would not match leaking the dev since the
g_object_unref() at the end of the loop was never hit.

Prevent that with automatic cleanup and explicitly ref'ing the
devs we want to use.
2021-04-26 09:34:23 +00:00
Guido Günther 957fa1be83 fbd-dev-leds: Don't leak color
g_ascii_strdown() creates a copy already.
2021-04-26 09:34:23 +00:00
Guido Günther d8f944ed30 fbd-dev-leds: Don't leak enum_name
g_enum_to_string() is transfer full.
2021-04-26 09:34:23 +00:00
Guido Günther d7419f37a1 fbd-dev-leds: Free actual FbdDevLed as well
So far we only unref'ed the device.
2021-04-26 09:34:23 +00:00
Guido Günther 9169d8b23b fbd-feedback-theme: Don't leak JSON node 2021-04-26 09:34:23 +00:00
Guido Günther 04648dcf27 feedback-manager: Track DBus clients and end feedbacks if they go away
When the client goes away we build up a list of events to end feedback
for to make sure the hash table isn't modified in place. tThe alternative
approach would be to disconnect the on_event_feedbacks_ended handler,
duplicate the DBus signal emission and use g_hash_table_foreach_remove
but that looks less robust than using the same code path.

Closes: #25
2021-04-22 14:44:30 +02:00
Guido Günther dc8c8c9594 fbd-manager: Keep DBus sender around 2021-04-22 14:43:30 +02:00
Guido Günther 66bcb31a0e fbd-event: Add sender property
This allows us to store the DBus sender
2021-04-22 14:43:30 +02:00
Guido Günther abab07a2f2 event: Remove 'g' prefix from common C types
This matchs phosh's style.
2021-04-22 14:43:30 +02:00
Guido Günther da537aff1e event: Make log-domain match source file name 2021-04-22 14:43:30 +02:00
Clayton Craft 2674654c39 fbd-ledctrl: fix matching of trigger in list of triggers
If the trigger is the last thing in sysfs_path/LED_TRIGGER_ATTR, then
the new-line at the end of the output causes g_strv_contains to fail to
find the trigger in the list. This strips the new-line before splitting
the output into a list for searching.

You can see the problem this patch fixes with the librem 5, by:

$ rmmod ledtrig-timer     # or whatever is listed at the end, so 'pattern' is the last thing
$ cat /sys/devices/platform/pwmleds/leds/blue:status/trigger
[none] kbd-scrolllock ... pattern
$ fbd-ledctrl -p /sys/devices/platform/pwmleds/leds/blue:status -t pattern
Failed to set perms of /sys/devices/platform/pwmleds/leds/blue:status/pattern to 101: No such file or directory
$ modprobe ledtrig-timer
$ cat /sys/devices/platform/pwmleds/leds/blue:status/trigger
[none] kbd-scrolllock ... pattern timer
$ fbd-ledctrl -p /sys/devices/platform/pwmleds/leds/blue:status -t pattern
<success>
2021-03-20 00:26:24 -07:00
Guido Günther 0a5dac1e53 fbd-dev-sound: Don't warn when sound was cancelled
This is not an error per se.
2021-02-05 16:56:24 +01:00
Guido Günther c95009afd1 fbd-dev-sound: Don't leak GError 2021-02-05 16:56:23 +01:00
Martin Bürgmann 4ba2889b90 implement fbd_dev_sound_stop
tracks the FdbFeedbackSounds in a GHashTable in the FdbDevSound
2021-02-04 21:16:39 +01:00
Guido Günther 40d318c9aa feedback-manager: Fix formatting
It was off in several places. Now that there's no outstanding
MRs clean it up via

   uncrustify --replace -c phosh.cfg src/fbd-feedback-manager.c
2021-01-11 10:35:03 +01:00
Dylan Van Assche 3ac9494821 fbd-feedback-manager: Allow device-specific feedbackd themes
Reads the compatible list of the device and tries to find a device-specific theme file in all  directories. If no configuration is found, we fall back to a default theme file. The device-specific theme file can always be overriden by specifying the FEEDBACK_THEME environment variable
2021-01-01 18:49:38 +01:00
Luca Weiss ed0253fc44 Fix typos 2020-10-26 08:21:05 +00:00
Luca Weiss e79a24b5ad fbd-dev-leds: fix brightness parameter
The fbd_dev_led_set_brightness function is only getting called with
parameter 0 at the moment so this was never noticed.
2020-10-25 22:30:25 +01:00
Guido Günther 99e39fba00 sound: Set 'event' media role
This allows pa to cork, duck, etc.
2020-09-30 19:16:25 +02:00
Guido Günther 5a75f369fc fbd: Dispose manager at the very end 2020-07-24 14:45:46 +02:00
Guido Günther 665d2abc4a feedback-led: Don't try to stop led when there's no led device
This is not a critical since we prevented submitting initially
but daemon cleanup processes all entries in the theme.
2020-07-24 12:53:13 +02:00
Guido Günther d137c5895f feedback-led: Stop the correct led color 2020-07-24 12:53:13 +02:00
Guido Günther 8a631cae3e feedback-manager: Dispose leds too 2020-07-24 12:53:13 +02:00
Guido Günther e7f527bf62 feedback-manager: Don't forget to remove not found events from the hash table
This plugs a leak.
2020-07-24 12:53:13 +02:00
Guido Günther cf56999bf7 feedback-manager: Deeply free the feedback list
Instead of freeing each elemnt after each iteration and then the list
itself at the very end just fully free the list. g_autoslist does
not work well on oder glib so do that manually.

This is just cosmetics.
2020-07-24 12:53:13 +02:00
Guido Günther e8d189ebe6 feedback-theme: Avoid warning when feedback is not found
We tell the caller so debug level is enough
2020-07-24 11:58:26 +02:00
Guido Günther 05a6bd5947 feedback-sound: Implement is_available
This avoids criticals when there's sound device available. We
can also be more precise about the reason why feedback ended.
2020-07-22 10:28:42 +00:00
Guido Günther 67ebeba2b2 feedback-vibra-periodic: Implement is_available
This avoids criticals when there's no periodic vibra available.
2020-07-22 10:28:42 +00:00
Guido Günther 1af163e7ea feedback-vibra-rumble: Implement is_available
This avoids criticals when there's no rumble vibra available.
2020-07-22 10:28:42 +00:00
Guido Günther 75e28510e4 fbd-feedback-led: Implement is_available ()
This avoids criticals when there's no Leds available.
2020-07-22 10:28:42 +00:00
Guido Günther e8dfe6974a fbd-feedback-manager: Check if feedback is usable
If we don't find any usable feedbacks for an event return
FBD_EVENT_END_REASON_NOT_FOUND.
2020-07-22 10:28:42 +00:00
Guido Günther 542fe52cc2 feedback-manager: Fix indentation 2020-07-22 10:28:42 +00:00
Guido Günther 94ef60f73e fbd-feedback-base: Add fbd_feedback_is_available ()
This allows to check if a feedback type is available
at all.
2020-07-22 10:28:42 +00:00
Guido Günther f950cfc3a2 fbd-dev-sound: Be less verbose on missing sound files
This is quite common so don't fill the logs at normal debug levels
but be more specific about what is missing.
2020-07-20 16:19:17 +02:00
Arnaud Ferraris 4bcf9d9fbb fbd-dev-leds: store LED color when parsing devices
Failing to do so will always select the first recognized LED (the blue 
one for the PinePhone).
2020-07-14 15:33:32 +00:00
Arnaud Ferraris 24956d7208 fbd-ledctrl: fix typo 2020-07-12 16:57:19 +02:00
Guido Günther 6692d8922b feedback-manager: Add hint to select feedback profile per event
This e.g. allows events that are meant for haptic only to avoid
emitting a sound by omitting the 'full' level and using "quiet"
instead.

Closes: #7
2020-07-10 09:20:04 +00:00
Guido Günther 421c163bdd feedback-manager: Prepare for per event hints
Move feedback profile level into a separate function for that.
2020-07-10 09:20:04 +00:00
Guido Günther 76da62738c Revert "rumble: Use a default pause"
This reverts commit 551030b436.
2020-07-10 11:17:18 +02:00
Guido Günther 551030b436 rumble: Use a default pause
Without that multiple counts sound odd so let's have good defaults.
2020-07-09 12:53:15 +00:00
Guido Günther a5b4f99412 feedbackd: Support visual feedback via LEDs
Currently all LED feedbacks are infinite we can improve that
later on by using the 'repeat' attribute of the LED pattern
trigger.
2020-07-05 19:25:44 +00:00
Guido Günther b561114800 feedbackd: Add helper to set up permissions for LEDs
This helper knows about the tiggers and necessary permission.
It's intended to be run via udev.
2020-07-05 19:25:44 +00:00
Guido Günther bdf251e565 feedback-manager: Only act on add
We would otherwise ignore the action when no vibra device was yet found.
Make sure we release the old device when updating.
2020-06-02 16:36:24 +00:00
Guido Günther 5d947f51b1 feedback-manager: Fix indentation and typo 2020-06-02 16:36:24 +00:00
Guido Günther 784152ba67 feedback-manager: Drop superfluous g_clear_error
The error is a g_autoptr
2020-06-02 16:36:24 +00:00
Guido Günther 81fda3134b feedback-vibra: Make doc strings match the class name 2020-06-02 16:36:24 +00:00