Page 1 of 10

LIRC GPIO driver for homebrew adapter

Posted: Thu Jun 07, 2012 9:37 pm
by ar0n
Hi!

I've created a lirc driver for the RPi. With this you can simply use an IR receiver and interface it with a gpio pin. The driver is based on the lirc_serial driver and measures the pulse/space widths and sends the to the lirc subsystem.

Howto and patch here: http://aron.ws/projects/lirc_rpi/

Aron

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 08, 2012 12:05 pm
by mredeker
Sounds great.
I am actually looking for a solution to send IR using the Pi as ir blaster.
Here http://www.irblaster.info/blog/2007/04/ ... outer.html they said that it should be possible with the GPIO pins from the Pi.
Some code could be found in the openwrt software.
Can anybody be of some help?

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 08, 2012 12:19 pm
by ar0n
Sending IR signals can be done ... you need to modify the source a little bit. Maybe when I have a little time I will modify it (next week maybe) ...

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 08, 2012 6:01 pm
by mredeker
That would be great.
Looking forward to it. Gives us a 35$ ethernet ir blaster :D

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 08, 2012 7:14 pm
by mba
Hi Aron,

this sounds great, I just downloaded the toolchain, lirc and your patch I will give it a go tonight. Im also interested in using rpi for blasting. I will take a look at how this feat is implemented in the other lirc drivers maybe its straight forward to support a gpio instead of the DTR of the serial port.

How do you plan to deploy this new module on your target or are you hoping this will be included in the lirc project? Which distribution are you planning to use it on?

Best regards
Martin

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 08, 2012 10:06 pm
by ar0n
I don't really know ... I created a sepparate module because in my opinion this does not belong to lirc_serial because it does not use serial. The lirc_gpio is used by tv cards. I plan to create binary packages so peaople can install this quickly. As of mergin it with something, I'm open and I'm willing to maintain the code.

Re: LIRC GPIO driver for homebrew adapter

Posted: Sat Jun 09, 2012 6:33 am
by mba
I agree, this totally belongs to its own driver, I meant I would look at the serial driver for inspiration of how to support the blaster function.

Re: LIRC GPIO driver for homebrew adapter

Posted: Sat Jun 09, 2012 9:13 am
by mredeker
I already have a Pi :)
And my soldering skills are not too bad.
I just need a list of electronic pieces and can help to test.

Re: LIRC GPIO driver for homebrew adapter

Posted: Sun Jun 10, 2012 7:44 am
by ar0n
mredeker wrote:I already have a Pi :)
And my soldering skills are not too bad.
I just need a list of electronic pieces and can help to test.
You only need an IR receiver module.

Re: LIRC GPIO driver for homebrew adapter

Posted: Mon Jun 11, 2012 11:33 am
by ar0n
OpenELEC howto can be found on my site.

Re: LIRC GPIO driver for homebrew adapter

Posted: Tue Jun 12, 2012 7:26 pm
by mba
I succesfully crosscompiled lirc with arons patches:

1. Followed the steps at http://elinux.org/RPi_Kernel_Compilation (cloned to /home/rpi/linux)
2. Downloaded and patched lirc according to arons recipe
3. ./configure --host=arm-linux-gnueabi --with-driver=rpi --with-kerneldir=/home/rpi/linux
4. make ARCH=arm
5. Copied irrecord, lirc_dev.ko, lirc_rpi.ko to target
6. insmodded the ko's, killed the running lircd and executed "irrecord irrecord -d /dev/lirc0 /home/pi/lircd.conf" (this was on a PI running the raspbmc distribution)

Re: LIRC GPIO driver for homebrew adapter

Posted: Tue Jun 12, 2012 7:31 pm
by mba
@mredeker: If you are looking for blasters, I am going to try the amplified transmitter found at http://www.lirc.org/transmitters.html. I haven't looked too much into it yet so I don't know if it needs modification to be used with the raspberry pi GPIO pins though.

Re: LIRC GPIO driver for homebrew adapter

Posted: Tue Jun 12, 2012 7:49 pm
by ar0n
@mba: Thanks for checking it out ... I'm sorry for the typo, I've corrected the compile instructions on the site. Also the blaster should work that way. I will also check it out at the weekend...

Re: LIRC GPIO driver for homebrew adapter

Posted: Tue Jun 12, 2012 9:01 pm
by mba
no problem, so you saw my other desperate post regarding cross-compilation ;-)
Are you looking into the blaster part at the moment? Or should I take a crack at it? Im looking at lirc_serial for inspiration and it doesn't seem too scary, I think with the right chisel it could be transformed into a rpi gpio blaster, or do have other drivers as preferred inspiration source?

Re: LIRC GPIO driver for homebrew adapter

Posted: Wed Jun 13, 2012 7:45 pm
by davy39
Hi there,
Any news on that ?
Is there way to connect emiter and/or receiver on GPIO and use it with lirc ?
Thanks for your work

Re: LIRC GPIO driver for homebrew adapter

Posted: Thu Jun 14, 2012 8:11 am
by ar0n
@mba, @davy39: yes and I think I've got it to work. I still need to test a few things... I will publicate the driver and the interface tomorrow.

Re: LIRC GPIO driver for homebrew adapter

Posted: Thu Jun 14, 2012 8:56 am
by davy39
Couldn't expect better !
Many thanks

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 15, 2012 5:04 pm
by ar0n
Done. Please check it out. ;)

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 15, 2012 6:09 pm
by davy39
Many thanks ! I'll try it as soon I receive my board...
In your blaster scheme, according to what you say in the description of the default configuration, shouldn't it be PIN11 - GPIO17 instead of PIN12 |(GPIO18) ?

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 15, 2012 6:49 pm
by ar0n
davy39 wrote:Many thanks ! I'll try it as soon I receive my board...
In your blaster scheme, according to what you say in the description of the default configuration, shouldn't it be PIN11 - GPIO17 instead of PIN12 |(GPIO18) ?
Of course ... thanks for the correction! ;)

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 15, 2012 6:58 pm
by mba
I applied your new patch and lirc compiled nicely, but it seems you have removed the module parameters gpio_in_pin and gpio_out_pin, its not possible to specify these parameters on the command line.

pi@raspbmc:~$ sudo insmod lirc_rpi.ko gpio_in_pin=0 gpio_out_pin=1
insmod: error inserting 'lirc_rpi.ko': -1 Unknown symbol in module

Re: LIRC GPIO driver for homebrew adapter

Posted: Fri Jun 15, 2012 8:03 pm
by ar0n
mba wrote:I applied your new patch and lirc compiled nicely, but it seems you have removed the module parameters gpio_in_pin and gpio_out_pin, its not possible to specify these parameters on the command line.

pi@raspbmc:~$ sudo insmod lirc_rpi.ko gpio_in_pin=0 gpio_out_pin=1
insmod: error inserting 'lirc_rpi.ko': -1 Unknown symbol in module
Can you please redownload/reapply the patch now? Also this is not an invalid module parameter error. Can you send me the "dmesg | grep lirc" output after the insmod has been run ?
Thanks!

Re: LIRC GPIO driver for homebrew adapter

Posted: Sat Jun 16, 2012 7:31 am
by mba
No it doesn't sound like it, but it is. Insmodding without parameters work, adding the gpio_in_pin/gpio_out_pin doesn't work- see below. I think the patch is not applied correctly or the patch itself is broken. For some reason large parts of the patch isn't applied. The last line in lirc_rpi.c after patching is the closing } of the function static void set_use_dec(void *data).


pi@raspbmc:~$ sudo insmod lirc_rpi.ko
pi@raspbmc:~$ sudo rmmod lirc_rpi.ko
pi@raspbmc:~$ sudo insmod lirc_rpi.ko gpio_in_pin=0 gpio_out_pin=1
insmod: error inserting 'lirc_rpi.ko': -1 Unknown symbol in module

dmesg output
lirc_dev: IR Remote Control driver registered, major 252
lirc_rpi: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
lirc_rpi: Unknown parameter `gpio_in_pin'
lirc_rpi: Unknown parameter `gpio_in_pin'

Re: LIRC GPIO driver for homebrew adapter

Posted: Sat Jun 16, 2012 7:39 am
by ar0n
mba wrote:No it doesn't sound like it, but it is. Insmodding without parameters work, adding the gpio_in_pin/gpio_out_pin doesn't work- see below. I think the patch is not applied correctly or the patch itself is broken. For some reason large parts of the patch isn't applied. The last line in lirc_rpi.c after patching is the closing } of the function static void set_use_dec(void *data).


pi@raspbmc:~$ sudo insmod lirc_rpi.ko
pi@raspbmc:~$ sudo rmmod lirc_rpi.ko
pi@raspbmc:~$ sudo insmod lirc_rpi.ko gpio_in_pin=0 gpio_out_pin=1
insmod: error inserting 'lirc_rpi.ko': -1 Unknown symbol in module

dmesg output
lirc_dev: IR Remote Control driver registered, major 252
lirc_rpi: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
lirc_rpi: Unknown parameter `gpio_in_pin'
lirc_rpi: Unknown parameter `gpio_in_pin'
You were right. l re-generated the patch, please check it out now. Maybe because of my home machine has memory problems, the patch was not generated well... Sorry for that.

Re: LIRC GPIO driver for homebrew adapter

Posted: Sat Jun 16, 2012 7:46 am
by mba
Applying the rest of the patch manually makes the difference :D

pi@raspbmc:~$ sudo insmod lirc_dev.ko
pi@raspbmc:~$ sudo insmod lirc_rpi.ko gpio_in_pin=0 gpio_out_pin=1
pi@raspbmc:~$ lsmod
Module Size Used by
lirc_rpi 4512 0
lirc_dev 8728 1 lirc_rpi
fuse 49448 1