Reading Input keys from a RCU to use in a script

  • Hello,

    reading this thread and post #2 I read the interesting part about the RcCode:

    how do I execute a script every time the channel is changed?


    And I was exactly looking at a way to read the RCU input in a script.

    Using linux commands like "read" or "select", the script works if launched by telnet.

    But it got stuck if launched by the GUI: it simply does not perform any input reading and the only thing I can do to exit the script is restarting GUI by telnet.

    I can I tell the script I pressed, for instance, OK or EXIT?


    Thanks

  • I remember I participated in that thread, unfortunetly getrc is not working in enigma2, I compiled for myself a simplified evtest just giving me the return code on pressing a key on the remote control, i.e. pressing the OK code gives me


    /var/volatile/tmp# ./evtest

    Usage: evtest /dev/input/eventX

    Where X = input device number


    /var/volatile/tmp# ./evtest /dev/input/event2


    /var/volatile/tmp# ./evtest /dev/input/event2

    352


    the drawback, I must stop enigma2 otherwise no code is returned

    in the archive is compiled evtest armhf version, both simplified and full with source

  • I forgot to mention that you have to put evtest in path i.e /usr/bin and chmod 755 evtest, a simple script to detect the key pressed would be

    Bash
    #!/bin/sh
    
    # evtest.sh
    key=`evtest /dev/input/event2`
    echo $key
    exit;

    event number may vary on your box /dev/Input/eventX