]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
Fix behavior when effects are being erased or replaced.
authorMichal Malý <madcatxster@devoid-pointer.net>
Mon, 20 Jul 2015 20:23:28 +0000 (22:23 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Mon, 20 Jul 2015 20:23:28 +0000 (22:23 +0200)
klgd_ff_plugin.c
klgd_ff_plugin_p.h

index 00b46660c9e33530c7b6c457342dac192236fbf4..ecf43a82ac1df51face453535cebcd76f706f454 100644 (file)
@@ -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;
index 153f1fbcbee06ed0ce00925d8205c049ca52f209..ade1dd0be6647bed5bedaa0d1a7ca00f020db815 100644 (file)
@@ -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 */
 };