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 4f3a72ef59c8c4a9ab9b84579c64f361d5111bba Author: fangpeina <[email protected]> AuthorDate: Thu Mar 13 22:36:53 2025 +0800 input/ff: extend ioctrl to support get effect duration support obtain effect duration interface Signed-off-by: fangpeina <[email protected]> --- drivers/input/ff_upper.c | 13 +++++++++++++ include/nuttx/input/ff.h | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/input/ff_upper.c b/drivers/input/ff_upper.c index 43eee8e8098..5203b8e609e 100644 --- a/drivers/input/ff_upper.c +++ b/drivers/input/ff_upper.c @@ -391,6 +391,19 @@ static int ff_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } break; + case EVIOCGDURATION: + { + if (upper->lower->get_duration == NULL) + { + ret = -ENOTSUP; + break; + } + + ret = upper->lower->get_duration(upper->lower, + (FAR struct ff_effect *)(uintptr_t)arg); + } + break; + case EVIOCSETCALIBDATA: { if (upper->lower->set_calibvalue == NULL) diff --git a/include/nuttx/input/ff.h b/include/nuttx/input/ff.h index b4060af1226..ab0b7432816 100644 --- a/include/nuttx/input/ff.h +++ b/include/nuttx/input/ff.h @@ -107,18 +107,24 @@ #define EVIOCGEFFECTS _FFIOC(3) +/* This cmd use to get the duration of the effect. + * Arg: pointer to address of struct ff_effect, return the status. + */ + +#define EVIOCGDURATION _FFIOC(4) + /* This cmd use to calibrate the device and return the calibration value. * Arg: pointer to address of integer array value, return the calibration * value. */ -#define EVIOCCALIBRATE _FFIOC(4) +#define EVIOCCALIBRATE _FFIOC(5) /* This cmd use to set calibration value for the device. * Arg: pointer to address of the calibration value which should be set. */ -#define EVIOCSETCALIBDATA _FFIOC(5) +#define EVIOCSETCALIBDATA _FFIOC(6) /**************************************************************************** * Public Types @@ -416,6 +422,11 @@ struct ff_lowerhalf_s CODE void (*destroy)(FAR struct ff_lowerhalf_s *lower); + /* Called to get the duration of the effect. */ + + CODE int (*get_duration)(FAR struct ff_lowerhalf_s *lower, + FAR struct ff_effect *effect); + /* The calibration value to be written in or the non-volatile memory of the * device or dedicated registers. At each power-on, so that the values read * from the device are already corrected. When the device is calibrated,
