As the title suggests, I'm trying to launch RetroPie from a Pygame script. I'm using a 2.8" PiTFT from Adafruit.
In order to launch EmulationStation on the PiTFT, I'm using fbcp. In order to display Pygame on the TFT, I'm using this code in my main script:
os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
After doing so, I simply run:
pygame.init()
From within my main Pygame script, I call another script which uninitializes Pygame, and runs fbcp and EmulationStation like so:
subprocess.Popen("fbcp")
subprocess.Popen(shlex.split("sudo -u pi 'emulationstation'"))
Here's the thing, though; when run from my main Pygame script, EmulationStation works as normal, however, when I try to launch an emulator, RetroPie returns the following error:
/opt/retropie/supplementary/runcommand/runcommand.sh: line 666: /dev/tty: No such device or address
/opt/retropie/supplementary/runcommand/runcommand.sh: line 695: /dev/tty: No such device or address
...and just returns to EmulationStation.
However, when I run the subscript directly, the emulator works as normal.
Last I checked, /dev/tty
was a file, and did exist. What does this error mean? Is it something with my modification of the environment variables? Or is Pygame just being problematic? How would I go about fixing this?
UPDATE: Deleting the environment variables seemed to have no effect on the script. I deleted the environment variables like so:
os.environ.pop("SDL_FBDEV")
os.environ.pop("SDL_MOUSEDEV")
os.environ.pop("SDL_MOUSEDRV")
...but the script still wouldn't launch the emulator. It raises the same error. When Pygame launches, how does it affect the system? Is anything significant altered?