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

    USB gamepad and GPIO hotkey

    Scheduled Pinned Locked Moved Help and Support
    hotkeygpio
    5 Posts 2 Posters 551 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.
    • M
      mgrunt
      last edited by

      Hi,
      I'm using USB gamepad and I want use separate hotkey (to view retroarch menu) connect to GPIO.

      I defined GPIO key in /boot/config.txt
      dtoverlay=gpio-key,gpio=26,label="KEY_ESC",keycode=1

      When I run evtest i get this (key escape is working):

      Available devices:
      /dev/input/event0: USB gamepad
      /dev/input/event1: button@1a
      /dev/input/event2: ADS7846 Touchscreen
      Select the device event number [0-2]: 1
      Input driver version is 1.0.1
      Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
      Input device name: "button@1a"
      Supported events:
      Event type 0 (EV_SYN)
      Event type 1 (EV_KEY)
      Event code 1 (KEY_ESC)
      Properties:
      Testing ... (interrupt to exit)
      Event: time 1630670854.319443, type 1 (EV_KEY), code 1 (KEY_ESC), value 1
      Event: time 1630670854.319443, -------------- SYN_REPORT ------------
      Event: time 1630670854.449281, type 1 (EV_KEY), code 1 (KEY_ESC), value 0
      Event: time 1630670854.449281, -------------- SYN_REPORT ------------

      But I still don't know how to configure
      \\retropie\configs\all\retroarch.cfg

      I tried some combinations of parameter settings

      input_enable_hotkey_btn
      input_enable_hotkey

      But nothing works.

      When I enter to the retroarch menu (Main menu - Settings - Input - Hotkey Binds - Hotkeys), changing the hotkey does not work. It does not respond at all to pressing the GPIO key. How to do it?

      Thanks

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

        What does the following command show ?

        udevadm info  --query all /dev/input/event1
        
        M 1 Reply Last reply Reply Quote 0
        • M
          mgrunt @mitu
          last edited by

          pi@retropie:~ $ udevadm info  --query all /dev/input/event1
          P: /devices/platform/button@1a/input/input1/event1
          N: input/event1
          L: 0
          S: input/by-path/platform-button@1a-event
          E: DEVPATH=/devices/platform/button@1a/input/input1/event1
          E: DEVNAME=/dev/input/event1
          E: MAJOR=13
          E: MINOR=65
          E: SUBSYSTEM=input
          E: USEC_INITIALIZED=28639720
          E: ID_INPUT=1
          E: ID_INPUT_KEY=1
          E: ID_PATH=platform-button@1a
          E: ID_PATH_TAG=platform-button_1a
          E: LIBINPUT_DEVICE_GROUP=19/1/1:gpio-keys
          E: DEVLINKS=/dev/input/by-path/platform-button@1a-event
          E: TAGS=:power-switch:
          
          
          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            RetroArch may be ignoring the inputs from your GPIO - see https://github.com/libretro/RetroArch/pull/12830 for context.

            M 1 Reply Last reply Reply Quote 0
            • M
              mgrunt @mitu
              last edited by

              Thank you. Now it's working!!!

              I add this rule to

              /etc/udev/rules.d/99-input.rules

              SUBSYSTEM=="input", ATTRS{name}=="button*", MODE="0660", ENV{ID_INPUT_KEY}="1", ENV{ID_INPUT_KEYBOARD}="1"
              

              And now have GPIO key ID_INPUT_KEYBOARD parameter too.

              pi@retropie:~ $ udevadm info  --query all /dev/input/event1
              P: /devices/platform/button@1a/input/input1/event1
              N: input/event1
              L: 0
              S: input/by-path/platform-button@1a-event
              E: DEVPATH=/devices/platform/button@1a/input/input1/event1
              E: DEVNAME=/dev/input/event1
              E: MAJOR=13
              E: MINOR=65
              E: SUBSYSTEM=input
              E: USEC_INITIALIZED=28281822
              E: ID_INPUT=1
              E: ID_INPUT_KEY=1
              E: ID_PATH=platform-button@1a
              E: ID_PATH_TAG=platform-button_1a
              E: LIBINPUT_DEVICE_GROUP=19/1/1:gpio-keys
              E: ID_INPUT_KEYBOARD=1
              E: DEVLINKS=/dev/input/by-path/platform-button@1a-event
              E: TAGS=:power-switch:
              

              Bidding hotkey to GPIO key is now working.

              1 Reply Last reply Reply Quote 0
              • 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.