g-sensor调试之input子系统的FUZZ 和 FLAT。

20130107

关于G-sensor LIS3DH的调试:在input子系统的配置过程中,有如下两个参数 FUZZ 和 FLAT。
input_set_abs_params(acc->input_dev, ABS_X, -G_MAX, G_MAX, FUZZ, FLAT);
input_set_abs_params(acc->input_dev, ABS_Y, -G_MAX, G_MAX, FUZZ, FLAT);
input_set_abs_params(acc->input_dev, ABS_Z, -G_MAX, G_MAX, FUZZ, FLAT);
原先的代码中FUZZ=30,FLAT=30.这导致驱动在高速轮询报点,而上层getevent时却总是很慢。然后我将这个两个值都设置为0,发现上层getevent速度和驱动报点速度匹配了。(这是参考gb-v2中的mma8452x.c来的)
可见这两个参数就是用于在input子系统层来对底层上报的数据进行羽化和平滑处理(我没深入看,猜测可能就是对底层报的点进行平均处理,然后才继续向上回报,这就导致底层报了很多,然后上层却得到较少。)以下有详解:
/**
 * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
 * @value: latest reported value for the axis.
 * @minimum: specifies minimum value for the axis.
 * @maximum: specifies maximum value for the axis.
 * @fuzz: specifies fuzz value that is used to filter noise from
 * the event stream.
 * @flat: values that are within this value will be discarded by
 * joydev interface and reported as 0 instead.
 * @resolution: specifies resolution for the values reported for
 * the axis.
 *
 * Note that input core does not clamp reported values to the
 * [minimum, maximum] limits, such task is left to userspace.
 *
 * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
 * units per millimeter (units/mm), resolution for rotational axes
 * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
 */
struct input_absinfo {
__s32 value;
__s32 minimum;
__s32 maximum;
__s32 fuzz;
__s32 flat;
__s32 resolution;
};

这个问题解决后还有个问题就是,这个报点会突然有一下变成负数,哪怕手机静止的时候,但是查看驱动读到的硬件值,全都是正的,上层怎么会有这样的问题呢???继续查

你可能感兴趣的:(Sensors)