Reputation: 361
I'm trying to tweak the sensitivity of a joystick which does not work correctly with SDL, using the EVIOCSABS call from input.h. I think that the fuzz and flat members of the input_absinfo struct affect the sensitivity of the axes, but after not a few shots in the dark I'm still feeling stumped as to how they work exactly. I am hoping someone can point me in the right direction.
Thank you for considering my question! Here's the code I have written in my Joystick class:
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;
}
Upvotes: 8
Views: 2916
Reputation: 1294
How it is documented in Linux source:
/**
* ...
* @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.
* ...
*/
Upvotes: 0
Reputation: 10727
The flat
value determines the size of the dead zone ([source])(https://wiki.archlinux.org/index.php/Gamepad#evdev_API_deadzones). fuzz
is far harder to find, but the best I can find are these docs:
Filtering (fuzz value): Tiny changes are not reported to reduce noise
So it would seem that any changes less than fuzz are should be filtered out / ignored.
Upvotes: 3
Reputation: 514
Regarding the fuzz value it seems like a value used for abs input devices. Looking at the documentation of input_absinfo in input.h Link to input.h at lxr.linux.no
You can find that
fuzz: specifies fuzz value that is used to filter noise from the event stream.
Which means that the input system in linux will drop events generated by the device driver if the difference from the last value is lower than the fuzz. This is done in the input layer.
Upvotes: 2