Skip to content
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

Joystick events not detected under netboot #1987

Open
fiskn opened this issue Jun 4, 2023 · 10 comments
Open

Joystick events not detected under netboot #1987

fiskn opened this issue Jun 4, 2023 · 10 comments

Comments

@fiskn
Copy link

fiskn commented Jun 4, 2023

It appears that with the current systemd service included with the netboot script that launches startx with the EE binary as a parameter. This seems to means that joysticks although detected do not register events inside EE and so cannot be used.

I can fix this behaviour by instead changing the service to simply just call the EE binary direct, which auto launches X anyway
ie ExecStart=/root/EmptyEpsilon/EmptyEpsilon

I suspect this may have something to do with X and window focus so events are not being forwarded to SDL correctly, but I'm not sure if my "fix" is the correct way or just a lucky workaround?

@daid
Copy link
Owner

daid commented Jun 5, 2023

Odd and interesting. It might have something to do with startup order? Maybe X is started this way before joystick drivers are loaded?

I didn't know X could auto start like that. Any idea how that works? Is it something that systemd does? Or SDL2?

@fiskn
Copy link
Author

fiskn commented Jun 5, 2023

I'm not 100% sure at the moment what is happening, I can see in the EE startup logs that the joystick is detected, just that the events are not captured either in game or on the hot key binding screen.

After doing lots of searching the only thing I could see that might have been related was that by default SDL won't capture joystick events, so wasn't sure if the way X was starting meant the EE "window" was not in focus, or something odd like that.

It was purely by accident that I noticed I could launch EE without starting X, as I was trying to view the EE startup logs from a remote SSH session and when I ran the binary, the local screen suddenly loaded up EE and the joystick was working. I then tried running the startx cmd from the same SSH session and the joystick was not working again.

@daid
Copy link
Owner

daid commented Jun 5, 2023

Oh, I think I know how X11 auto starts. That is most likely systemd socket activation magic.

I am confused about the joysticks, I thought SDL2 just goes to the input event system of linux for that.

@fiskn
Copy link
Author

fiskn commented Jun 5, 2023

I think this was the thread that made me think it was a focus issue:
libsdl-org/SDL#1393

No idea if it is a focus issue, but it seemed to be a likely reason. Although no idea what not running with startx allows it to work. Also mouse and keyboard are fine, which confuses matters.

@daid
Copy link
Owner

daid commented Jun 5, 2023

That mentions pretty old SDL2 versions, I don't think the netboot is on a version that old (even if it is on old stuff)

@fiskn
Copy link
Author

fiskn commented Jun 5, 2023

Sorry, should have been more clear, I didn't necessarily think the bug was the issue, but that maybe there was some confusion about window focus, effectively there being no window manager involved. And also if the SDL hint for background joystick events were of any use

I might try rebuilding SP with the hint for background joystick events:
https://wiki.libsdl.org/SDL2/SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS

@gwaland
Copy link
Contributor

gwaland commented Jun 5, 2023

I wonder if this is related to the issue I was having with my touch screens. Just for laughs you might try starting icewm and then starting empty epsilon and see if the issue is still there when there's a window manager present.

I'll try your fix in my configuration soon since I have another game this saturday.

@fiskn
Copy link
Author

fiskn commented Jun 6, 2023

So it looks like when I'm directly running the EE binary X isn't actually in use, at least I can't see it running anywhere, not sure if SDL is using its KMS direct screen driver.

Anyway, this doesn't really matter anymore as after I re-compiled SeriousProton including the SDL hint for background joystick events, it seems to have fixed the problem when running under X.

@daid
Copy link
Owner

daid commented Jun 7, 2023

Oh, I tought the KMS driver was not enabled by default in SDL2. That might actually give slightly better performance then with X11.

@fiskn
Copy link
Author

fiskn commented Jun 7, 2023

Oh, I tought the KMS driver was not enabled by default in SDL2. That might actually give slightly better performance then with X11.

It possibly does, but I spent several hours trying to work out how to calibrate a touchscreen when not running under X and then gave up.

Would you like a PR for the SDL hint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants