From: Michal MalĂ˝ Date: Fri, 15 Aug 2014 19:26:34 +0000 (+0200) Subject: Add some comments X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=692037dd9fd92c2b9caae09bc67d2a4af8bea9a7;p=KLGD_FF_plugin.git Add some comments --- diff --git a/klgd_ff_plugin.c b/klgd_ff_plugin.c index 86556bb..7409fa6 100644 --- a/klgd_ff_plugin.c +++ b/klgd_ff_plugin.c @@ -4,6 +4,7 @@ static bool ffpl_replace_effect(const struct ff_effect *ac_eff, const struct ff_effect *la_eff); +/* Destroy request - input device is being destroyed */ static void ffpl_destroy_rq(struct ff_device *ff) { struct klgd_plugin *self = ff->private; @@ -23,6 +24,7 @@ static void ffpl_destroy_rq(struct ff_device *ff) ff->private = NULL; } +/* Erase request coming from userspace */ static int ffpl_erase_rq(struct input_dev *dev, int effect_id) { struct klgd_plugin *self = dev->ff->private; @@ -35,7 +37,8 @@ static int ffpl_erase_rq(struct input_dev *dev, int effect_id) return 0; } - + +/* Playback request coming from userspace */ static int ffpl_playback_rq(struct input_dev *dev, int effect_id, int value) { struct klgd_plugin *self = dev->ff->private; @@ -54,6 +57,7 @@ static int ffpl_playback_rq(struct input_dev *dev, int effect_id, int value) return 0; } +/* Upload request coming from userspace */ static int ffpl_upload_rq(struct input_dev *dev, struct ff_effect *effect, struct ff_effect *old) { struct klgd_plugin *self = dev->ff->private; diff --git a/klgd_ff_plugin_p.h b/klgd_ff_plugin_p.h index 4e302b7..6b4c5ff 100644 --- a/klgd_ff_plugin_p.h +++ b/klgd_ff_plugin_p.h @@ -1,27 +1,27 @@ /* State change flags */ enum ffpl_st_change { - FFPL_DONT_TOUCH, - FFPL_TO_UPLOAD, - FFPL_TO_START, - FFPL_TO_STOP, - FFPL_TO_ERASE, - FFPL_TO_UPDATE + FFPL_DONT_TOUCH, /* Effect has not been changed since last update */ + FFPL_TO_UPLOAD, /* Effect shall be uploaded to device */ + FFPL_TO_START, /* Effect shall be started */ + FFPL_TO_STOP, /* Effect shall be stopped */ + FFPL_TO_ERASE, /* Effect shall be removed from device */ + FFPL_TO_UPDATE /* Effect paramaters shall be updated */ }; /* Status flags */ enum ffpl_state { - FFPL_EMPTY, - FFPL_UPLOADED, - FFPL_STARTED, + FFPL_EMPTY, /* There is no effect in the slot */ + FFPL_UPLOADED, /* Effect in the slot is uploaded to device */ + FFPL_STARTED, /* Effect in the slot is started on device */ }; struct ffpl_effect { - struct ff_effect *active; - struct ff_effect *latest; - enum ffpl_st_change change; - enum ffpl_state state; - bool replace; + struct ff_effect *active; /* Last effect submitted to device */ + struct ff_effect *latest; /* Last effect submitted to us by userspace */ + enum ffpl_st_change change; /* State to which the effect shall be put */ + enum ffpl_state state; /* State of the active effect */ + bool replace; /* Active effect has to be replaced => active effect shall be erased and latest uploaded */ }; struct klgd_plugin_private {