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

    (SOLVED) Set keyboard repeat delay

    Scheduled Pinned Locked Moved Help and Support
    keyboard
    13 Posts 2 Posters 679 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.
    • C
      Cesarpuig
      last edited by Cesarpuig

      Hello.

      I have Retropie 4.8.2 installed on a RPI4, today updated

      I use a U-HID for my controls.

      U-HID has the ability to configure any key as a shift function (long press). I have the problem that when I make a short press on the key that I have assigned with the shift function, 6 presses are repeated.

      I have made a query to U-HID support, and they have answered the following:

      The auto-repeat is being done by the host not the U-HID.
      If you change the keyboard settings on the host you could eliminate this.
      The shift control sends a short held pulse of the key when released. Depending on the keyboard settings this will be >long enough to trigger “typematic” on the host or not.

      Can someone tell me how I can configure the repetition time, the delay time and how to know the values ​​that the system has assigned by default?

      Thank you

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

        How are you testing this ? From the terminal or some other utility ?

        C 1 Reply Last reply Reply Quote 0
        • C
          Cesarpuig @mitu
          last edited by

          @mitu From terminal

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

            I think it's unlikely that's a host (Linux) issue, are you sure you haven't configured some sort of 'turbo' behavior for the key ?
            You can run evemu-report [1] and see what events are reported when you press the key and the associated timings between the events. For a regular keyboard, you can adjust the initial delay and the repeat rate using kbdrate, but that's only applied to the console terminal, results for using an emulator may vary.

            [1] evemu-report is part of the evemu-tools package, not installed by default on RetroPie. You can install it with sudo apt install evemu-tools.

            C 1 Reply Last reply Reply Quote 1
            • C
              Cesarpuig @mitu
              last edited by

              @mitu

              I think it's unlikely that's a host (Linux) issue, are you sure you haven't configured some sort of 'turbo' behavior for the key ?

              If I connect the U-HID to windows the problem does not occur. There is no possibility to configure short press or turbo function. In the following image you can see my configuration.
              U-HID Config.png

              You can run evemu-report [1] and see what events are reported when you press the key and the associated timings between the events.

              I have made a press of the number 1 the key that I have assigned as shift and it is repeated and the number 2, this is the result:

              evemu-record .jpg

              What repetition and delay times are there by default, and which ones should I configure so that it does not happen to me?

              but that's only applied to the console terminal, results for using an emulator may vary.

              At the moment I have only detected the problem in the terminal and in SDLPOP, I will investigate to see if it is reproduced in any other system.

              Thanks

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

                @Cesarpuig said in Set keyboard repeat delay:

                What repetition and delay times are there by default, and which ones should I configure so that it does not happen to me?

                Seems obvious from the test - 250ms for the initial delay, then 50ms for the subsequent repeat events.
                This is quite similar to a keyboard, when you keep a key pressed for more than 1 second - I get the same output when I keep the 1 key pressed. However, if I press it briefly, there's just one input recorded.

                You can control the initial repeat delay using kbdrate, as posted before, but perhaps the key becomes 'sticky' when used as a 'shift' modifier. What happens if you press it in combination with other key ? Does it produce the same number of repeated inputs at 50 ms ?

                C 1 Reply Last reply Reply Quote 0
                • C
                  Cesarpuig @mitu
                  last edited by

                  @mitu said in Set keyboard repeat delay:

                  What happens if you press it in combination with other key ? Does it produce the same number of repeated inputs at 50 ms ?

                  If I press it in combination with another key, it fulfills its purpose, and the behavior is as desired, in the following photo you can see how it works, there are three presses of three different keys

                  evemu-record.jpg

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

                    @Cesarpuig said in Set keyboard repeat delay:

                    If I press it in combination with another key, it fulfills its purpose, and the behavior is as desired

                    Then my guess is that the key becomes 'sticky' when 'shifted', so it's not sending the 'release' event when the key is actually released. Pressing another key in combination tells it to send the 'release' event.
                    This is kind of what the U-HID manual says:

                    This is rather like a keyboard shift key which, when held, causes the keyboard keys to send different characters. When the internal shift connection is activated and held, the Secondary function of all other keys is sent instead of the Primary.

                    C 1 Reply Last reply Reply Quote 0
                    • C
                      Cesarpuig @mitu
                      last edited by Cesarpuig

                      @mitu

                      I run the command kbdrate -d 350 -r 75 and the key works as expected, but if I restart the system or emulationstation and the problem repeats.

                      I have followed the instructions of the link that you provide me and I have created the kbdrate.service file with the following code, but it has not helped me either.

                      [Unit]
                      Description=Keyboard repeat rate in tty.
                      
                      [Service]
                      Type=oneshot
                      RemainAfterExit=yes
                      StandardInput=tty
                      StandardOutput=tty
                      ExecStart=/usr/bin/kbdrate --silent --delay 350 --rate 75
                       
                      [Install]
                      WantedBy=multi-user.target
                      
                      

                      Can I add this line kbdrate -d 350 -r 75 to some file so that it will be executed during startup?

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

                        Did you also enable the service after adding it ? If you run systemctl status kbdrate, does it show that it has run ?

                        Can I add this line kbdrate -d 350 -r 75 to some file so that it will be executed during startup?

                        You can add it to the autostart.sh script, before the emulationstation start-up line.

                        C 1 Reply Last reply Reply Quote 0
                        • C
                          Cesarpuig @mitu
                          last edited by

                          @mitu said in Set keyboard repeat delay:

                          Did you also enable the service after adding it ? If you run systemctl status kbdrate, does it show that it has run ?

                          Yes, I have enabled the service, but it gives me the following error:

                          /usr/bin/kbdrate: No such file or directory.
                          
                          mituM 1 Reply Last reply Reply Quote 0
                          • mituM
                            mitu Global Moderator @Cesarpuig
                            last edited by

                            @Cesarpuig said in Set keyboard repeat delay:

                            Yes, I have enabled the service, but it gives me the following error:
                            /usr/bin/kbdrate: No such file or directory.

                            That's because there's no such file, kbdrate is located at /sbin/kbdrate.

                            C 1 Reply Last reply Reply Quote 0
                            • C
                              Cesarpuig @mitu
                              last edited by Cesarpuig

                              EDIT Solved I have disabled and removed the kbdrate service from sytemd. I have then recreated and enabled it again and I no longer get any errors and my U-HID works as desired.

                              Thank you very much again.

                              @mitu said in Set keyboard repeat delay:

                              That's because there's no such file, kbdrate is located at /sbin/kbdrate.

                              Thank you very much, I was trying to find the correct route, but there was no way.

                              Now the operation is as desired, the replay problem in the console and in the SDLPOP port has been solved. I have to test the rest.

                              The funny thing is that despite working, it still gives me an error at the start of kbdrate

                              ● kbdrate.service - Keyboard repeat rate in tty.
                                 Loaded: loaded (/etc/systemd/system/kbdrate.service; enabled; vendor preset: enabled)
                                 Active: failed (Result: exit-code) since Thu 2022-08-04 19:17:26 CEST; 3min 0s ago
                                Process: 456 ExecStart=/sbin/kbdrate --silent --delay 350 --rate 75 (code=exited, status=1/FAILURE)
                               Main PID: 456 (code=exited, status=1/FAILURE)
                              
                              ago 04 19:17:25 retropie systemd[1]: Starting Keyboard repeat rate in tty....
                              ago 04 19:17:26 retropie systemd[1]: kbdrate.service: Main process exited, code=exited, status=1/FAILURE
                              ago 04 19:17:26 retropie systemd[1]: kbdrate.service: Failed with result 'exit-code'.
                              ago 04 19:17:26 retropie systemd[1]: Failed to start Keyboard repeat rate in tty..
                              
                              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.