Closed Oneil974 closed 2 years ago
This is a peculiar one. My first guess would be that your webgl games are looking for a "device connection" event or need something else to load before gpionext. Can you post the script that you used to restart it? How is your script being run? (rc.local? cron job?)
I would try editing /lib/systemd/system/gpionext.service
to get gpionext to run later.
You can copy and paste this over the original file or just change simple to idle in the original. This is just a simple workaround to get it to run later, there's a more complex way to get it to run last if we can determine that is needed
(notice the type changes to idle)
[Unit]
Description=gpionext-daemon
[Service]
Type=idle
WorkingDirectory=/home/pi/gpionext
ExecStart=/usr/bin/python3 -u gpionext.py --debounce 1 --combo_delay 50
Restart=on-failure
RestartSec=1
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
Oh thanks for your answers. I tried idle in type but it doesn’t work. Yes I’m trying to reload it with rc.local but it look like to run before chromium launch because when I had a sleep in it deferred chromium launch. I think you are right with event listener, that would be why gamepad tester work without restart. Another thing, after restart gpionext manually, even if I restart chromium or refresh the page, everything works good. If you have another idea to start it later? I’m creating a UI with nodejs and I think I’ll try to make it restart by nodejs when the UI would be loaded and then maybe it could works. Does the user used to launch script take importance?
Try this: edit /lib/systemd/system/gpionext.service
Just above the line that reads: WorkingDirectory=/home/pi/gpionext
add the line: ExecStartPre=/bin/sleep 20
That should cause it to sleep for 20 seconds before running gpionext.
Doesn’t works at all :( Is there a difference between service starting commands and « gpionext stop » then « gpionext start » ?
no, gpionext stop
is equivalent to sudo systemctl stop gpionext
gpionext start
is equivalent to
sudo systemctl enable gpionext
sudo systemctl start gpionext
and
gpionext reload
is equivalent to
sudo systemctl stop gpionext
sudo systemctl daemon-reload
sudo systemctl start gpionext
From what it sounds like, gpionext is running, just not being picked up by your games until it's reloaded. You could try just wiring and extra button (or use gpionext builtin button combos) to send a custom command that would reload gpionext.
Hey nice idea it works, use combo button with command (in my case start+select) make the service reload with this command : su - pi gpionext reload But for a strange reason it take about a minute (or more) to restart… After running command with this method it take long time even in ssh method
I try this script to wait for chromium start
I get it work with script but after 20-30s sleep but it takes long time to restart. I am speaking with js gamepad extension’s dev see what could be done on js code side
cool. I'm going to close this issue, since we seem to have found a passible workaround but I'd be interested to know what the JS gamepad dev has to say.
Hey problem is solved (but…partially). In fact it was not a problem with loading service but gpionext is returning the wrong gamepad index number. Instead of the default 1 the gamepad is assigned to number 2 On the bottom left the index of gamepad connected Is there any way to adjust it?
You may be able to create a udev rule to account for this, though I don't know specifically what it would look like. As far as on my side of the software, evdev doesn't have any way to set that as far as I can recall. You can try checking the docs. Do you have any other peripherals plugged in? is the screen touch sensitive? gpionext should just be listed as the first available controller.
It looks like mk_arcade_joystick driver take the first place. But when I disable it, gpionext no more work in game (but always in tester), it seems to take the number 0 and not supported for game. I’ll try newer install from scratch to look if it works better. I’ll send you all details when done. Thank for your answer and your time
Hello,
So first thank for your work I’ve searched for a while to found a library that could make my Game Hat working with webgl games.
But I have a strange issue that occurs, in an html5 api gamepad tester it works perfectly but in some webgl games I must stop and start gpionext once to make it works.
I tried to reload it with a script at startup but it doesn’t works, maybe my script is wrong. I use chromium-kiosk and when I stop and start it from ssh command as pi user it works fine.
Have you an idea of how I could bypass this? Thanks