input.h中input_absinfo结构中模糊和平坦的解释

问题描述 投票:1回答:2

我正在尝试通过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;
}
linux input event-handling device-driver
2个回答
1
投票

关于模糊值,似乎是用于绝对输入设备的值。在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中的输入系统将删除由设备驱动程序生成的事件。这是在输入层中完成的。


0
投票

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

过滤(模糊值):不报告微小更改以减少噪音

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

© www.soinside.com 2019 - 2024. All rights reserved.