Simulate escape key press using Python?

Welcome Page Forums RetroPie Project Everything else related to the RetroPie Project Simulate escape key press using Python?

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of matthewjosephcordova matthewjosephcordova 2 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #100700

    I’m working on a console and having difficulty shutting down emulators using a button on the GPIO. I’ve been able to use a kill -TERM command that works well for most emulators. I’d probably do better simulating an escape key press. Would someone please help. What code is needed exactly to simulate that key press?

    I’m currently using
    ‘os.system(‘kill -TERM %s’ %pid)’
    With good success but it doesn’t work with mame4all.

    #100739
    Profile photo of sselph
    sselph
    Participant

    Bear in mind I haven’t actually tried this but found this which might work:
    https://github.com/tuomasjjrasanen/python-uinput

    One of the examples is generating keyboard clicks

    Auto-scraper: https://github.com/sselph/scraper

    #100747

    Thanks for the reply, but I did end up figuring it out. I’ll post a guide this weekend. Basically some emulators don’t accept a sigterm and some don’t accept a uinput. Don’t ask me why…

    I did however manage to write some code that exits all my emulators to ES gracefully without using sigkill and using a pin on the GPIO and a single external button and without using snesdev.

    #100763

    Please see the following link to resolve the problem,

    How to: Exit emulator to emulationstation using GPIO button

Viewing 4 posts - 1 through 4 (of 4 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar