Kodi Community Forum

Full Version: Disable Specific Key for 5 Seconds After Being Pressed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In need of a specific solution to help my elderly father use his keyboard as a controller. He will often press and hold a key simply because in his old age his response time has slowed. He also will sometimes press - and hold - the key until something happens on screen.

Is anyone here familiar with how to disable a key immediately after being pressed for a period of time? I have looked around but have only learned how to configure a remote delay. We are using a traditional wireless USB keyboard. I imagine this would require a python script, but I am unsure how to query the current key pressed, let alone how to activate or deactivate specific keys.

Alternatively, if a method exists for controlled the key repeat rate within koi (or OSMC, which is the flavor I am using) that would be helpful as well.

I did try using the longpress property in the keymap, but this did nothing. I imagine that is not something used for keyboards, but instead for remotes.
longpress should work for keyboards as well. It should actually do what you want, as it will disable key-repeat. Just use the same action for both short and long presses.
(2016-02-26, 06:52)Ned Scott Wrote: [ -> ]longpress should work for keyboards as well. It should actually do what you want, as it will disable key-repeat. Just use the same action for both short and long presses.

I tested that with this in the keymap:

<d>VolumeUp</d>
<d mod="longpress">Mute</d>

I set them different just to test if the long press mod functioned with keyboards. It seems it does not unfortunately. But thank you for your help, I appreciate you taking the time to reply. Smile And if I am wrong, or appear to be configuring something wrong please let me know!

EDIT: Alas, it seems long press is unavailable for keyboards. (http://trac.kodi.tv/ticket/10932)
Thread moved to is independent.
Longpress for keyboards works for me on OS X and Android. What OS are you using?
Note that long keypress currently doesn't work if the os is sending repeating down/up messages (rather than down/down/down/... /up).

I started looking at this (because my cec config is doing exactly that), but it's not that easy, especially because it's hard to distinguish a repeating up from a final one without implementing some kind of timeout, which renders keypresses generally sluggish...

P.S If the os has an "auto-repeat" setting, maybe try to disable it.