This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e55ba8c82c4818fd1ed0005bd6e53cf999d5014a
Author: fangpeina <[email protected]>
AuthorDate: Thu Mar 13 15:59:34 2025 +0800

    drivers/input: support return effect duration in ff_dummy
    
    add duration return of an uploaded effect in ff_dummy
    
    Signed-off-by: fangpeina <[email protected]>
---
 drivers/input/ff_dummy.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/input/ff_dummy.c b/drivers/input/ff_dummy.c
index 468a3d6ffec..5e89e3dffe6 100644
--- a/drivers/input/ff_dummy.c
+++ b/drivers/input/ff_dummy.c
@@ -57,6 +57,21 @@ static int ff_dummy_haptics_upload_effect(FAR struct 
ff_lowerhalf_s *lower,
                                           FAR struct ff_effect *old)
 {
   iinfo("called: effect_id = %d \n", effect->id);
+
+  if (effect->type == FF_PERIODIC)
+    {
+      if (effect->u.periodic.custom_data != NULL &&
+          effect->u.periodic.custom_len >=
+          3 * sizeof(effect->u.periodic.custom_data[0]))
+        {
+          iinfo("custom effect id = %d\n",
+          effect->u.periodic.custom_data[0]);
+
+          effect->u.periodic.custom_data[1] = 5; /* effect id playlength s */
+          effect->u.periodic.custom_data[2] = 0; /* effect id playlength ms */
+        }
+    }
+
   return OK;
 }
 

Reply via email to