input/ff: extend ioctrl to support get effect duration

support obtain effect duration interface

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina
2025-03-13 22:36:53 +08:00
committed by archer
parent e55ba8c82c
commit 4f3a72ef59
2 changed files with 26 additions and 2 deletions
+13
View File
@@ -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)
+13 -2
View File
@@ -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,