From b4352c428872271616f32d3256106237ebbbb7bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Wed, 1 Oct 2014 16:02:34 +0200 Subject: [PATCH] Add state tracking debugging info --- klgd_ff_plugin.c | 10 ++++++++++ klgdff.c | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/klgd_ff_plugin.c b/klgd_ff_plugin.c index 79058ee..ec9cd2f 100644 --- a/klgd_ff_plugin.c +++ b/klgd_ff_plugin.c @@ -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"); diff --git a/klgdff.c b/klgdff.c index f15fc61..7a3772c 100644 --- 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); -- 2.43.5