]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
Emulate periodic effects through rumble if the device does not support
authorMichal Malý <madcatxster@devoid-pointer.net>
Sun, 27 Sep 2015 23:10:04 +0000 (01:10 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sun, 27 Sep 2015 23:10:04 +0000 (01:10 +0200)
constant force effect.

plugin/klgd_ff_plugin.c

index 51a99223d2a1f1959417c66ea1593e80cdc6eba8..3ce328a05435b476db1addefd57d3496508bc62d 100644 (file)
@@ -975,7 +975,7 @@ static int ffpl_handle_combinable_effects(struct klgd_plugin_private *priv, stru
        if (needs_update_rumble) {
                if (active_effects_rumble) {
                        printk(KERN_NOTICE "KLGDFF: Combined rumble effect needs an update, total effects active: %lu\n", active_effects_rumble);
-                       ffpl_recalc_combined_rumble(priv, now, test_bit(FF_CONSTANT, priv->dev->ffbit));
+                       ffpl_recalc_combined_rumble(priv, now, !test_bit(FF_CONSTANT, priv->dev->ffbit));
                        if (priv->combined_effect_rumble.state == FFPL_STARTED)
                                priv->combined_effect_rumble.change = FFPL_TO_UPDATE;
                        else
@@ -1567,7 +1567,11 @@ int ffpl_init_plugin(struct klgd_plugin **plugin, struct input_dev *dev, const s
                printk("KLGDFF: Using REPLACE STARTED\n");
        }
 
-       if ((FFPL_MEMLESS_CONSTANT | FFPL_MEMLESS_PERIODIC | FFPL_MEMLESS_RAMP) & flags) {
+       if ((FFPL_MEMLESS_RUMBLE & flags) && !test_bit(FF_CONSTANT - FF_EFFECT_MIN, &priv->supported_effects)) {
+               priv->memless_periodic = true;
+               printk(KERN_NOTICE "KLGDFF: Emulating PERIODIC through RUMBLE\n");
+       }
+       else if ((FFPL_MEMLESS_CONSTANT | FFPL_MEMLESS_PERIODIC | FFPL_MEMLESS_RAMP) & flags) {
                if (!test_bit(FF_CONSTANT - FF_EFFECT_MIN, &priv->supported_effects)) {
                        printk(KERN_ERR "The driver asked for memless mode but the device does not support FF_CONSTANT\n");
                        ret = -EINVAL;