input.h中input_absinfo结构中的fuzz和flat的说明

时间:2013-04-19 17:42:21

标签: linux input event-handling device-driver

我正在尝试使用来自input.h的EVIOCSABS调用调整操纵杆的灵敏度,该操纵杆无法正常使用SDL。我认为input_absinfo结构的模糊和扁平成员会影响轴的灵敏度,但是在黑暗中没有几次拍摄之后,我仍然感到难以理解它们是如何工作的。我希望有人能指出我正确的方向。

感谢您考虑我的问题!这是我在Joystick类中编写的代码:

int Joystick::configure_absinfo(int axis, int fuzz, int flat)
{
    struct input_absinfo jabsx;
    int result_code = ioctl(joystick_fd, EVIOCGABS(axis), &jabsx);
    if (result_code < 0)
    {
        perror("ioctl GABS failed");
    }
    else
    {
        jabsx.fuzz = fuzz;
        jabsx.flat = flat;

        result_code = ioctl(joystick_fd, EVIOCSABS(axis), &jabsx);
        if (result_code < 0)
        {
            perror("ioctl SABS failed");
        }
    }
    return result_code;
}

2 个答案:

答案 0 :(得分:1)

关于模糊值,它似乎是用于abs输入设备的值。查看input.h中input_absinfo的文档 Link to input.h at lxr.linux.no

你可以找到

fuzz: specifies fuzz value that is used to filter noise from the event stream.

这意味着如果与最后一个值的差异低于模糊,linux中的输入系统将丢弃设备驱动程序生成的事件。这是在输入层完成的。

答案 1 :(得分:1)

flat值确定死区([源])(https://wiki.archlinux.org/index.php/Gamepad#evdev_API_deadzones)的大小。 fuzz很难找到,但我能找到的最好的是these docs

过滤(模糊值):不会报告微小变化以减少噪音

因此,似乎所有小于绒毛的更改都应被滤除/忽略。