Posts by Veedub

    Just to throw this out there as a possible solution and even a mention of some sort on the remote sections of the Wiki - The Ardruino microcontrollers with the ATmega32u4 chip get recognised as USB keyboards so very easy to pick one up cheaply and convert your current GPIO IR-Receiver to USB,

    lots of support for Ir-Receiver libraries for ardruino and plenty of guides and code on github to map remote buttons then remap them via the keyboard.xml file


    Effectively giving the same outcome as Flirc device

    That's what i thought, thanks for the input, looks like a bit of refactoring is required ^^


    Update:

    Turns out there was a few reasons for above to happen, with using serial UART the ser.close() was causing the script to fail as I had it in a for block rather than at the end of the file and also the USB capture device, when in use was playing havoc with the IR receiver so it would appear this also applies to the Pi4 Infra-Red Remotes - LibreELEC.wiki


    As the system looks like its not responding when pressing the button on the remote but if controlled via web remote it operates normally.


    Least I got to the bottom of it, Just need to find a USB Ir-receiver instead of GPIO receiver

    Did you also try to run myscript.sh containing python myscript.py inside to test if there's a same issue?


    The another solution perhaps could be to run the python script permanently, sniffing for the commands which you could put somewhere by another script invoked by button...

    Yeah I tried that but no joy same result as running the .py script. Good shout on the sniffing though I might look into that later see if i can figure something out that way.


    If you run that script as root, it does not matter what permissions are set on device. You got rw permissions as owner. If you face permission problem in /dev/, you should understand why permissions are causing the problem and fix that instead of changing permissions on devfs.

    Yeah I was wondering about that initially but realised that root could run it regardless shortly after, Do you know what user kodi runs as?

    Thanks Da Flex it didn't make any difference, its driving me nuts now as it turns out with or without the UDEV rule the script runs fine from the terminal as the root user, works exactly as expected first time every time its ran. But will not run from the button press even though kodi sees the key press and attempts to run it.


    Code
    2021-01-14 23:38:33.399 T:3011923984 DEBUG: HandleKey: 202 (0xca, obc53) pressed, action is System.Exec("/storage/myscript.py")


    Things just got weirder, Finally got it working by replacing System.Exec("/storage/myscript.py") with RunScript("/storage/myscript.py")

    but it will only run once or twice then it stops working, then running it from the terminal does not work either, reboot and same again 1-2 work then non responsive in terminal.


    but if i reboot and don't do the button press i can run it a dozen times in the terminal and it works every time.

    Are you using the HDMI port closest to the power plug (HDMI0)?


    I cant get any sound from mine if i don't use that port, even tried a clean reinstall with HDMI plugged into HDMI1 port but still no joy so i have came to the conclusion that it is only used as an additional display port for running 2 monitors and sound will only ever come out the one closest to the power adapter.


    Remember to add the line below to the config.txt if you want to use 4k resolution

    [code]

    hdmi_enable_4kp60=1<br>

    [/code]

    Hi

    I am trying to run a script from a remote control button press, I have tested with 2 python scripts on 2 different buttons and switched them over when testing, either button will only run one of the scripts.


    The script that wont run is using UART on /dev/ttyS0 and originally Python CLI wouldn't run it as it was in dialout group, quick chown and it ran in Python and the terminal with no problem, after rebooting the permissions have reverted back to root:dialout

    Code
    LibreELEC:/dev # ls -la ttyS0  
    crw-rw----    1 root     dialout     4,  64 Jan 14 20:01 ttyS0


    How do i change it permanently so root can run from the terminal if needed and kodi can run it via the button press?

    Code
    System.Exec("/storage/myscript.py")

    I faced the same problem recently, CEC was too unreliable to determine tv state, I spun up a quick python docker with pyserial and it worked nicely but running the scripts on libreelec to the docker was hassle and a bit overkill for what i needed it for, so ended up creating an add-on to pull the required modules.


    Don't know if your up for that challenge, but if not you could try downloading the Hello World Tutorial GitHub - zag2me/script.hello.world: Hello World Add-On Script for Kodi/XBMC and modify the requires section in script.hello.world/addon.xml at master · zag2me/script.hello.world · GitHub to pull the modules you need, zip it then install it on libreelec


    Code
    <requires>
    <import addon="xbmc.python" version="2.25.0"/>
    <import addon="script.module.routing" version="0.2.0"/>
    <import addon="script.module.pyserial" version="3.4.0"/>
    <import addon="script.module.requests" version="2.22.0"/>
    <import addon="script.module.chardet" version="3.0.4"/>
    <import addon="script.module.certifi" version="2019.9.11"/>
    <import addon="script.module.idna" version="2.8"/>
    </requires>


    Here is a snippet to show it in action, the 01 is showing the TV is on, It initially wouldnt work as i couldnt add root to the dialout group so ended up changing ownership of /dev/ttyS0 to root


    The other option could the install the System Tools add-on from Libreelec repo and use screen instead of pyserial


    Code
    screen /dev/ttyS0 9600,cs8


    :thumbup:

    Try with "guide" instead of "epg" in the keymap.xml file. The "KEY_EPG" code is mapped to the "guide" button in Lircmap.xml (see the devinput section).


    so long,


    Hias

    Wow, worked first time Hias, thanks - I feel like a bit of a tool tbh as out of all the things i could have chosen i picked that one and didn't look in the Lircmap.xml file :blush:


    Happy days tho i can reset the remote and map all the buttons.


    Thanks again


    You wouldn't happen to know where i can change the

    Code
    Repeat delay = 500 ms, repeat period = 125 ms



    Just to add: in case someone googles that remote at any point, by default there are 4 buttons that cannot be coded as they are reserved (netflix, Amazon buttons etc) by resetting the remote and not enabling CEC and using NEC protocol they can be remapped, despite what One for All say.

    Should you not have posted some details on what the armlogic device is?


    I thought most of them have been running coreelec for years due to libreelec not being supported.


    you could downgrade to latest stable version until the stable version of the beta is completed or get a device that is supported, all depends on what your using it for and the addons that your running on it as they could be whats making it unstable, hope that makes sense


    Good Luck

    Hi, I'm looking for a bit of advise regarding a One 4 All streamer remote control and GPIO IR receiver, I followed the wiki on infared remotes and configured it the hard way and it is working as expected, excluding the occasional double button press when pressing up or down.


    Keymap file


    rc_maps.cfg

    Code
    LibreELEC:~/.config # cat rc_maps.cfg
    # Keymaps table
    * * streamer_remote


    Ideally I would like to remap a few of the buttons to run a few scripts but no matter what i have tried it doesn't seem to work, I tried to add a keymap.xml to kodi userdata folder but it doesn't seem to have any effect


    Code
    LibreELEC:~/.config # cat ../.kodi/userdata/keymaps/keymap.xml  
    <keymap>
     <global>
       <remote>
         <epg>System.Exec("/storage/cycle-source.sh")</epg>
       </remote>
     </global>
    </keymap>


    Am i doing something wrong or would it be better and easier to revert to the LIRC method?


    Also can a bash script be ran or would a python be more appropriate?


    any help or assistance would be appreciated :thumbup: