LIRC via GPIO on A13-Olinuxino ?

Started by diracsbracket, April 01, 2014, 04:21:28 PM

Previous topic - Next topic

diracsbracket

Hi,
I have bought an A13-OlinuXino-WiFi in order to learn about
and experiment with embedded systems. I must say that I am a
complete beginner in this area but learning every day.

In my tests, I recovered a IR receiver module from some old
device I had, and verified it generates 3.3 V signals that
could be connected to one of the A13 GPIO pins.

I have been trying to use LIRC, which I have installed, but
am having trouble in learning how to use.

From my kernel build .config file, I see

CONFIG_RC_CORE=y
CONFIG_LIRC=y
CONFIG_RC_MAP=y
CONFIG_IR_NEC_DECODER=y
...

so I am assuming that LIRC is build into my kernel.

dmesg also shows
lirc_dev: IR Remote Control driver registered, major 251

How do I proceed from there ?
Would it be better to make LIRC as module ?
Do I do this by modifying the CONFIG_LIRC=y to CONFIG_LIRC=m, along
with all the other related CONFIG_ settings ?

Many thanks for helping me out here!

diracsbracket

OK, I got it to work.

In menuconfig, set the following:

  <*> Device Drivers  ---> 
    <*> Input device support  --->
      <*> Keyboards  --->
         <M> sunxi IR support

The sunxi IR support that will be generated is sunxi-ir.ko
after you rebuild & install the modules.

Also, in the script.fex file, I set the desired parameters:

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

Note that the port PB04 corresponds to gpio2_pb4,
i.e. to GPIO # 2 or pin 13 on the GPIO-2 connector.

In /etc/modules, add the entry:

   sunxi-ir

to start the sunxi-ir module on boot.

At reboot,

  dmesg | grep -i sunxi-ir
     [  149.634517] input: sunxi-ir as /devices/virtual/input/input2

Then,

  cat /dev/input/event2 | hexdump

After pressing a button on the IR remote, the above outputs something like:

0000150 e8a2 533a 0232 000a 0000 0000 0000 0000
0000160 e8a2 533a a69b 000b 0001 0012 0000 0000
0000170 e8a2 533a a6a2 000b 0000 0000 0000 0000
0000180 e8a2 533a a6ba 000b 0001 0012 0001 0000
0000190 e8a2 533a a6be 000b 0000 0000 0000 0000
00001a0 e8a2 533a 9451 000e 0001 0012 0000 0000
00001b0 e8a2 533a 9458 000e 0000 0000 0000 0000

So it seems to work.


dave-at-axon

I am not using this myself but wanted to say well done to a newbie for find out yourself and for posting back what you found for others to benefit from.

Nice one.

diracsbracket

Thanks Dave,

However, this is only part of the problem. The above confirms that
IR interface is working, but does not make the connection to LIRC.

What I find strange is that it somehow requires the
LIRC-related file /etc/lirc/hardware.conf

This is for the moment like this, on my system:

# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=""

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false

#Don't start irexec, even if a good config file seems to exist.
#START_IREXEC=false

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"

# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE=""
MODULES=""

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""

However, in order to follow the instructions on:
http://docs.cubieboard.org/tutorials/cb1/customization/wireless_music_box

I need to modify the /etc/lirc/hardware.conf file to something like:

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="devinput"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/input/cubieir"
MODULES="sunxi-ir"


Although I have the sunxi-ir module, I have nothing in /dev/input/ related to IR,
except the /dev/input2, so I'm still working on how to make LIRC remote control
(here of mplayer) actually work.

If it works, I'll update my posts here.