At this moment, I don’t find a working example for the on-board IR receiver. I would like to get some help related to lirc and hw and sw config topics. The IR transmitter possible GPIO config will be a topic as well. The built in receiver connected to the MT SoC IR port directly.
have not spend any time into this because i use r2 as router which does not require any remote-control
as far as i know dtsi contains the cir-node with compatible “mediatek,mt7623-cir”. this is picked up by driver drivers/media/rc/mtk-cir.c (CONFIG_IR_MTK).
so at least enabling this may help
Thx 4 reply. I will take a look on this. Actually, I use R2 as home NAS+bridged “router”, mini linux server with build environment+mysql, etc. Today, I was wondering if it could be also part of my smart-home system. Because of I have a couple of IR conntrollable devices (RGB bulb and strip, tv, AC) it would be obvious. I did search the net through different IR blaster or ESP arduino solutions as well. I have also a free rpi board too. So, I just study the topic to find the best sw support before I decide which way I follow.
i’ve found out that in my kernel (at least 4.19 and 5.5-merged) CONFIG_IR_MTK is set, but need RC_CORE to be active…on 4.14 it’s builtin
in dmesg i’ve found this:
[ 4.995585] mtk_cir 10013000.cir: Initialized MT7623 IR driver, sample period = 46us [ 12.205230] evbug: Connected device: input1 (MCE IR Keyboard/Mouse (mtk_cir) at /input0)
root@bpi-r2:~# cat /sys/class/rc/rc0/input0/name mtk_cir
tried installing lirc on my buster failed to start on install, fixed with this:
mv /etc/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf apt -f install
The actual state with my kernel’s mtk cir event looks good:
root@bpi-r2:~# evtest No device specified, trying to scan all of /dev/input/event* Available devices: /dev/input/event0: mtk_cir /dev/input/event1: MCE IR Keyboard/Mouse (mtk_cir) /dev/input/event2: mtk-pmic-keys
I see the built in IR is slightly different than I suspected. When I tried to record my RGB led remote, I got an error: lirc0 is not found.
root@bpi-r2:~# irrecord -d /dev/lirc0 my_remote_control.conf irrecord - application for recording IR-codes for usage with lirc Copyright (C) 1998,1999 Christoph Bartelmus([email protected]) irrecord: could not get file information for /dev/lirc0
Is the built in IR receiver capable only for the MCE compatible coding ? (This was basically my point of misunderstanding, if it is a specific only or a general IR implementation…).
root@bpi-r2:~# cat /sys/class/rc/rc0/protocols other [unknown] rc-5 nec rc-6 jvc sony rc-5-sz sanyo sharp mce_kbd xmp cec
looks like other protocols are supported but maybe you need to create the lirc0 device or set event0 in lirc config
but i also not got any response trying with my remote here…afair there was a patch for this driver (it is backported to 4.14 and 4.19)…i’m trying here on 4.14, have added driver to 4.19 and 5.4 too
Maybe first steps (configure lirc using uevent) here help: How to use IR with lirc on BPI-M1,BPI-M1+
it turns out that i need CONFIG_LIRC and CONFIG_RC_DECODERS +matching decoder (have not found the right one yet)…
now i see response from my remote with “ir-ctl -r” but not yet with “ir-keytable -s rc0 -p all -t”
used another remotecontrol and see results in ir-keytable and evtest
root@bpi-r2:~# ir-keytable -s rc0 -p all -t [11016.148395] IR RC5(x/sz) protocol handler initialized [11016.209795] IR NEC protocol handler initialized [11016.269917] IR RC6 protocol handler initialized [11016.329682] IR JVC protocol handler initialized [11016.389823] IR Sony protocol handler initialized [11016.449963] IR SANYO protocol handler initialized [11016.519960] IR Sharp protocol handler initialized [11016.610685] rc_core: Loaded IR protocol module ir-mce_kbd-decoder, but protocol mce_kbd still not available [11016.639683] IR XMP protocol handler initialized [11016.680686] rc_core: Can't enable IR protocol cec [11016.730711] rc_core: Loaded IR protocol module ir-imon-decoder, but protocol imon still not available Protocols changed to unknown other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp cec imon Testing events. Please, press CTRL-C to abort. 11022.102391: lirc protocol(rc5): scancode = 0x150a 11022.102425: event type EV_MSC(0x04): scancode = 0x150a 11022.102425: event type EV_SYN(0x00). 11022.102489: event type EV_MSC(0x04): scancode = 0x150a 11022.102489: event type EV_SYN(0x00). 11022.102484: lirc protocol(rc5): scancode = 0x150a 11022.102533: lirc protocol(rc5): scancode = 0x150a 11022.102578: lirc protocol(rc5): scancode = 0x150a 11022.102536: event type EV_MSC(0x04): scancode = 0x150a 11022.102536: event type EV_SYN(0x00). 11022.102581: event type EV_MSC(0x04): scancode = 0x150a 11022.102581: event type EV_SYN(0x00). 11025.268156: lirc protocol(rc5): scancode = 0x150b toggle=1 11025.268183: event type EV_MSC(0x04): scancode = 0x150b 11025.268183: event type EV_SYN(0x00). 11025.268254: event type EV_MSC(0x04): scancode = 0x150b 11025.268254: event type EV_SYN(0x00). 11025.268248: lirc protocol(rc5): scancode = 0x150b toggle=1 11025.268321: lirc protocol(rc5): scancode = 0x150b toggle=1 11025.268326: event type EV_MSC(0x04): scancode = 0x150b 11025.268326: event type EV_SYN(0x00). ^C root@bpi-r2:~#