]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
- More work on rumble effects combining
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 23 Sep 2015 16:02:14 +0000 (18:02 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Wed, 23 Sep 2015 16:02:14 +0000 (18:02 +0200)
- Use "spinning" lock in playback_rq (might not be a good idea!)

plugin/klgd_ff_plugin.c
testmod/klgdff.c

index fd1340c37b8604ef5d551490d6e376f9411ac777..5a96e000874167f9f72725f9bda3fddf3dda0c46 100644 (file)
@@ -384,9 +384,6 @@ static void ffpl_recalc_combined_cf(struct klgd_plugin_private *priv, const unsi
                s32 _x;
                s32 _y;
 
-               if (!ffpl_process_memless(priv, ueff))
-                       continue;
-
                if (eff->state != FFPL_STARTED)
                        continue;
 
@@ -403,7 +400,7 @@ static void ffpl_recalc_combined_cf(struct klgd_plugin_private *priv, const unsi
                        ffpl_ramp_to_x_y(eff, &_x, &_y, now);
                        break;
                default:
-                       printk(KERN_ERR "KLGDFF: Combinable constant force effect handler tried to process an uncombinable effect! This should not happen!\n");
+                       continue;
                        break;
                }
 
@@ -468,6 +465,9 @@ static void ffpl_recalc_combined_rumble(struct klgd_plugin_private *priv, const
                struct ffpl_effect *eff = &priv->effects[idx];
                struct ff_effect *ueff = &eff->active;
 
+               if (eff->state != FFPL_STARTED)
+                       continue;
+
                switch (ueff->type) {
                case FF_RUMBLE:
                        ffpl_add_rumble(ueff, &strong_mag, &weak_mag, &dir);
@@ -478,7 +478,7 @@ static void ffpl_recalc_combined_rumble(struct klgd_plugin_private *priv, const
                                break;
                        break;
                default:
-                       printk(KERN_ERR "KLGDFF: Combinable rumble effect handler tried to process an uncombinable effect! This should not happen!\n");
+                       continue;
                        break;
                }
        }
@@ -1141,13 +1141,19 @@ static int ffpl_get_commands(struct klgd_plugin *self, struct klgd_command_strea
                goto out;
        }
 
-       /* Handle combined effect here */
+       /* Handle combined constant force effect here */
        ret = ffpl_handle_state_change(priv, *s, &priv->combined_effect_cf, now);
        if (ret) {
                printk(KERN_WARNING "KLGDFF: Cannot get command stream for combined constant force effect\n");
                goto out;
        }
 
+       ret = ffpl_handle_state_change(priv, *s, &priv->combined_effect_rumble, now);
+       if (ret) {
+               printk(KERN_WARNING "KLGDFF: Cannot get command stream for combined rumble effect\n");
+               goto out;
+       }
+
        for (idx = 0; idx < priv->effect_count; idx++) {
                struct ffpl_effect *eff = &priv->effects[idx];
 
index 390a24d51f84952318204fa8f02d3f8fa97da84e..a74ef469262b926790fb8394ebc67f1cc8244c2a 100644 (file)
@@ -122,6 +122,10 @@ static int klgdff_start(struct klgd_command_stream *s, const struct ff_effect *e
                text = kasprintf(GFP_KERNEL, "Playing FF_CONSTANT, level: %d, dir: %u, X: %d, Y: %d", level, effect->direction, x, y);
                break;
        }
+       case FF_RUMBLE:
+               text = kasprintf(GFP_KERNEL, "Playing FF_RUMBLE, strong: %u, weak: %u, direction: %u\n", effect->u.rumble.strong_magnitude,
+                                effect->u.rumble.weak_magnitude, effect->direction);
+               break;
        default:
                text = kasprintf(GFP_KERNEL, "Playing effect, type %d, id %d, repeat %d", effect->type, effect->id, repeat);
                break;
@@ -169,6 +173,10 @@ static int klgdff_update(struct klgd_command_stream *s, const struct ff_effect *
                text = kasprintf(GFP_KERNEL, "Updating FF_CONSTANT, level: %d, dir: %u, X: %d, Y: %d", level, effect->direction, x, y);
                break;
        }
+       case FF_RUMBLE:
+               text = kasprintf(GFP_KERNEL, "Updating FF_RUMBLE, strong: %u, weak: %u, direction: %u\n", effect->u.rumble.strong_magnitude,
+                                effect->u.rumble.weak_magnitude, effect->direction);
+               break;
        default:
                text = kasprintf(GFP_KERNEL, "Updating, type %d, id %d", effect->type, effect->id);
                break;
@@ -216,6 +224,10 @@ static int klgdff_up_start(struct klgd_command_stream *s, const struct ff_effect
                text = kasprintf(GFP_KERNEL, "Uploading and starting FF_CONSTANT, level: %d, dir: %u, X: %d, Y: %d", level, effect->direction, x, y);
                break;
        }
+       case FF_RUMBLE:
+               text = kasprintf(GFP_KERNEL, "Uploading and starting FF_RUMBLE, strong: %u, weak: %u, direction: %u\n", effect->u.rumble.strong_magnitude,
+                                effect->u.rumble.weak_magnitude, effect->direction);
+               break;
        default:
                text = kasprintf(GFP_KERNEL, "Uploading and starting effect, type %d, id %d, repeat %d", effect->type, effect->id, repeat);
                break;