Libreelc12 +Argon one m2 +rpi4: khadas ir-remote power on: how to do this?

The code contains the LIRC compatible interpretation of the OBC (Original Button Code) for the KEY_POWER command. The needed byte sequence for the program command is part of the argon1.sh sub scripts. And the default power-on byte sequence is the same like in the old style argon.lircd.conf.

The first challenge was to me, to find if there some information available about the Khadas IR remote and if this support NEC protocol. I didn’t know these remote before and unfortunately the toml file wasn’t provided with your first post. After some research found a mentioned toml content in a forum and also a OBC list in some code snippets at Khadas Wiki, but these are a better source: https://git.linuxtv.org/v4l-utils.git/tree/utils/keytable/rc_keymaps

The second challenge was to find a way to convert between the OBC values and the LIRC style. I knew that there exist a convert script from lirc2toml, but here the counter part was needed and I was to lazy and to much time consuming to inspect the algorithm. I used IrScrutinizer, imported the old argon.lircd.conf to have a working start. Changed the OBC I knew from the toml files from 0x9c to 0x14 and exported to LIRC format. Voila, afterwards I could find the byte sequence “0x00ff28d7” for the KEY_POWER OBC 0x14 of the Khadas remote in the export file.

The third callenge was to research how I could reduce the script function to a CLI version with i2cset.

  • Select the I2C bus (already known)
    i2cset -y 1
  • Set the I2C slave adress of MCU (already known)
    0x1a
  • Set the target register value for IR byte sequence programming (constant: 0xaa for V2, 0x82 for V3 cases MCU firmware)
    0xaa
  • Payload with the LIRC byte sequence of the OBC 0x14
    0x00 0xff 0x28 0xd7
  • Send message in I2C block write mode, because the payload contains more than 1 byte
    i

That’s it.

It’s up to your use case, whether match that the RPi5 starts automatically after power outage or not.

No, the MCU isn’t involved in the HDMI connection and the RPi bootloader doesn’t support HDMI CEC as a wake-on signal in power off state. But depending on your TV setting you could start the Argon case with LibreELEC via remote control first, usually the CEC will trigger that the TV power on - if you doesn’t made other settings.

1 Like