Argon IR Remote

I bought the Argon IR Remote thinking it could be used with multi-media apps in general. It seems that it only supports kodi atm and I think using a Pi5 for just that is a waste.

Does anyone know how the IR buttons appear in the OS? I had assumed that the multi-media buttons would be allocated to keystrokes. I’ve had no problems in the past making USB remotes that generate the codes representing the multi-media keys on the keyboard. If I just knew how the IR remote appears in the OS I could try the same thing.

In order not to write it twice, I will direct you to some summarized information here:

Perhaps it answers some questions.

@HarryH
Thanks for that.

LIRCD seems to be just the job. From the man page :-

lircd - Decode infrared signals and provide them on a socket.

From one of your links:-

argon.lircd.conf

So, I assume the RP2040 receives the infra-red signals and presents them to the Pi5 OS as a /dev socket. Now I ‘just’ have to convert what is presented at the socket into keystrokes without running the processors at 100% How difficult could it be?

I suspect that libreelec_package_argonforty-device may provide additional code.

Hi @royleith ,

The RP2040 isn’t visible inside of the OS. This chip is like a satellite at the I2C bus. Additional the RP2040 is connected in parallel to GPIO23 to see the IR signals in raw.

For the OS the gpio-ir overlay is the important part for you to enable. Regarding the remote control, the “libreelec_package_argonforty-device” only provides “argon.licd.conf” file and enables the gpio-ir overlay at GPIO23, nothing else. LIRCD, Eventlirc and so on are configured by LibreELEC image. If you need a template of a working config, you should inspect the configuration files in the LibreELEC image directly.

But why you don’t start with the modern way, like explained after the “EDIT” line?
In the toml file you could later map the IR codes from the remote to any other “KEY_” if needed.

Thanks for that. I had come to the conclusion that lircd and lircd-uinput with udev rules was the likely way to go.

Your comment is a great help to getting this going on the raspi.

I’ve learned a lot, so far, without getting the RC to work.

I’m using the .toml file route. I now know that it is a file written in Tom’s Obvious Minimal Language. I followed the post-EDIT guidance.

The /etc/keymaps.cfg file includes:

> # This table creates an association between a keycode file and a kernel
> # driver. It can be used to automatically override a keycode definition.
> #
> # Although not yet tested, it is mented to be added at udev.
> #
> # To use, you just need to run:
> # ./ir-keytable -a

Running
ir-keytable -a /etc/argon40.toml

shows that lines in the file beginning with ‘[’ are rejected as unrecognizable parameters. Preceding the lines with a ‘#’ solves the problem.

After a reboot to load the UDEV rules, I test with

sudo su -c 'sleep 1; timeout -k5 20 evtest --grab /dev/input/event9’

event9 is the gpio-rc driver for my Raspberry Pi. . I know that the argon40 table is being used because, otherwise, the default keyboard mapping codes are displayed before the testing begins. I need to find a working .toml file to see why the argon40 version is not working.

There is another possibility: the Argon One V3 uses another GPIO pin for the i2c connection to the RP2040. This seems so unlikely that I haven’t bothered to check!

I’ll report back when I get it working.

To me it looks like you confused the rc_maps.cfg and argon40.toml. The command ir-keytable -a is intended to be used with rc_maps.cfg, not with the toml file. The toml file is referenced in the rc_maps.cfg file.

To test the argon40.toml file, you should try this:
ir-keytable -c -w /etc/argon40.toml

You are right!
I ran the following and got the results,

$ ir-keytable -a /etc/rc_keymaps

Found /sys/class/rc/rc2/ with:
Name: gpio_ir_recv
Driver: gpio_ir_recv
Default keymap: rc-rc6-mce
Input device: /dev/input/event9
LIRC device: /dev/lirc0
Attached BPF protocols: Operation not permitted
Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd

$ ir-keytable -c -w /etc/rc_keymaps/argon40.toml

Read argon40 table
Old keytable cleared
Wrote 11 keycode(s) to driver
Protocols for device can not be changed

This all looks fine. IR Remote still not working.

I looked at the Argon One V3 Manual that was supplied with the case and found two extra sections not included in the version I downloaded from the website . It includes instructions to download and flash the RP2040 with the latest .uf2 file. Since the power button works as advertised, I assumed that this would not be necessary on the basis ‘if it’s working, don’t fix it’.

Do you think this could be the problem?

No, please don’t change that as long it’s working right. The IR signal path is independent of the RP2040 and looks like.

IR sensor → GPIO23
+
IR sensor → RP2040

and not:
IR sensor → RP2040 → GPIO23

This warning messages looks like you need sudo to execute the command

Attached BPF protocols: Operation not permitted

Protocols for device can not be changed

If you stop the eventlircd/lircd services before, you should be able to test the remote control and get the keys listed if you press any key on the remote:

$ sudo ir-keytable -c -w /etc/rc_keymaps/argon40.toml
Read Argon IR remote table
Old keytable cleared
Wrote 11 keycode(s) to driver
Protocols changed to nec
$ sudo ir-keytable -t
Testing events. Please, press CTRL-C to abort.
216.916670: lirc protocol(nec): scancode = 0xd2
216.916714: event type EV_MSC(0x04): scancode = 0xd2
216.916714: event type EV_KEY(0x01) key_down: KEY_DOWN(0x006c)
216.916714: event type EV_SYN(0x00).

I have stopped the lircd service and tried to load the toml file.

$ /usr/bin/systemctl stop lircd.socket lircd.service


$ sudo ir-keytable -c -w /etc/rc_keymaps/argon40.toml
Read argon40 table
Old keytable cleared
Wrote 11 keycode(s) to driver
Protocols for device can not be changed

The following confirms that the BPF protocol has not been loaded.

$ sudo ir-keytable -a /etc/rc_keymaps

Found /sys/class/rc/rc2/ with:
	Name: gpio_ir_recv
	Driver: gpio_ir_recv
	Default keymap: rc-rc6-mce
	Input device: /dev/input/event9
	LIRC device: /dev/lirc0
	Attached BPF protocols: 
	Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon 
	Enabled kernel protocols: lirc 
	bus: 25, vendor/product: 0001:0001, version: 0x0100
	Repeat delay = 500 ms, repeat period = 125 ms

You mentioned eventlircd, but that is not recognized as a service. Have I still got another service to stop?

Thanks for the explanation of the IR sensor signal paths. I had assumed the incorrect version.

If you don’t mind me taking up so much of your time, any thoughts would be very welcome.

It seems this issue is because your current device is rc2. Default is rc0. You should try it again if you additional specify it.

sudo ir-keytable -s rc2 -c -w /etc/rc_keymaps/argon40.toml

That line did the trick. However, a test of the keys produced random outputs rather than the formatted display of key codes.

I took the nuclear option and uninstalled everything to do with IR. I rebooted and went to the link you provided.
Raspberry Pi IR Receiver

The line that seemed to do the trick was,

$ sudo ir-keytable -p all
Protocols for device can not be changed
Error: unable to attach bpf program, lirc device name was not found

There was no need to install lircd and the service does not, of course, run.

$ ir-keytable -t -s rc2
Testing events. Please, press CTRL-C to abort.
1233.064006: lirc protocol(nec): scancode = 0xc1
1233.064017: event type EV_MSC(0x04): scancode = 0xc1
1233.064017: event type EV_KEY(0x01) key_down: KEY_RIGHT(0x006a)
1233.064017: event type EV_SYN(0x00).
^[[C1233.116008: lirc protocol(nec): scancode = 0xc1 repeat
1233.116016: event type EV_MSC(0x04): scancode = 0xc1
1233.116016: event type EV_SYN(0x00).
1233.248009: event type EV_KEY(0x01) key_up: KEY_RIGHT(0x006a)
1233.248009: event type EV_SYN(0x00).
1237.208006: lirc protocol(nec): scancode = 0x99
1237.208015: event type EV_MSC(0x04): scancode = 0x99
1237.208015: event type EV_KEY(0x01) key_down: KEY_LEFT(0x0069)
1237.208015: event type EV_SYN(0x00).

The remote is working! But, still on the RC2 socket. The earlier installed IR packages have left a legacy.

Some of the keys work as expected with desktop programs. Linux enforces some multimedia key mappings to apps on a global basis and I think it is going to be a challenge to make Linux apps work properly with the remote.

Thank you so much for your help. I would like to put [SOLVED] in the title, but that is another journey, entirely.

1 Like

(Despite going through all the @discobot greetings and tutorial, I still cannot figure out how to start a new thread here, so I’m adding this on to this one as the closest relevance I found.)

The script /usr/bin/argonone-ir downloads the python script https://download.argon40.com/argonone-irdecoder.py and saves it to /etc/argon/argonirdecoder. I’m not sure when this script eventually gets run, but at some point it creates the lirc config file /etc/lirc/lircd.conf.d/argon.lircd.conf. There is an error in the script that generates an error in the lirc config file.

Lines 304 and 322 are missing a comma, so instead of adding definitions for
KEY_MENU 0x00ffb946
KEY_BACK 0x00ff09f6

it instead adds just:
KEY_MENUBACK 0x00ffb946

which is not a valid key, With this error the MENU key is recognized with that label, and the BACK key is not recognized at all.

Lines 303-305 of https://download.argon40.com/argonone-irdecoder.py

buttonlist = ['POWER', 'UP', 'DOWN', 'LEFT', 'RIGHT',
                                'VOLUMEUP', 'VOLUMEDOWN', 'OK', 'HOME', 'MENU'
                                'BACK']

Hi! To find out what I can do, say @discobot display help.