ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

LIRC GPIO driver for homebrew adapter

Thu Jun 07, 2012 9:37 pm

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

mredeker
Posts: 8
Joined: Tue Jan 31, 2012 12:54 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 08, 2012 12:05 pm

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?

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 08, 2012 12:19 pm

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) ...

mredeker
Posts: 8
Joined: Tue Jan 31, 2012 12:54 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 08, 2012 6:01 pm

That would be great.
Looking forward to it. Gives us a 35$ ethernet ir blaster :D

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 08, 2012 7:14 pm

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
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 08, 2012 10:06 pm

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.

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 09, 2012 6:33 am

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.
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

mredeker
Posts: 8
Joined: Tue Jan 31, 2012 12:54 pm

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 09, 2012 9:13 am

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.

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Sun Jun 10, 2012 7:44 am

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.

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Mon Jun 11, 2012 11:33 am

OpenELEC howto can be found on my site.

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Tue Jun 12, 2012 7:26 pm

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)
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Tue Jun 12, 2012 7:31 pm

@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.
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Tue Jun 12, 2012 7:49 pm

@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...

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Tue Jun 12, 2012 9:01 pm

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?
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

davy39
Posts: 11
Joined: Tue Jun 12, 2012 8:55 pm

Re: LIRC GPIO driver for homebrew adapter

Wed Jun 13, 2012 7:45 pm

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

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Thu Jun 14, 2012 8:11 am

@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.

davy39
Posts: 11
Joined: Tue Jun 12, 2012 8:55 pm

Re: LIRC GPIO driver for homebrew adapter

Thu Jun 14, 2012 8:56 am

Couldn't expect better !
Many thanks

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 15, 2012 5:04 pm

Done. Please check it out. ;)

davy39
Posts: 11
Joined: Tue Jun 12, 2012 8:55 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 15, 2012 6:09 pm

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) ?

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 15, 2012 6:49 pm

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! ;)

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 15, 2012 6:58 pm

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
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Jun 15, 2012 8:03 pm

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!

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 16, 2012 7:31 am

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'
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

ar0n
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 16, 2012 7:39 am

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.
Last edited by ar0n on Sat Jun 16, 2012 7:47 am, edited 1 time in total.

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 16, 2012 7:46 am

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
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

Return to “HATs and other add-ons”