mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
input/ff: extend ioctrl to support factory calibration
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
@@ -391,6 +391,30 @@ static int ff_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVIOCSETCALIBDATA:
|
||||||
|
{
|
||||||
|
if (upper->lower->set_calibvalue == NULL)
|
||||||
|
{
|
||||||
|
ret = -ENOTSUP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = upper->lower->set_calibvalue(upper->lower, arg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVIOCCALIBRATE:
|
||||||
|
{
|
||||||
|
if (upper->lower->calibrate == NULL)
|
||||||
|
{
|
||||||
|
ret = -ENOTSUP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = upper->lower->calibrate(upper->lower, arg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = -ENOTTY;
|
ret = -ENOTTY;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -107,6 +107,19 @@
|
|||||||
|
|
||||||
#define EVIOCGEFFECTS _FFIOC(3)
|
#define EVIOCGEFFECTS _FFIOC(3)
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -403,6 +416,30 @@ struct ff_lowerhalf_s
|
|||||||
|
|
||||||
CODE void (*destroy)(FAR struct ff_lowerhalf_s *lower);
|
CODE void (*destroy)(FAR struct ff_lowerhalf_s *lower);
|
||||||
|
|
||||||
|
/* 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,
|
||||||
|
* the absolute accuracy will be better than before.
|
||||||
|
* Note: the parameters associated with calibration value, maxinum 32-byte.
|
||||||
|
*/
|
||||||
|
|
||||||
|
CODE int (*set_calibvalue)(FAR struct ff_lowerhalf_s *lower,
|
||||||
|
unsigned long arg);
|
||||||
|
|
||||||
|
/* This operation can trigger the calibration operation, and if the
|
||||||
|
* calibration operation is short-lived, the calibration result value can
|
||||||
|
* be obtained at the same time, the calibration value to be written in
|
||||||
|
* the non-volatile memory of the device or dedicated registers. When the
|
||||||
|
* upper-level application calibration is completed, the current
|
||||||
|
* calibration value of the device needs to be obtained and backed up,
|
||||||
|
* so that the last calibration value can be directly obtained after
|
||||||
|
* power-on.
|
||||||
|
* Note: the parameters associated with calibration value, maxinum 32-byte.
|
||||||
|
*/
|
||||||
|
|
||||||
|
CODE int (*calibrate)(FAR struct ff_lowerhalf_s *lower,
|
||||||
|
unsigned long arg);
|
||||||
|
|
||||||
/* The bitmap of force feedback capabilities truly supported by device */
|
/* The bitmap of force feedback capabilities truly supported by device */
|
||||||
|
|
||||||
unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
|
unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
|
||||||
|
|||||||
Reference in New Issue
Block a user