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 cfbbd06957c33cdda4412fdbf41b5fb3d1673c1f
Author: fangpeina <[email protected]>
AuthorDate: Tue Aug 26 18:44:28 2025 +0800

    input/ff: add control operation to force feedback driver interface
    
    adds a generic control operation to the FF driver interface.
    
    Signed-off-by: fangpeina <[email protected]>
---
 drivers/input/ff_upper.c | 10 +++++++++-
 include/nuttx/input/ff.h | 11 +++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/input/ff_upper.c b/drivers/input/ff_upper.c
index 5203b8e609e..7775405744e 100644
--- a/drivers/input/ff_upper.c
+++ b/drivers/input/ff_upper.c
@@ -429,7 +429,15 @@ static int ff_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
         break;
 
       default:
-        ret = -ENOTTY;
+        if (upper->lower->control)
+          {
+            ret = upper->lower->control(upper->lower, cmd, arg);
+          }
+        else
+          {
+            ret = -ENOTTY;
+          }
+
         break;
     }
 
diff --git a/include/nuttx/input/ff.h b/include/nuttx/input/ff.h
index ab0b7432816..ec4eb29dced 100644
--- a/include/nuttx/input/ff.h
+++ b/include/nuttx/input/ff.h
@@ -451,6 +451,17 @@ struct ff_lowerhalf_s
   CODE int (*calibrate)(FAR struct ff_lowerhalf_s *lower,
                         unsigned long arg);
 
+  /* Called to set special configuration for the force feedback device,
+   * such as changing custom mode, setting custom resolution, reset, etc.
+   * All commands are parsed and implemented by lower half driver.
+   * Note: cmd - special command for device configuration, arg - parameters
+   * associated with the command. Returned value: Zero (OK) on success;
+   * -ENOTTY on failure.
+   */
+
+  CODE int (*control)(FAR struct ff_lowerhalf_s *lower,
+                      int cmd, unsigned long arg);
+
   /* The bitmap of force feedback capabilities truly supported by device */
 
   unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];

Reply via email to