]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
Add state tracking debugging info
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 1 Oct 2014 14:02:34 +0000 (16:02 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Wed, 1 Oct 2014 14:02:34 +0000 (16:02 +0200)
klgd_ff_plugin.c
klgdff.c

index 79058ee1f65f0a43704c00f29710a610e46b796c..ec9cd2f1043b8ad1f6cda09e7186d701d72ebc8b 100644 (file)
@@ -260,11 +260,13 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                struct ffpl_effect *eff = &priv->effects[idx];
                int ret = 0;
 
+               printk(KERN_NOTICE "KLGDFF - Processing effect %lu\n", idx);
                /* Latest effect is of different type than currently active effect,
                 * remove it from the device and upload the latest one */
                if (eff->replace) {
                        switch (eff->change) {
                        case FFPL_TO_ERASE:
+                               printk("KLGDFF - Rpl chg - TO_ERASE\n");
                                switch (eff->state) {
                                case FFPL_STARTED:
                                        ret = ffpl_stop_effect(priv, s, eff);
@@ -281,6 +283,7 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                                break;
                        case FFPL_TO_UPLOAD:
                        case FFPL_TO_STOP: /* There is no difference between stopping or uploading an effect when we are replacing it */
+                               printk("KLGDFF - Rpl chg - TO_UPLOAD/TO_STOP\n");
                                switch (eff->state) {
                                case FFPL_STARTED:
                                        /* Overwrite the currently active effect and set it to UPLOADED state */
@@ -304,6 +307,7 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                                break;
                        case FFPL_TO_START:
                        case FFPL_TO_UPDATE: /* There is no difference between staring or updating an effect when we are replacing it */
+                               printk("KLGDFF - Rpl chg - TO_START/TO_UPDATE\n");
                                switch (eff->state) {
                                case FFPL_STARTED:
                                        if (priv->has_owr_to_srt) {
@@ -345,6 +349,7 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
 
                switch (eff->change) {
                case FFPL_TO_UPLOAD:
+                       printk(KERN_INFO "KLGDFF - Chg TO_UPLOAD\n");
                        switch (eff->state) {
                        case FFPL_EMPTY:
                                ret = ffpl_upload_effect(priv, s, eff);
@@ -357,6 +362,7 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                        }
                        break;
                case FFPL_TO_START:
+                       printk(KERN_INFO "KLGDFF - Chg TO_START\n");
                        switch (eff->state) {
                        case FFPL_EMPTY:
                                if (priv->has_emp_to_srt) {
@@ -374,6 +380,7 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                        }
                        break;
                case FFPL_TO_STOP:
+                       printk(KERN_INFO "KLGDFF - Chg TO_STOP\n");
                        switch (eff->state) {
                        case FFPL_STARTED:
                                ret = ffpl_stop_effect(priv, s, eff);
@@ -386,6 +393,7 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                        }
                        break;
                case FFPL_TO_ERASE:
+                       printk(KERN_INFO "KLGDFF - Chg TO_ERASE\n");
                        switch (eff->state) {
                        case FFPL_UPLOADED:
                                ret = ffpl_erase_effect(priv, s, eff);
@@ -401,9 +409,11 @@ static struct klgd_command_stream * ffpl_get_commands(struct klgd_plugin *self,
                        }
                        break;
                case FFPL_TO_UPDATE:
+                       printk(KERN_INFO "KLGDFF - Chg TO_UPDATE\n");
                        ret = ffpl_update_effect(priv, s, eff);
                        break;
                case FFPL_DONT_TOUCH:
+                       printk(KERN_INFO "KLGDFF - Chg - NO CHANGE\n");
                        continue;
                default:
                        pr_debug("Unhandled state\n");
index f15fc617c5bf242b7ba4582a8952db9cc2787ffc..7a3772cb4d407d222a0b21ec3dfab7b892b64da2 100644 (file)
--- a/klgdff.c
+++ b/klgdff.c
@@ -125,9 +125,9 @@ static int klgdff_upload(struct klgd_command_stream *s, const struct ff_effect *
        return klgd_append_cmd(s, c);
 }
 
-static int klgdff_up_start(struct klgd_command_stream *s, const struct ff_effect *effect)
+static int klgdff_up_start(struct klgd_command_stream *s, const struct ff_effect *effect, const int repeat)
 {
-       char *text = kasprintf(GFP_KERNEL, "Uploading and starting effect, type %d, id %d", effect->type, effect->id);
+       char *text = kasprintf(GFP_KERNEL, "Uploading and starting effect, type %d, id %d, repeat %d", effect->type, effect->id, repeat);
        size_t len = strlen(text);
        struct klgd_command *c = klgd_alloc_cmd(len + 1);
 
@@ -183,7 +183,7 @@ int klgdff_control(struct input_dev *dev, struct klgd_command_stream *s, const e
                break;
        /* "Uploadless/eraseless" commands */
        case FFPL_EMP_TO_SRT:
-               return klgdff_up_start(s, data.effects.cur);
+               return klgdff_up_start(s, data.effects.cur, data.effects.repeat);
                break;
        case FFPL_SRT_TO_EMP:
                return klgdff_er_stop(s, data.effects.cur);