Check if game is running using command line
-
Hi,
i would like to power off my raspberry pi fan, as soon as i am not in-game any more and power it on again, whenever I launch a game.
My question: Is there a way to determine (e.g. via command line) if there is any game opened/active independent from the currently used emulator.
Btw: I have the latest retropie Image on the Raspi 3b+.Thanks for your Support.
-
How is your fan connected to the RPi?
-
@petrockblog One wire of the FAN is connected to 5V pin. The other wire is connected to an n-channel mosfet, that is used as a switch for the FAN. I am using GPIO18 to control the mosfet, increase/decrease speed. So i am already able to control the FAN.
-
You could run Bash commands for controlling the GPIO pin from within the run command script. A good starting point would be the last function within that script. The script is located at
/opt/retropie/supplementary/runcommand/runcommand.sh
. It gets called with every start and exit of an emulator. -
You might also try using the runcommand-onstart and runcommand-onend scripts:
https://retropie.org.uk/docs/Runcommand/#runcommand-onstart-and-runcommand-onend-scriptsonstart runs before a game starts and onend runs after a game exits. Note: these on-scripts and the runcommand.sh will only work for emulators/games that launch through Runcommand. I believe just about everything on RetroPie using the Runcommand but their might be something that doesn't. Just a troubleshooting heads up for the future ;)
-
I like that suggestion even more than mine :-)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.