input/ff: add control operation to force feedback driver interface

adds a generic control operation to the FF driver interface.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina
2025-08-26 18:44:28 +08:00
committed by archer
parent 4f3a72ef59
commit cfbbd06957
2 changed files with 20 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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)];