Infrared Remote Control (sunxi-ir)

1,030 views
Skip to first unread message

Simo Xefil

unread,
Dec 4, 2014, 8:42:08 AM12/4/14
to linux...@googlegroups.com

Hello to all!
I'm trying to debug IR signals on a A20 based board with Arch Linux.
I'm trying to test if I'm able to read values from a remote IR control.
During boot I can recognise the ir as follow:


[    2.478959] input: sunxi-ir as /devices/virtual/input/input0



Looking on the devices I get:

# cat /proc/bus/input/devices


I
: Bus=0019 Vendor=0001 Product=0001 Version=0100
N
: Name="sunxi-ir"
P
: Phys=RemoteIR/input1
S
: Sysfs=/devices/virtual/input/input0
U
: Uniq=
H
: Handlers=sysrq rfkill kbd event0
B
: PROP=0
B
: EV=3
B
: KEY=ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe


(...)



Then, using this command I expect to see some signals:

# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "sunxi-ir"
Supported events:
 
Event type 0 (EV_SYN)
 
Event type 1 (EV_KEY)
   
Event code 1 (KEY_ESC)
   
Event code 2 (KEY_1)
   
Event code 3 (KEY_2)
(...)
   
Event code 247 (KEY_RFKILL)
   
Event code 248 (?)
   
Event code 249 (?)
   
Event code 250 (?)
   
Event code 251 (?)
   
Event code 252 (?)
   
Event code 253 (?)
   
Event code 254 (?)
   
Event code 255 (?)
Properties:
Testing ... (interrupt to exit)


I've tested a PHILIPS remote, no signal, and a SAMSUNG remote. On the samsung remote I get values.

Event: time 1417698487.436218, type 1 (EV_KEY), code 2 (KEY_1), value 1
Event: time 1417698487.436227, -------------- EV_SYN ------------
Event: time 1417698487.959104, type 1 (EV_KEY), code 2 (KEY_1), value 0
Event: time 1417698487.959113, -------------- EV_SYN ------------
Event: time 1417698489.688749, type 1 (EV_KEY), code 2 (KEY_1), value 1
Event: time 1417698489.688757, -------------- EV_SYN ------------
Event: time 1417698489.989063, type 1 (EV_KEY), code 2 (KEY_1), value 0
Event: time 1417698489.989070, -------------- EV_SYN ------------
Event: time 1417698490.761935, type 1 (EV_KEY), code 2 (KEY_1), value 1
Event: time 1417698490.761947, -------------- EV_SYN ------------
Event: time 1417698491.069059, type 1 (EV_KEY), code 2 (KEY_1), value 0
Event: time 1417698491.069065, -------------- EV_SYN ------------
Event: time 1417698491.961707, type 1 (EV_KEY), code 2 (KEY_1), value 1
Event: time 1417698491.961715, -------------- EV_SYN ------------
Event: time 1417698492.269065, type 1 (EV_KEY), code 2 (KEY_1), value 0
Event: time 1417698492.269072, -------------- EV_SYN ------------

Also the device works. All remote are working used on their own devices.
My goal is to remplicate the signal of a remote command of an automatic pellet stove. I would like to clone the signal. The remote works on the stove, also it's not a remote issue. Is there a way to debug or to know if the remote is incompatible? Reading the instructions it's defined as Infra Red. Are there different IR signals? I've read that in some cases, values sent above 255 are ignored. Could be the case? How in case to solve?

Thanks!

Simon

jons...@gmail.com

unread,
Dec 4, 2014, 8:51:57 AM12/4/14
to linux-sunxi
IR remotes use different protocols. These protocols are supported by
different kernel modules like NEC, RC5, etc. You also need keymaps
for mapping the remote protocols into standard key events. Look in the
kernel source at drivers/media/rc/...... If you get things set up
right Linux can decode every IR remote on the market.
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Jon Smirl
jons...@gmail.com

Andreas Baierl

unread,
Dec 4, 2014, 8:57:37 AM12/4/14
to linux...@googlegroups.com

Simo Xefil

unread,
Dec 4, 2014, 9:23:02 AM12/4/14
to linux...@googlegroups.com


Il giorno giovedì 4 dicembre 2014 14:51:57 UTC+1, Jon Smirl ha scritto:
IR remotes use different protocols. These protocols are supported by
different kernel modules like NEC, RC5, etc.  You also need keymaps
for mapping the remote protocols into standard key events. Look in the
kernel source at drivers/media/rc/...... If you get things set up
right Linux can decode every IR remote on the market.

Ok, good to know there are different protocols. The content of my folder is:

#pwd
/usr/lib/modules/3.4.90/kernel/drivers/media/rc
# ls
ati_remote
.ko  ir-jvc-decoder.ko  ir-mce_kbd-decoder.ko  ir-rc5-decoder.ko     ir-rc6-decoder.ko    ir-sony-decoder.ko  lirc_dev.ko  rc-core.ko  streamzap.koimon.ko        ir-lirc-codec.ko   ir-nec-decoder.ko      ir-rc5-sz-decoder.ko  ir-sanyo-decoder.ko  keymaps             mceusb.ko    redrat3.ko

I was expecting to be able get a kind of raw string to simply resend if needed, even if not recognized.
Is there a way to get raw values and simply resend them? Like using an arduino, with a sketch I got the raw data and then I use them to resend the signal.
I would then an IR led to send out signals, if the build in receiver cannot send as well. I've no idea if the build in ir sensor can only receive.

Thanks

Simon



Simo Xefil

unread,
Dec 4, 2014, 9:24:57 AM12/4/14
to linux...@googlegroups.com, li...@imkreisrum.de


Il giorno giovedì 4 dicembre 2014 14:57:37 UTC+1, Andreas Baierl ha scritto:

How to identify if it's applied? A little bit out of my known ranges :-) 

Simo Xefil

unread,
Dec 4, 2014, 9:51:00 AM12/4/14
to linux...@googlegroups.com, li...@imkreisrum.de


Il giorno giovedì 4 dicembre 2014 14:57:37 UTC+1, Andreas Baierl ha scritto:
sorry, found!
My script.fex is already so:

[ir_para]
ir_used
= 1
ir0_rx
= port:PB04<2><default><default><default>

Simon

 

jons...@gmail.com

unread,
Dec 4, 2014, 10:24:23 AM12/4/14
to linux-sunxi
It is unlikely that your built-in IR can also transmit. Your box
would need to have a jack labeled "IR out".

You will probably need an external USB box like this one:
http://www.hauppauge.com/site/webstore2/webstore_remote-mckit.asp

That bundle of wire on the left is the transmitter.

Or if you are a hacker you can build your own IR transmitter for a
couple of dollars.


>
> Thanks

Simo Xefil

unread,
Dec 4, 2014, 10:40:36 AM12/4/14
to linux...@googlegroups.com


Il giorno giovedì 4 dicembre 2014 16:24:23 UTC+1, Jon Smirl ha scritto:


It is unlikely that your built-in IR can also transmit.  Your box
would need to have a jack labeled "IR out".

You will probably need an external USB box like this one:
http://www.hauppauge.com/site/webstore2/webstore_remote-mckit.asp

That bundle of wire on the left is the transmitter.

Or if you are a hacker you can build your own IR transmitter for a
couple of dollars.



Uh, I'll try to build my own IR sender. I already have some IR leds. I'll try to use it on the GPIO pins of my board.
Aside this, which is a point I'll start to deal with later, I need to get the values from the remote IR to clone the signal.
Also I'm again on the original issue.
Is there a way to capture the raw data? I'll think how to send it out later :)

Simon

jons...@gmail.com

unread,
Dec 4, 2014, 11:14:19 AM12/4/14
to linux-sunxi
I have not tried this... but I think if you load the kernel lirc
device driver the raw data will be available on /dev/lirc. It may also
be available in sysfs as part of the base IR system. Google around,
someone else must have tried getting to it.

http://www.lirc.org/

tkg

unread,
Jan 9, 2015, 9:12:32 PM1/9/15
to linux...@googlegroups.com
I think the current sunxi-ir driver only decodes the NEC protocol.

In my case I have one of the dual core android tv player device similar to:
http://linux-sunxi.org/YBKJ_A20

I have made a debian linux sd card using the 3.4 sunxi kernel
and I had success reading the original remote that came with the box and also various cheap remotes usually found in car players.
See for instance the remote from here:
http://docs.cubieboard.org/tutorials/cb1/customization/wireless_music_box

If the driver is loaded properly you should be able to find an eventX link for it in /dev/input/eventX where X varies but it should be similar to what you had in the dmesg log.

A simple test to see if you have any keys recognized you could run:
cat /dev/input/eventX | hexdump
and start pressing keys from your remote.

If you do not get any output then either your remote is not using the NEC protocol or the decoder might be listening on the wrong pins.

I saw you have "ir0_rx = port:PB04<2><default><default><default>" in your "script.fex" file but have you actually converted that file to a binary one and made it available so that the U-boot loader can load it?
Again, in my case, I needed the script.bin file generated for my debian build as mentioned in here:
http://linux-sunxi.org/Manual_build_howto

All the best,
tkg



Александр Берсенев

unread,
Jan 11, 2015, 4:32:16 PM1/11/15
to linux...@googlegroups.com, i.an...@gmail.com
Hello, I remember the code in 3.4. Authors do decoding manually instead of using kernel decoders. I think it is possible to use them. I've made some effort to push sunxi ir driver into mainline linux kernel, here is the main file: https://github.com/torvalds/linux/blob/master/drivers/media/rc/sunxi-cir.c.

I think it is possible to backport the changes, but I am outside of my country for 3 mounts.

Best,
Alexander Bersenev

суббота, 10 января 2015 г., 7:12:32 UTC+5 пользователь tkg написал:
Reply all
Reply to author
Forward
0 new messages