Commit Graph
115 Commits
Author SHA1 Message Date
Guido Günther 0dbbc93adc fbd-dev-led-multicolor: Make it a derivable type
This will allow hw-pattern classes to derive from it.
2024-04-09 15:43:03 +00:00
Guido Günther aa96b064b1 fbd-dev-led-multicolor: Drop unused variable 2024-04-09 15:43:03 +00:00
Guido Günther 987e6371f9 fbd-dev-led-multicolor: Fix indentation 2024-04-09 15:43:03 +00:00
Guido Günther 3d7c4b376a feedback-theme: Don't leak parent name 2023-03-13 15:26:18 +01:00
Guido Günther 7becab3346 feedback-theme: Don't leak json array when serializing profile
json_array_add_element doesn't transfer ownership.
2023-03-13 15:26:15 +01:00
Guido Günther 5206c3aae5 feedback-profile: Don't leak json array when serializing profile
json_array_add_element doesn't transfer ownership
2023-03-13 15:26:10 +01:00
Guido Günther 03b0f4c2aa fbd-event: Make sure we iterate the list safely
When all feedbacks are done the event signals "feedbacks-ended" which
lets the manager dispose the feedback. When all feedbacks end instantly
and synchronously (as is the case with the dummy feedback) this triggers
the disposal of the event within the loop leading to a crash.

Make sure the object doesn't go away be referencing it during the loop
iteration.

We didn't see this before as glib's slice allocator for lists papered
over this for us.

Closes: https://source.puri.sm/Librem5/feedbackd/-/issues/69
2023-03-13 15:25:41 +01:00
Guido Günther 64076e5ad0 fbd-event: Simplify
Gbp-Dch: Ignore
2023-03-13 15:25:37 +01:00
Guido Günther 995d21b587 fbd-dev-led: Move multicolor handling to separate class
Everything related to multicolor moves into the new class and we add the
necessary getters and setters so derived classes can access the parent
classes attributes where needed.
2023-02-10 15:15:12 +00:00
Guido Günther ca712e9a32 fbd-dev-led: Add class methods so derived classes can override functionality 2023-02-10 15:15:12 +00:00
Guido Günther ac0516329c fbd-dev-led: Use GInitable
Use default GObject patterns instead of stuffing things into the
fbd_dev_led_new () so derived classes can override it.
2023-02-10 15:15:12 +00:00
Guido Günther f7ec08497e fbd-dev-led: Turn into a GObject
This is just the minimal changes to switch to a derivable GObject
2023-02-10 15:15:12 +00:00
Guido Günther f17ca72c1b fbd-dev-led: Make structure opaque
This will allow us to turn it into a GObject
2023-02-10 15:15:12 +00:00
Guido Günther 5d8b2e5fe4 fbd-dev-led: Allow to lookup color
This allows us to make the led structure into an opaque in
the next commit
2023-02-10 15:15:12 +00:00
Guido Günther 8ad1c43ff1 fbd-dev-leds: Move pattern trigger into fbd-dev-led 2023-02-10 15:15:12 +00:00
Guido Günther fd852c6f69 fbd-dev-leds: Move led creation into fbd-dev-led
This will allow us to separate the different led types
2023-02-10 15:15:12 +00:00
Guido Günther 5fc0372b45 Move LED device to separate file
We separate out the led as different LED types have different
ways to set patterns, etc
2023-02-10 15:15:12 +00:00
Guido Günther 253d178cfc fbd-dev-leds: Use gi-docgen compatible format
We don't document the server classes via gi-docgen atm but
as we use it for the lib update classes we touch.
2023-02-10 15:15:12 +00:00
Guido Günther 1013974958 theme: Fix some indentation 2023-02-10 15:15:12 +00:00
Guido Günther 4822be0f7c Update to gmobile 0.0.1
Adjust to the one API change. We do it all in one commit to keep
bisectability. We use a slightly newer commit than 0.0.1 to include
build fixes for older glib (as required on PureOS Byzantium).
2023-02-02 13:04:48 +01:00
Guido Günther b10e699efa build: Add dbus sources to the lib dependency
Otherwise we might fail to generate it for the executables
2022-12-15 17:54:08 +01:00
Guido Günther b64ce1290c Add theme validator
Recursively loads a given theme file.
2022-12-12 16:13:38 +01:00
Guido Günther ef5dd5abca theme-expander: Also log initial theme file 2022-12-12 16:13:38 +01:00
Guido Günther 83091be25d feedback-manager: Handle theme gsetting
Update the theme when the gsetting changes
2022-12-11 17:34:38 +01:00
Guido Günther f5757045aa manager: Don't load theme in constructor
Loading the theme can trigger calls to
fbd_feedback_manager_get_default() which then results in an endless look
as the object isn't fully initialized in constructed. Instead do
the setup in main() which has the advantage that the manager's life
cycle becomes more obvious too.
2022-12-11 17:34:38 +01:00
Guido Günther a75cdbbc59 theme-expander: Allow to set the theme to expand 2022-12-11 17:34:38 +01:00
Guido Günther 242519498a Recursively load themes
Themes (other than the default theme) can specify a `parent-name` in the
json file. This theme will be used as a base for the theme. Events and
profiles of the children override those in the parents.

For this we move the lookup code into it's separate class and also add
tests.

Closes: #38
2022-12-11 17:34:38 +01:00
Guido Günther 34f8733b2b build: Don't include main in lib
For that move the error quark to a separate file.
2022-12-08 10:05:47 +01:00
Guido Günther ba91939c85 Add gmobile library 2022-12-08 10:05:47 +01:00
Guido Günther ada82a0ed1 feedback-theme: Allow to get and set parent theme name
If set the parent theme's feedbackd and profiles should be merged into
this theme.
2022-12-08 10:05:47 +01:00
Guido Günther e10b2cc150 feedback-theme: Allow to update theme
New profiles are added, existing profiles updated. This will
allow to merge themes.
2022-12-08 10:05:47 +01:00
Guido Günther d7f97dca51 feedback-profile: Allow to update profiles
Allow to add feedbacks from a profile to another one
2022-12-08 10:05:47 +01:00
Guido Günther 29bbe38fb3 feedback-dummy: Add getter for duration
Useful in tests
2022-12-08 10:05:47 +01:00
Guido Günther 53677e29ef feedback-profile: Document hash types 2022-12-08 10:05:47 +01:00
Guido Günther 82a8b91096 feedback-theme: Allow to set name 2022-12-08 10:05:47 +01:00
Guido Günther 1d21bfa0dc feedback-theme: Use getter
Ensures we stay consistent with future changes
2022-12-08 10:05:47 +01:00
Guido Günther e6f1c351e2 feedback-theme: Fix indentation 2022-12-08 10:05:47 +01:00
Guido Günther c9404d871e feedback-theme: No need for constructed
We can do all that in init
2022-12-08 10:05:47 +01:00
Guido Günther 3c124e8ecd feedback-vibra: Fix indentation 2022-12-08 10:05:47 +01:00
Guido Günther 2e29f5baf1 fbd: Fix indentation 2022-11-11 09:50:19 +00:00
Guido Günther db13fc031d manager: Use FEEDBACKD_UDEV_ATTR
It was introduced in

a5b4f99 ("feedbackd: Support visual feedback via LEDs")
2022-11-11 09:50:19 +00:00
Evangelos Ribeiro Tzaras d739a33a5f feedback-manager: Complete DBus call before emitting "feedback-ended"
See previous commit adding the test (that now passes) for the reasoning.

Fixes: #62
2022-11-09 11:54:46 +01:00
Evangelos Ribeiro Tzaras 94001bba78 feedback-manager: Use guint for event id
The ID is inserted into a hashtable below with GUINT_TO_POINTER
and is set using self->next_id++ with next_id also being a guint,
so change the type accordingly.
2022-11-03 19:31:57 +01: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 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
Evangelos Ribeiro Tzaras 5f28638eec fbd-event: Fix return value for fbd_event_get_sender 2021-10-29 17:56:28 +02:00