LIRC GPIO driver for homebrew adapter


209 posts   Page 4 of 9   1, 2, 3, 4, 5, 6, 7 ... 9
by bitbitbit » Thu Oct 04, 2012 10:00 am
the.hcd wrote:Hi bitbitbit, you need to apt-get the dependencies before you can build. (check the 33 steps instructions)
sudo apt-get install libtool
sudo apt-get install autoconf
sudo apt-get install git

after compiling, you install and configure with irrecord.
Although you probably don't need to compile the lirc_gpio module as you are not using a IR receiver via GPIO input. In the latest release the lirc module should work. jsut configure it as described in http://www.lirc.org/


Thanks!....found out that I needa run apt-get update @@

and when I run ./autogen.sh, it outputs:
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:17: installing `./compile'
configure.ac:24: installing `./config.guess'
configure.ac:24: installing `./config.sub'
configure.ac:10: installing `./install-sh'
configure.ac:10: installing `./missing'
daemons/Makefile.am: installing `./depcomp'
Makefile.am: installing `./INSTALL'
Creating setup-driver.sh ...
rpi: There is no param type, but default parameter is none, should be OK

is this normal?
coze I can't use the driver after following all the steps......... :cry: :cry:
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am
by naicheben » Thu Oct 04, 2012 7:58 pm
On raspian (3.2.27+) I had to install initramfs-tools (and maybe also build the kernel, but I'm not sure if it would have worked without. Just by installing initramfs-tools first...) Now lirc_rpi is loaded at boot.

Here ist the reason why I installed it:
Code: Select all
  root@raspberrypi:/opt/raspberrypi/lirc# make
make  all-recursive
make[1]: Entering directory `/opt/raspberrypi/lirc'
Making all in drivers
make[2]: Entering directory `/opt/raspberrypi/lirc/drivers'
Making all in lirc_dev
make[3]: Entering directory `/opt/raspberrypi/lirc/drivers/lirc_dev'
cp ./../lirc_dev/Module*.symvers .
cp: „./../lirc_dev/Module.symvers“ und „./Module.symvers“ sind die gleiche Datei
make[3]: [lirc_dev.o] Fehler 1 (ignoriert)
mv Makefile Makefile.automake
cp ./../Makefile.kernel Makefile
CPPFLAGS="" CFLAGS="" LDFLAGS="" \
   make -C /lib/modules/3.2.27+/build/ SUBDIRS=/opt/raspberrypi/lirc/drivers/lirc_dev modules \
      KBUILD_VERBOSE=1
make[4]: Entering directory `/opt/raspberrypi/linux'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (      \
   echo;                        \
   echo "  ERROR: Kernel configuration is invalid.";      \
   echo "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
   echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";   \
   echo;                        \
   /bin/false)
 
But make oldconfig, nor make prepare or even make modules_prepare solved the issue.
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by naicheben » Thu Oct 04, 2012 9:20 pm
pfff, so close ....

I get good responce from irw:
Code: Select all
root@raspberrypi:/home/pi# irw
0000000000001794 00 KEY_UP haupauge.conf
0000000000001794 01 KEY_UP haupauge.conf
00000000000017a5 00 KEY_OK haupauge.conf
00000000000017a5 01 KEY_OK haupauge.conf
0000000000001795 00 KEY_DOWN haupauge.conf
0000000000001795 01 KEY_DOWN haupauge.conf
But I can not control XBMC on raspian.
I allready edit Lircmap.xml , but it does not help.
Anyone got an idea where to look?
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by naicheben » Fri Oct 05, 2012 6:16 pm
Ok, solved. First:
XBMC looks for the socket to lirc at /dev/lircd but the socket now is /var/run/lirc/lircd

Second was:
If you place a Lircmap.xml in /root/.xbmc/system it is ignored (maybe as long as there is a /usr/share/xbmc/Lircmap.xml file)
:roll:
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by dwentz » Sun Oct 21, 2012 1:35 pm
Has anyone been successful getting the GPIO LIRC working with raspian (3.2.27+)?

I have been messing with this for a few days, and have not had any luck.
Posts: 4
Joined: Sun Oct 21, 2012 1:27 pm
by naicheben » Sun Oct 21, 2012 1:42 pm
Not actually 3.2.27+ but 3.2.26+
How far did you get?

EDIT: Ah no, it is indeed 3.2.27+:
root@raspberrypi:/home/pi# uname -a
Linux raspberrypi 3.2.27+ #1 PREEMPT Thu Oct 4 09:45:38 CEST 2012 armv6l GNU/Linux
Last edited by naicheben on Sun Oct 21, 2012 1:51 pm, edited 1 time in total.
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by selectnone » Sun Oct 21, 2012 1:47 pm
dwentz wrote:Has anyone been successful getting the GPIO LIRC working with raspian (3.2.27+)?

I have been messing with this for a few days, and have not had any luck.


I managed to get it compiled and transmitting, based on a suggestion here - you need to edit the patch to change references to "drivers/staging/lirc" to "drivers/staging/media/lirc"
Posts: 55
Joined: Fri Jun 22, 2012 10:16 pm
by dwentz » Sun Oct 21, 2012 1:54 pm
I have it complied and lirc_dev installs, but I get an Invalid argument when i try lirc_rpi.

modprobe lirc_rpi gpio_in_pin=0
ERROR: could not insert 'lirc_rpi': Invalid argument

without the gpio I get the same thing.
Posts: 4
Joined: Sun Oct 21, 2012 1:27 pm
by dwentz » Sun Oct 21, 2012 1:56 pm
Just an update

ismod lirc_rpi give a No such file or directory.
Posts: 4
Joined: Sun Oct 21, 2012 1:27 pm
by naicheben » Sun Oct 21, 2012 2:10 pm
Try
insmod /lib/modules/3.2.27+/kernel/drivers/staging/media/lirc/lirc_rpi.ko
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by dwentz » Sun Oct 21, 2012 4:06 pm
OK I got the hardware to work. I found the modules in /lib/modules/3.2.27+/misc and if I do a

insmod /lib/modules/3.2.27+/misc/lirc_dev.ko
insmod /lib/modules/3.2.27+/misc/lirc_rpi.ko gpio_in_pin=18

I can then do a cat /dev/lirc0 and when I push buttons on the remote I can see data from the device.

irw still does not work, so I just need to figure that out, so some things are not working, but I got the kernel and hardware talking.

Update: OK got irw to report the correct buttons after i updated the /etc/lirc/lircd.conf with a copy from my mythtv box for mse remote I use on it. So I am good to go. When I get some time later this week I will create a new image on a new SD card and try to duplicate the minimum steps needed to get this work work. Thanks for the comments that pointed me in the right directions.

Dale
Posts: 4
Joined: Sun Oct 21, 2012 1:27 pm
by kalross » Thu Oct 25, 2012 1:29 pm
Aaaah...it's asking me for Kernel parameters. RCU implementation, hardware etc What do I do :-s
Posts: 7
Joined: Mon Sep 10, 2012 2:47 am
by naicheben » Thu Oct 25, 2012 1:46 pm
Try make menuconfig instead of make oldconfig. And save the config on exit.
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by kalross » Thu Oct 25, 2012 11:26 pm
Aaaargh....I'm not managing to get it working on 3.2.27. The drivers/media/lirc comment is not applying in my case and I have other errors...gonna get an older Raspbian version and try again.

One of pi boards is crashing (F3 polyfuse I reckon...silly idea) so using another board :-( Hope it's OK.

Thanks for the info so far folks...determined to get this working with my heyu machine :-)

K
Posts: 7
Joined: Mon Sep 10, 2012 2:47 am
by kalross » Fri Oct 26, 2012 2:47 am
Got receive working...so pleased. Thanks again folks. :D
Posts: 7
Joined: Mon Sep 10, 2012 2:47 am
by active89 » Tue Oct 30, 2012 6:57 pm
Hello!

I want to add the driver to my Openelec.

With the precompiled Kernel, XBMC doesn't work

Now i wanted to compile the kernel myself, but don't know how and where to add the driver.

Please can somebody help me doing this??
Posts: 10
Joined: Wed Oct 24, 2012 6:57 pm
by naicheben » Tue Oct 30, 2012 9:49 pm
Go to page 2 of this thread an read the posting on the buttom (compiling the module in 33 steps). This and the replies on page 3 and 4 schould help you to get through the process. If you have any further problems come back and ask with a detailed describtion of the problem you have. Arons blog also points out how to compile the module.
For Kernel HowTos look here: http://elinux.org/RPi_Kernel_Compilation
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by probono » Thu Nov 01, 2012 7:44 pm
I did:
Code: Select all
cd /usr/src/linux-3.2.27+

wget http://aron.ws/projects/lirc_rpi/kernel.lirc_rpi-0.3.patch
patch -p1 < kernel.lirc_rpi-0.3.patch

cat >> .config <<EOF
CONFIG_RC_CORE=m
CONFIG_LIRC=m
CONFIG_RC_MAP=m
CONFIG_IR_NEC_DECODER=m
CONFIG_IR_RC5_DECODER=m
CONFIG_IR_RC6_DECODER=m
CONFIG_IR_JVC_DECODER=m
CONFIG_IR_SONY_DECODER=m
CONFIG_IR_RC5_SZ_DECODER=m
CONFIG_IR_MCE_KBD_DECODER=m
CONFIG_IR_LIRC_CODEC=m
CONFIG_STAGING=y
CONFIG_STAGING_MEDIA=y
CONFIG_LIRC_STAGING=y
CONFIG_LIRC_RPI=m
EOF

sudo apt-get -y install autoconf libtool
cd /usr/src
git clone git://lirc.git.sourceforge.net/gitroot/lirc/lirc
cd lirc
wget http://aron.ws/projects/lirc_rpi/lirc_rpi-0.2.2.patch
patch -p1 < lirc_rpi-0.2.2.patch
./autogen.sh
./configure --with-driver=rpi
make

sudo make install

#############

root@pi:/usr/src/lirc# modprobe lirc-rpi ; dmesg | tail
ERROR: could not insert 'lirc_rpi': Invalid argument
[13988.284733] lirc_rpi: disagrees about version of symbol lirc_dev_fop_open
[13988.284749] lirc_rpi: Unknown symbol lirc_dev_fop_open (err -22)
[13988.284797] lirc_rpi: disagrees about version of symbol lirc_dev_fop_close
[13988.284813] lirc_rpi: Unknown symbol lirc_dev_fop_close (err -22)
[13988.284830] lirc_rpi: disagrees about version of symbol lirc_dev_fop_read
[13988.284844] lirc_rpi: Unknown symbol lirc_dev_fop_read (err -22)
[13988.284883] lirc_rpi: disagrees about version of symbol lirc_register_driver
[13988.284899] lirc_rpi: Unknown symbol lirc_register_driver (err -22)
[13988.284948] lirc_rpi: disagrees about version of symbol lirc_dev_fop_ioctl
[13988.284963] lirc_rpi: Unknown symbol lirc_dev_fop_ioctl (err -22)



What am I doing wrong?
Posts: 9
Joined: Thu Nov 01, 2012 5:28 pm
by naicheben » Sun Nov 04, 2012 5:52 pm
Try setting the GPIO pin in /etc/modules like this:
Code: Select all
pi@raspberrypi ~ $ cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
lirc_dev
lirc_rpi gpio_in_pin=18
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by ulrith » Wed Nov 07, 2012 9:26 am
Hi all!

I have very old-fashioned IR device like this (the second one from the top):

Image

It is aimed to be connected to motherboard FIR controller.

My first question is: is it possible to use my RP GPIO connectors?

Second question: I've very frightened by "The RPi's processor uses 3.3V levels and the pins are not 5V tolerant!!!", but there is no any voltage info in the device manual. Are there any way to ensure that I'll not kill my RP by this old monster device?

Thanks. :)
Posts: 15
Joined: Sat Oct 27, 2012 10:08 am
by naicheben » Wed Nov 07, 2012 4:43 pm
Not sure about the voltage levels on the connectors of your devices, but they are most likely at least 5V or even 12/15V (RS232) . Best would be to buy a receiver like TSOP31238 it is realy not expensive, and hook it to the GPIO. Take a look at Arons page: http://aron.ws/projects/lirc_rpi/
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by ar0n » Thu Nov 08, 2012 10:01 am
First of all, thanks for the work of a few from this forum! We have managed to bring this to the rpi kernel.

So no more patching and compiling will be needed ;).

https://github.com/raspberrypi/linux/pull/152
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm
by naicheben » Thu Nov 08, 2012 12:15 pm
Great news! Thank you so much. I realized it just a few hours ago. Now lets see how long it takes for the distrributions to come up with the latest changes of the kenel.

Do we have to remove our selfmade module before updating the kernel in Raspbian?
Posts: 347
Joined: Sat Jan 28, 2012 12:28 pm
by ar0n » Thu Nov 08, 2012 12:23 pm
naicheben wrote:Do we have to remove our selfmade module before updating the kernel in Raspbian?


I have never used Raspbian, but I think the new kernel package will create a new dir for its modules so it won be automatically overwritten or removed.
Posts: 20
Joined: Thu Jun 07, 2012 9:33 pm
by rudiratlos » Thu Nov 15, 2012 2:09 pm
Hi just upgraded wheezy to
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux

added to /etc/modules:
lirc_dev
lirc_rpi gpio_in_pin=18
lirc_rpi gpio_out_pin=23

dmesg shows me after a reboot:
[ 9.965551] i2c /dev entries driver
[ 10.078998] lirc_dev: IR Remote Control driver registered, major 251

but I can't find in /dev any lirc devices
only the following devices where inserted:

vcs2 - vcs6
vcsa2 - vcsa6
Posts: 64
Joined: Tue May 01, 2012 8:47 am