From bfbcc3d0dbb8bd7dc12a00e0cb79b2759f6f96b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Mon, 20 Jul 2015 22:23:28 +0200 Subject: [PATCH] Fix behavior when effects are being erased or replaced. --- klgd_ff_plugin.c | 6 ++++++ klgd_ff_plugin_p.h | 1 + 2 files changed, 7 insertions(+) diff --git a/klgd_ff_plugin.c b/klgd_ff_plugin.c index 00b4666..ecf43a8 100644 --- a/klgd_ff_plugin.c +++ b/klgd_ff_plugin.c @@ -289,6 +289,7 @@ static int ffpl_erase_rq(struct input_dev *dev, int effect_id) klgd_lock_plugins(self->plugins_lock); eff->change = FFPL_TO_ERASE; + eff->trigger = FFPL_TRIG_NOW; klgd_unlock_plugins_sched(self->plugins_lock); return 0; @@ -344,6 +345,7 @@ static int ffpl_upload_rq(struct input_dev *dev, struct ff_effect *effect, struc if (ffpl_needs_replacing(&eff->active, &eff->latest)) { eff->replace = true; eff->change = FFPL_TO_UPLOAD; + eff->trigger = FFPL_TRIG_NOW; } else { eff->replace = false; eff->change = FFPL_TO_UPDATE; @@ -525,6 +527,7 @@ static void ffpl_advance_trigger(struct ffpl_effect *eff) eff->trigger = FFPL_TRIG_NONE; break; case FFPL_TRIG_STOP: + case FFPL_TRIG_NOW: eff->trigger = FFPL_TRIG_NONE; break; default: @@ -545,6 +548,9 @@ static bool ffpl_get_update_time(struct klgd_plugin *self, const unsigned long n switch (eff->trigger) { default: continue; + case FFPL_TRIG_NOW: + current_t = now; + break; case FFPL_TRIG_START: current_t = eff->start_at; eff->change = FFPL_TO_START; diff --git a/klgd_ff_plugin_p.h b/klgd_ff_plugin_p.h index 153f1fb..ade1dd0 100644 --- a/klgd_ff_plugin_p.h +++ b/klgd_ff_plugin_p.h @@ -20,6 +20,7 @@ enum ffpl_state { /* What to do at the next timing trip point */ enum ffpl_trigger { FFPL_TRIG_NONE, /* No timing event scheduled for and effect */ + FFPL_TRIG_NOW, /* State change has been set elsewhere and is to be processed immediately */ FFPL_TRIG_START, /* Effect is to be started */ FFPL_TRIG_STOP /* Effect is to be stopped */ }; -- 2.43.5