RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Change/Disable F4 hotkey for terminal access

    Scheduled Pinned Locked Moved Help and Support
    terminalhotkeykeyboardshutdown scripttriggerhappy
    17 Posts 5 Posters 3.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      de_jean125 @de_jean125
      last edited by de_jean125

      @de_jean125

      Hi Guys,

      I found a workaround after days off searching
      Found a guide online how to create a shutdown script called by a trigger.

      1. thd --dump /dev/input/* --> Find out the event name of your click/tap/keypress

      2. sudo nano /etc/trigger.sh --> create script file:

      #!/bin/bash

      sudo /sbin/shutdown now

      1. sudo chmod +x /etc/trigger.sh --> make the script executable

      2. sudo nano /etc/triggerhappy/triggers.d/enterkey-shutdown.conf --> create a file for each trigger you want:

      KEY_ENTER 1 /etc/trigger.sh

      #(replace KEY_ENTER with the code you get from thd --dump /dev/input/* when pressed)

      1. sudo systemctl restart triggerhappy.service --> restart the service

      2. sudo visudo --> add the line below to the end, user nobody needs root previlages to power off the pi

      nobody ALL =NOPASSWD: /sbin/shutdown*

      1. All done, just create extra triggers in the /etc/triggerhappy/triggers.d/ folder for al the keys you want

      I know it's not clean, but it works.
      Created .conf files in the triggers.d/ folder for each letter in the alphabet and both the enter keys

      The F4 trigger did not work, guess this only works when the terminal is already open.
      But with conf files for all the letters, when someone wants to start typing, it goes in shutdown

      And SSH still works because the keyboard isn't attached to the Pi then :)

      D mituM 2 Replies Last reply Reply Quote 1
      • ClydeC
        Clyde
        last edited by

        Thanks for sharing your workaround for others.

        1 Reply Last reply Reply Quote 0
        • D
          dudleydes @de_jean125
          last edited by

          @de_jean125 You can edit the ES source code and compile. The line you're looking for is this one. You can either change the SDL key in that line or remove lines 241 to 247 if you wish to disable F4.

          This does mean that you would have to go through this process of editing the source code every time you wish to update ES.

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @de_jean125
            last edited by

            @de_jean125 Wouldn't it be easier to just edit the autostart.sh file that starts Emulationstation and just add a shutdown command after that ? If ES exits, then the next command will be the shutdown.

            1 Reply Last reply Reply Quote 2
            • D
              de_jean125
              last edited by de_jean125

              @dudleydes

              Wow, thank you !!!

              I adjusted to autostart.sh with the following:

              echo " ...some warnings..."
              sync
              sleep 10
              emulationstation

              echo "...some warnings..."
              sleep 10
              sync && sudo reboot

              The first time someone tries, he'll get a warning and emulationstation starts again after 10 sec.
              Second time it will reboot.

              Removed the F4 trigger, but left all the other ones.
              So if you press a key, it will still reboot.

              ClydeC mituM 2 Replies Last reply Reply Quote 0
              • ClydeC
                Clyde @de_jean125
                last edited by

                @de_jean125 said in Change/Disable F4 hotkey for terminal access:

                The first time someone tries, he'll get a warning and emulationstation starts again after 10 sec.
                Second time it will reboot.

                Nice idea. :)

                A pimped version would be to display a appropriately explicit picture instead of text. 😈 Alas, I don't know a command that would do that.

                D 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @de_jean125
                  last edited by

                  @de_jean125 Why do you need this ?

                  1 Reply Last reply Reply Quote 0
                  • cyperghostC
                    cyperghost
                    last edited by

                    @de_jean125 Do you want to sell something?

                    1 Reply Last reply Reply Quote 0
                    • D
                      de_jean125
                      last edited by

                      @mitu
                      @cyperghost

                      No, i'm building one for my dad, but he thinks he's an expert.
                      Don't want to troubleshoot it every week xD

                      mituM 1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @de_jean125
                        last edited by

                        @de_jean125 said in Change/Disable F4 hotkey for terminal access:

                        No, i'm building one for my dad, but he thinks he's an expert.

                        Oh, come on, you're not letting him tinker with the Raspberry Pi. Better get a 2nd sdcard with a backup system, so he can experiment.

                        cyperghostC D 2 Replies Last reply Reply Quote 0
                        • cyperghostC
                          cyperghost @mitu
                          last edited by

                          @de_jean125 @mitu If my dad once would tell me about ...

                          "Son, there is a hidden terminal in ES if you press F4."
                          Then I would answer: "Dad... you are a nerd"

                          1 Reply Last reply Reply Quote 0
                          • D
                            de_jean125 @mitu
                            last edited by

                            @mitu

                            you don't know my dad :p

                            1 Reply Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator
                              last edited by

                              Or just press Alt+2, Alt+3, etc.

                              D 1 Reply Last reply Reply Quote 0
                              • D
                                de_jean125 @mitu
                                last edited by de_jean125

                                @mitu

                                That's why i also use the triggers.
                                Made config files for all the letters in the alphabet, when he wants to start typing a command, the pi performs a shutdown.

                                Pi is only accessible with one ip, using host.allow config and ssh.
                                Gave it also a static ip in the 10.x.x.x range.

                                1 Reply Last reply Reply Quote 0
                                • D
                                  de_jean125 @Clyde
                                  last edited by

                                  @Clyde

                                  Something like this?

                                  Did it with alot of echo's :p

                                  0_1541973769805_IMG_20181111_210742_resized_20181111_090816250.jpg

                                  ClydeC 1 Reply Last reply Reply Quote 0
                                  • ClydeC
                                    Clyde @de_jean125
                                    last edited by

                                    @de_jean125 Something like that, yes. :)

                                    My first guess was that it was for your kid(s), by the way.

                                    You could even let it get nastier … "Stop or I'll hack into your bank account and send all of your money to homes for retired game programmers!"

                                    1 Reply Last reply Reply Quote 0
                                    • J jameth referenced this topic on
                                    • First post
                                      Last post

                                    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.