nry
Posts: 11
Joined: Sun Jul 22, 2012 12:29 pm

Re: LIRC GPIO driver for homebrew adapter

Tue Jun 04, 2013 7:23 pm

I managed to hack some additional renamed drivers into the kernel. Works perfectly well for the first 2 receivers/transmitters. Haven't tried the other two.

My git repo can be found here: https://github.com/phillipsnick/rpi-linux

If you look under drivers/staging/media/lirc/
There are three additional files lirc_rpib.c lirc_rpic.c lirc_rpid.c

Then I simply run separate LIRC instances.

Understand this is a dirty hack but gets the job done!

PS_Aitch
Posts: 8
Joined: Thu Jun 06, 2013 10:32 pm

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 15, 2013 9:31 am

reibuehl wrote:I am trying to get the LIRC GPIO driver to work. The module loads fine, but if I try to start irw with irw /dev/lirc0, I only get the error message "connect: Connection refused".

If I watch the signal on the GPIO line with an oscilloscope, I see that the TSOP sends a different signal whenever I press a key on my remote.

Do you have any advice how to fix this?

dmesg:

Code: Select all

[  587.966582] lirc_dev: IR Remote Control driver registered, major 248 
[  587.972199] lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned.
[  587.975886] lirc_rpi lirc_rpi.0: lirc_dev: driver lirc_rpi registered at minor = 0
[  587.975913] lirc_rpi: driver registered!
[  588.926899] lirc_rpi: auto-detected active high receiver on GPIO pin 18
I have the same issue as this and I am wondering if the issue is related to the fact that its an active-high receiver. I haven't put my device on an oscilloscope but get the same connection refused message from irw, and my attempts to use irrecord have met with no response. My settings are very similar to this. I'm using a TSOP32238

User avatar
joan
Posts: 14013
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: LIRC GPIO driver for homebrew adapter

Sat Jun 15, 2013 12:13 pm


shaw05
Posts: 4
Joined: Tue Jun 18, 2013 10:18 pm

Re: LIRC GPIO driver for homebrew adapter

Wed Jun 19, 2013 6:20 am

Another +1 for multiple instances. Working on a home brew multi-room IR blaster/receiver for my A/V, using this as a base: http://alexba.in/blog/2013/06/08/open-s ... -pictures/

PS_Aitch
Posts: 8
Joined: Thu Jun 06, 2013 10:32 pm

Re: LIRC GPIO driver for homebrew adapter

Wed Jun 19, 2013 11:06 pm

joan wrote:May help with diagnostics.

http://abyz.co.uk/rpi/pigpio/ex_ir_remote.html
I really like the look of this tool and associated library, but it hasn't resolved my problems, I am still getting reactions like Connection Refused when following your guidelines, just as I do from running the irw commands or similar.

Plottermos
Posts: 1
Joined: Mon Jun 24, 2013 1:54 pm

Re: LIRC GPIO driver for homebrew adapter

Mon Jun 24, 2013 1:57 pm

A quick question about lirc, is it only compatible with 38 Khz receivers? Me and my friend have been trying to get it to work with 56 Khz but can't seem to get any signal from the receiver.

kevjs1982
Posts: 4
Joined: Sat Jan 19, 2013 3:44 pm

Re: LIRC GPIO driver for homebrew adapter

Wed Sep 04, 2013 4:04 pm

I've got LIRC setup and working using an IguanaIR adaptor however I want to use the Pi's GPIO one (basically so I can position an IR LED in front of each device I want to control as the Iguana can't see them) but am having problems getting it to work - looks like it's failing to find a module which exists...

Trying to start LIRC

Code: Select all

[email protected] ~ $ sudo service lirc start
[ ok ] Loading LIRC modules:.
[FAIL] Unable to load LIRC kernel modules. Verify your ... failed!
[FAIL] selected kernel modules in /etc/lirc/hardware.conf ... failed!
[FAIL] Starting execution daemon: irexec: failed
The hardware config file

Code: Select all

[email protected] ~ $ cat /etc/lirc/hardware.conf
LIRCD_ARGS=""
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
LIRCD_CONF=""
LIRCMD_CONF=""
The Kernel

Code: Select all

uname -a
Linux brawn 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
modinfo output for lirc_dev

Code: Select all

[email protected] ~ $ modinfo lirc_dev
filename:       /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.ko
license:        GPL
author:         Artur Lipowski
description:    LIRC base driver module
srcversion:     C4A9D8BB87664A698DB5908
depends:
intree:         Y
vermagic:       3.6.11+ preempt mod_unload modversions ARMv6
parm:           debug:Enable debugging messages (bool)
which does exist

Code: Select all

[email protected] ~ $ ls -lha  /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.ko
-rw-r--r-- 1 root root 21K Sep  2 19:18 /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.k
and the /etc/modules config

Code: Select all

[email protected] ~ $ cat /etc/modules
snd-bcm2835
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22
Try to load the module

Code: Select all

[email protected] ~ $ sudo insmod lirc_dev
Error: could not load module lirc_dev: No such file or directory
Has anyone got any ideas on how to actually get it to find the modules which exist?
Raspberry Pi Model B Rev 1 running Raspbian Wheezy
3x1 wire temperature sensors, 433tx and rx, IR transmitter and receiver

kevjs1982
Posts: 4
Joined: Sat Jan 19, 2013 3:44 pm

Re: LIRC GPIO driver for homebrew adapter

Wed Sep 04, 2013 4:14 pm

I've got LIRC setup and working using an IguanaIR adaptor however I want to use the Pi's GPIO one (basically so I can position an IR LED in front of each device I want to control as the Iguana can't see them) but am having problems getting it to work - looks like it's failing to find a module which exists...

Trying to start LIRC

Code: Select all

[email protected] ~ $ sudo service lirc start
[ ok ] Loading LIRC modules:.
[FAIL] Unable to load LIRC kernel modules. Verify your ... failed!
[FAIL] selected kernel modules in /etc/lirc/hardware.conf ... failed!
[FAIL] Starting execution daemon: irexec: failed
The hardware config file

Code: Select all

[email protected] ~ $ cat /etc/lirc/hardware.conf
LIRCD_ARGS=""
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
LIRCD_CONF=""
LIRCMD_CONF=""
The Kernel

Code: Select all

uname -a
Linux brawn 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
modinfo output for lirc_dev

Code: Select all

[email protected] ~ $ modinfo lirc_dev
filename:       /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.ko
license:        GPL
author:         Artur Lipowski
description:    LIRC base driver module
srcversion:     C4A9D8BB87664A698DB5908
depends:
intree:         Y
vermagic:       3.6.11+ preempt mod_unload modversions ARMv6
parm:           debug:Enable debugging messages (bool)
which does exist

Code: Select all

[email protected] ~ $ ls -lha  /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.ko
-rw-r--r-- 1 root root 21K Sep  2 19:18 /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.k
and the /etc/modules config

Code: Select all

[email protected] ~ $ cat /etc/modules
snd-bcm2835
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22
Try to load the module

Code: Select all

[email protected] ~ $ sudo insmod lirc_dev
Error: could not load module lirc_dev: No such file or directory

Code: Select all

[email protected] ~ $ sudo modprobe lirc_dev
ERROR: could not insert 'lirc_dev': Exec format error
Has anyone got any ideas on how to actually get it to load the modules which exist?
Raspberry Pi Model B Rev 1 running Raspbian Wheezy
3x1 wire temperature sensors, 433tx and rx, IR transmitter and receiver

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

Re: LIRC GPIO driver for homebrew adapter

Wed Sep 04, 2013 7:25 pm

Hi,

If you specify the path to the .ko's then they should load. On my system:

sudo insmod lirc_dev.ko
Error: could not load module lirc_dev.ko: No such file or directory
sudo insmod /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.ko
Error: could not insert module /lib/modules/3.6.11+/kernel/drivers/media/rc/lirc_dev.ko: File exists

But doesn't /etc/modules load the modules for you? Try lsmod to see if they are loaded.

Best regards
Martin
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

kevjs1982
Posts: 4
Joined: Sat Jan 19, 2013 3:44 pm

Re: LIRC GPIO driver for homebrew adapter

Thu Sep 05, 2013 6:25 pm

(Apologies for the earlier doubleish post - didn't realise I'd posted and it had gone into a moderation queue).

Hmm trying to get my USB FM transmitter working I'm getting "ERROR: could not insert 'radio_keene': Exec format error" too - looks like the modules and kernel versions differ, appears that rpi-update updates the firmware and kernel but doesn't bother with the modules leaving it all rather broken - damn.

http://www.raspberrypi.org/phpBB3/viewt ... 676#p93676
Raspberry Pi Model B Rev 1 running Raspbian Wheezy
3x1 wire temperature sensors, 433tx and rx, IR transmitter and receiver

kevjs1982
Posts: 4
Joined: Sat Jan 19, 2013 3:44 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Sep 06, 2013 4:51 pm

Reinstalling and ensuring I didn't run rpi-update has done the trick :)

As per http://forum.stmlabs.com/showthread.php?tid=1954 I need to ensure LIRCD_ARGS="--uinput" was set to that for it to work (and when testing the transmitter without a transistor the range really is rubbish - 4-5mm tops :shock: )
Raspberry Pi Model B Rev 1 running Raspbian Wheezy
3x1 wire temperature sensors, 433tx and rx, IR transmitter and receiver

elmicha
Posts: 27
Joined: Tue Jul 03, 2012 4:43 pm

Re: LIRC GPIO driver for homebrew adapter

Sat Sep 07, 2013 9:08 pm

For the people who need multiple transmitters:

Bengt Martensson enhanced the lirc_rpi module to support up to 8 transmitters. The source can be downloaded at http://harctoolbox.org/downloads/lirc_rpi.c.

The module parameters changed a bit: it's now gpio_out_pins (plural) instead of gpio_out_pin. You can use a comma separated list with it, e.g.

Code: Select all

modprobe lirc_rpi gpio_in_pin=18 gpio_out_pins=17,21 debug=1
The default value for gpio_in_pin and gpio_out_pins also changed: it's now -1 (none) instead of 18 and 17. This way you don't need to waste a GPIO pin if you only have either a transmitter or a receiver.

The irsend program has a SET_TRANSMITTERS option to let you choose which transmitter will be used in the next SEND_ONCE or SEND_START command, e.g.

Code: Select all

irsend SET_TRANSMITTERS 1
irsend SET_TRANSMITTERS 2
irsend SET_TRANSMITTERS 1 2
I have been using it for my devices with overlapping IR codes for a day now, and it works great.

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

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 08, 2013 10:15 am

Hi elmicha,

that sounds pretty cool, I am planning on using LIRC for both IR and RF controlling some 433MHz remote controlled power outlets. This way I can control which hardware gets which commands. Thanks for sharing this info. You don't happen to know if this will make it into the main repository or not?

Best regards
Martin
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

elmicha
Posts: 27
Joined: Tue Jul 03, 2012 4:43 pm

Re: LIRC GPIO driver for homebrew adapter

Tue Sep 10, 2013 9:26 pm

mba wrote:You don't happen to know if this will make it into the main repository or not?
Yes, Bengt and the original author, Aron, wrote about it, and hopefully Aron can integrate the enhancements (but it takes a bit time, of course).

Regards...
Michael

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

Re: LIRC GPIO driver for homebrew adapter

Wed Sep 11, 2013 11:31 am

Great! :-)
Just a quick question: is the SET_TRANSMITTER sticky meaning for how long is a transmitter (or transmitters) selected? Only for the next command you send or is it selected until you issue another SET_TRANSMITTERS?
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

elmicha
Posts: 27
Joined: Tue Jul 03, 2012 4:43 pm

Re: LIRC GPIO driver for homebrew adapter

Wed Sep 11, 2013 5:46 pm

The set_transmitters is sticky: it keeps its value until you send the next set_transmitters, or until lircd is restarted.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Fri Sep 27, 2013 7:51 pm

hi,,
I need your help to install lirc on raspberry pi.
I am using lirc on raspberry pi
[email protected] ~ $sudo apt-get install lirc
[email protected] ~ $ lircd -v
lircd 0.9.0-pre1
[email protected] ~ $ uname -a
Linux raspberrypi 3.6.11+ &545 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux

I just want to transmit IR singnal through GPIO pin. and it works also.
[email protected] ~ $ irsend SEND_ONCE RM_870 power

but
I want to send raw code which is not saved in lircd.conf, however remote parameter is saved in lircd.conf.
like
[email protected] ~ $ irsend SEND_ONCE_RAW RM_870 35,203,38,2,0,32,24,0,42

for that I think I have to change irsend.c , but where is this file located. and how to recompile this file and use it.
how to compile and install original source from lirc.?

i try with
[email protected] ~ $ ./configure \
--prefix=/usr \
--with-transmitter \
--with-driver=rpi
but it says "it is not possible to install the specified driver on this system"

when i try with
[email protected] ~ $ ./configure \
--prefix=/usr \
--with-transmitter \
--with-driver=lirc_rpi
it says"you need to have the Linux kernel source installed for this driver"

kindly help..
thanks in advance.
Mahendra
India.

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

Re: LIRC GPIO driver for homebrew adapter

Sat Sep 28, 2013 6:33 pm

Hi Mahendra,

Try take a look at my original instructions here http://www.raspberrypi.org/phpBB3/viewt ... 27#p146427
they might still work if you get the right kernel version.

Ps. please don't contact me for help through personal messages, facebook, google+ and other places. Helping you here on a public forum will also help others now and in the future. Hope you understand.

Best regards
Martin
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 9:50 am

thanks martin for replying
link you provide is not working for me.
aron's patch is not available..
kernel.lirc_rpi-0.3.patch --> this latest patch .
I am using 3.6.11+( latest raspbian wheezy)

Code: Select all

[email protected] ~/lirc $ sudo apt-cache search linux-header*
linux-headers-3.2.0-4-all - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-4-all-armhf - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-4-common - Common header files for Linux 3.2.0-4
linux-headers-3.2.0-4-rpi - Header files for Linux 3.2.0-4-rpi
linux-headers-3.6-trunk-all - All header files for Linux 3.6 (meta-package)
linux-headers-3.6-trunk-all-armhf - All header files for Linux 3.6 (meta-package)
linux-headers-3.6-trunk-common - Common header files for Linux 3.6-trunk
linux-headers-3.6-trunk-rpi - Header files for Linux 3.6-trunk-rpi
linux-headers-rpi - Header files for Linux rpi configuration (meta-package)
linux-headers-rpi-rpfv - This metapackage will pull in the headers for the raspbian kernel based on
[email protected] ~/lirc $ uname -a
Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux
[email protected] ~/lirc $
I also try this
sudo apt-get install linux-headers-3.6-trunk-all

Code: Select all

./configure \
--prefix=/usr \
--with-transmitter \
--with-driver=lirc_rpi \
--with-kerneldir=/user/src/linux
it says"you need to have the Linux kernel source installed for this driver"

elmicha
Posts: 27
Joined: Tue Jul 03, 2012 4:43 pm

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 10:41 am

AlmightyTech wrote:

Code: Select all

./configure \
--prefix=/usr \
--with-transmitter \
--with-driver=lirc_rpi \
--with-kerneldir=/user/src/linux
There's a typo in this line: it should be /usr/src/linux, not /user/...

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 12:50 pm

hey,,
thanks
but its just typing mistake in blog.
.
.
checking for linux/i2c-dev.h... yes
configure: error: *** you need to have the Linux kernel source installed
for this driver
[email protected] /usr/src $ ls
linux-headers-3.6-trunk-common linux-headers-3.6-trunk-rpi linux-kbuild-3.6
[email protected] /usr/src $ ls -l
total 8
drwxr-xr-x 4 root root 4096 Sep 29 12:36 linux-headers-3.6-trunk-common
drwxr-xr-x 4 root root 4096 Sep 29 12:36 linux-headers-3.6-trunk-rpi
lrwxrwxrwx 1 root root 23 Apr 6 15:16 linux-kbuild-3.6 -> ../lib/linux-kbuild-3.6
[email protected] /usr/src $

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 12:52 pm

Code: Select all

[email protected] /lib/modules $ cd 3.6.11+
[email protected] /lib/modules/3.6.11+ $ ls
kernel               modules.dep.bin      modules.pcimap
modules.alias        modules.devname      modules.seriomap
modules.alias.bin    modules.ieee1394map  modules.softdep
modules.builtin      modules.inputmap     modules.symbols
modules.builtin.bin  modules.isapnpmap    modules.symbols.bin
modules.ccwmap       modules.ofmap        modules.usbmap
modules.dep          modules.order
[email protected] /lib/modules/3.6.11+ $ cd ..
[email protected] /lib/modules $ cd 3.6-trunk-rpi/
[email protected] /lib/modules/3.6-trunk-rpi $ ls -l
total 0
lrwxrwxrwx 1 root root 36 Aug 11 16:53 build -> /usr/src/linux-headers-3.6-trunk-rpi
lrwxrwxrwx 1 root root 39 Aug 11 16:53 source -> /usr/src/linux-headers-3.6-trunk-common
[email protected] /lib/modules/3.6-trunk-rpi $


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

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 2:17 pm

Hi Mahendra,

I have been thinking about your goal. You want to send raw codes from irsend right? As you know irsend doesn't support raw codes from the commandline, you can put raw code sections in your lircd.conf file and use irsend to send these commands using the remote and key name but I guess you already know that and thats not what you are after?

You need to change two things to be able to do what you're after. First you need to understand that LIRC consists of two things
1) the lircd which receives commands through a named unix domain socket in /var/run/lirc/lircd or through network connections and
2) clients which connects to lircd and requests transmission of infrared commands like irsend. This means you need to change lircd to be able to receive raw codes through the network connection or the domain socket, maybe introduce a new command "SEND_RAW". irsend sends infrared commands by connecting to the domain socket and and you must also change this client to be able to send the raw code format your listed in your first post.

You can find the code for irsend here:
tools/irsend.c
And the source for lircd is in:
daemons/lircd.c
Take a look how the irsend uses the SEND_ONCE command for an example. You can follow this command to lircd.c and see what it does.

The good thing is you don't need to specify any driver when configuring and compiling lirc AFAIK. The lirc_rpi driver is already included in the kernel you are using 3.6.11+ the patches you are missing where added a couple of months ago. This means you don't need the kernel sources or headers.
Last edited by mba on Sun Sep 29, 2013 5:31 pm, edited 1 time in total.
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 2:47 pm

MBA,
thankss..
its now compiling..
but not tested it yet..
after testing i'll let you know.
very happy..after spending 3 days & night..
thanks

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 6:36 pm

just install fresh copy of raspbian wheezy. done update and upgrade.
and simple follow the instruction http://www.lirc.org/git.html.
compile and install successfully.
but /etc/lirc folder is not found. (hardware.conf not fouund)

Code: Select all

[email protected] / $ lircd --version
lircd 0.9.1-git
i make hardware.conf and lircd.conf manually in /etc/lirc/ as per http://alexba.in/blog/2013/01/06/settin ... spberrypi/
added bellow code to /etc/modules
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22
but luck is not with me yet..
mba wrote:Hi Mahendra,

I have been thinking about your goal. You want to send raw codes from irsend right? As you know irsend doesn't support raw codes from the commandline, you can put raw code sections in your lircd.conf file and use irsend to send these commands using the remote and key name but I guess you already know that and thats not what you are after?

You need to change two things to be able to do what you're after. First you need to understand that LIRC consists of two things
1) the lircd which receives commands through a named unix domain socket in /var/run/lirc/lircd or through network connections and
2) clients which connects to lircd and requests transmission of infrared commands like irsend. This means you need to change lircd to be able to receive raw codes through the network connection or the domain socket, maybe introduce a new command "SEND_RAW". irsend sends infrared commands by connecting to the domain socket and and you must also change this client to be able to send the raw code format your listed in your first post.

You can find the code for irsend here:
tools/irsend.c
And the source for lircd is in:
daemons/lircd.c
Take a look how the irsend uses the SEND_ONCE command for an example. You can follow this command to lircd.c and see what it does.

The good thing is you don't need to specify any driver when configuring and compiling lirc AFAIK. The lirc_rpi driver is already included in the kernel you are using 3.6.11+ the patches you are missing where added a couple of months ago. This means you don't need the kernel sources or headers.

Return to “HATs and other add-ons”