Skip to content
matzrh edited this page Feb 16, 2014 · 3 revisions

These files are kernel modules (and some config files) for using the LIRC functionality with Allwinner 1X and 2X processor based boards. They were tested on a Cubieboard and a Cubietruck under the debian kernel (latest version, 3.4.75, from patwood's kernel) For general information about lirc, see The Lirc Homepage

lirc_gpio.c

I proposed this file originally some months ago. It is based on lirc_serical and/or the lirc_gpio module for the Raspberry Pi and was now included in the cubieboard kernel.
I added some functionality that prints out the maximum permissible current draw on the tx pin once it is echoed to /sys/class/lirc_gpio/tx_gpio_pin For this to work, the pins need to be set up in the script.fex file. I also recommend to set the driver capability to 40mA instead of the default 20mA, so you do will not fry part of you Allwinner Chip so easily, e.g.

[gpio_para]  
_your other pins_  
gpio_pin_5 = port:PG02<0><default><3><default>  
gpio_pin_6 = port:PG01<0><default><3><default>  
... 

IR Diodes often take a 20mA current, so you can safely hook them up to the pin without a driver, if set to 40mA.

sunxi-lirc.c

Now, this one is new. It is based on the sunxi-ir.c module in the driver/input/keyboard directory of the kernel The module is normally recommended to be used as a lirc input, but this only works for few people. If you look a sunxi-ir.c closely, captured ir pulses are verified against the NEC ir protocol. E.g. have a look at this page and compare with code bits defining time constants like in lines 100-110 or static int ir_code_valid(unsigned long code) following line 419. I have looked at it closely and cannot see how this module (sunxi-ir.ko) would report anything to the lirc user space (or generate any input events) if the NEC protocol is not followed. I verified sunxi-lirc.c with a kaseikyo protocol (Technics) and a Sony remote and it could be decoded I had a vague hope that the Allwinner TX module could also write pulses according to the run length encoding scheme that the RX Fifo delivers in CIR mode, but I could not get any output on ir_tx0 when writing bytes to the tx fifo, while in CIR mode (would be interested if someone manages better, here, but since it is not documented in the Allwinner User Manuals, I believe this functionality is not foreseen, at all). The reason why I would like this is that the lirc_gpio is actually waiting to write the 13us pulses you need to write to generate a 38kHz signal, and this is not very elegant. (I can actually hear music streamed by the Cubieboard stuttering, when I change e.g. the volume of my stereo via lirc).

lirc init files

This directory contains a /etc/lirc/hardware.conf file and a /etc/init.d/lirc file that sets up both modules and attaches them to /dev/lircd and /dev/lircd1. lircd should connect to sunxi_lirc and lircd1 to lirc_gpio, unless you only have a transmitter set up (in which case it connects to lircd), but this has not been tested in all constellations. Especially not with lirc_gpio rx enabled. you can (provided you have a working lircd.conf file) make irw /dev/lircd to print out the commands of your remote using the IR sensor on your cubieboard or use irsend -d /dev/lircd1 ... to send stuff through the defined tx_pin for lirc_gpio. Check the hardware.conf file to see where in /sys/devices.... you need to look to see whether you need to supply /dev/lirc0 or /dev/lirc1 to e.g. mode2, to debug or to irrecord.

Clone this wiki locally