-
-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking issue for input handler debugging #962
Comments
As addendum, here's an example set pagination off
set logging file gdb.output
set logging on
set $lx = 0
set $ly = 0
set $rx = 0
set $ry = 0
# user_io_l_analog_joystick()
break input.cpp:2196 if input[dev].pid == 8288 && x != $lx
commands
set $lx = x
p/x y << 8 | x
continue
end
break input.cpp:2196 if input[dev].pid == 8288 && y != $ly
commands
set $ly = y
p/x y << 8 | x
continue
end
# user_io_r_analog_joystick()
break input.cpp:2200 if input[dev].pid == 8288 && x != $rx
commands
set $rx = x
p/x y << 8 | x
continue
end
break input.cpp:2200 if input[dev].pid == 8288 && y != $ry
commands
set $ry = y
p/x y << 8 | x
continue
end
continue Usage: Compile MiSTer with
|
Another observation: A joystick configuration "2 buttons / 2 joysticks / joy 1 enabled / joy 2 disabled" causes ao486 core to slow down. This is observable by starting TIE Fighter with aforementioned configuration, then during intro music switch "2 joysticks" to "2 sticks" and the music tempo goes up considerably. |
Just use a better gamepad like DualShock 4, DualSense, XBox One.. |
Most issues mentioned above aren't controller specific. The one that is - garbage data in USB traffic - is now narrowed down to either a misbehaving device, or, what is starting to seem much more likely, a bug in the USB host controller driver (dwc2). |
Spamming input devices is known issue for long time already, especially if such joysticks have accelerometer. |
Over the past week or so, I've been trying to learn how controller inputs are handled. Mainly digging into
input.cpp
, to the bother and amusement of @birdybro (thanks for help!). In the process I've come across multiple issues, so I'm creating this issue for tracking the efforts.Related issues:
MiSTer-devel/ao486_MiSTer#181 (Analog joystick intermittent loss of inputs)
MiSTer-devel/ao486_MiSTer#127 (Joystick doesn't handle diagonal directions)
#723 (Feature request for ability to map Z axis/throttle)
Progress so far:
MiSTer
binary build with debug symbols (Compile without optimization fails #958)gdb
with scripting automation to drill into the codeAs part of debugging ao486 issue #127, I've used an iBuffalo gamepad for testing (0583:2060 Padix Co., Ltd (Rockfire) USB,2-axis 8-button gamepad). Existing button mapping was causing the problem with diagonals, but a more disturbing problem came up while looking into it. This gamepad is flooding the input event device node with bogus inputs, and this only happens on the MiSTer. To isolate the problem, I wrote a tiny test program:
Sample output for the iBuffalo event device:
This looks like jitter from an analog joystick, and most of it can be eliminated by defining a fuzz value for the device:
evdev-joystick --e /dev/input/by-id/usb-0583_USB_2-axis_8-button_gamepad-event-joystick --f 4
I suspect this is a problem caused by the controller and some workaround in the input driver on my test laptop (Linux 6.1) is hiding it, but the kernel on MiSTer (Linux 5.15.1) doesn't have it. Or, it's just another Linux bug. Whatever it is, having the MiSTer input handler deal with a flood of bogus inputs is a headache for both debugging the input handler and the handler itself. I'll try to overcome my aversion for reading/debugging Linux sources and find out what's going on.
Beyond that, it looks like I need to learn at least basics of HDL coding in order to understand how inputs are handled on the core side. ao486 specifically has some kind of automated switching between analog axis and digital d-pad modes, but the function and purpose of it is unclear.
The text was updated successfully, but these errors were encountered: