On RetroPie 3.5 installed on a Raspberry Pi 3b+ I was able to use the "power switch" when held up for >1s (usually mapping to ACPI sleep signal) for the following tasks:
Inside vice, enter the vice menu (instead of using "arrow up" as described in the wiki). Simply add inside sdl-vicerc
MenuKey=1073742106
(instead of MenuKey=281 for arrow up)
It is also possible to quit vice instead by using this button, but you will need to patch the vice sources. This can be done by first completing the "install from source" process for vice, start the "install from source" process again and interrupt it sometime during compilation. Then go inside "/home/pi/RetroPie-Setup/tmp/build/vice" and run something like
with vice_keyrah.patch containing:
- diff -urN vice-20190617/src/arch/sdl/ui.c vice-20190617_new/src/arch/sdl/ui.c
- --- vice-20190617/src/arch/sdl/ui.c 2019-07-07 21:26:02.000000000 +0200
- +++ vice-20190617_new/src/arch/sdl/ui.c 2019-07-07 21:28:42.000821767 +0200
- @@ -466,6 +466,7 @@
- while (SDL_PollEvent(&e)) {
- switch (e.type) {
- case SDL_KEYDOWN:
- + if ( e.key.keysym.scancode == 282 && e.key.keysym.sym == 1073742106 ) ui_sdl_quit(); // modified by Georg to quit on switch button UP
- ui_display_kbd_status(&e);
- retval = sdlkbd_press(SDL2x_to_SDL1x_Keys(e.key.keysym.sym), e.key.keysym.mod);
- break;
For emulationstation, a similar modification (power switch held up for >1s) to shut down the raspbian can be achieved by applying the patch (install emulationstation from sources, install again and interrupt the process in between), with emulationstation_keyrah.patch containing:
- diff -urN emulationstation-20190617/es-app/src/main.cpp emulationstation-20190617_new/es-app/src/main.cpp
- --- emulationstation-20190617/es-app/src/main.cpp 2019-06-16 22:26:07.000000000 +0200
- +++ emulationstation-20190617_new/es-app/src/main.cpp 2019-06-16 23:12:51.000000000 +0200
- @@ -381,6 +381,17 @@
- {
- do
- {
- + if ( event.type == SDL_KEYDOWN )
- + {
- + if ( event.key.keysym.sym == 1073742106 && event.key.keysym.scancode == 282 )
- + {
- + window.pushGui(new GuiMsgBox(&window, "REALLY SHUTDOWN?", "YES",
- + [] {
- + if (quitES("/tmp/es-shutdown") != 0)
- + LOG(LogWarning) << "Shutdown terminated with non-zero result!";
- + }, "NO", nullptr));
- + }
- + }
- InputManager::getInstance()->parseEvent(event, &window);
- if(event.type == SDL_QUIT)
Of course, in both cases you need to copy the built executables to the correct location, I did this manually:
and
(and/or the other vice executables like x128 etc.)
Maybe these hints can be of some help...