Kodi Community Forum

Full Version: [LINUX] HOW-TO configure Soundgraph iMON VFD/IR Receiver (used by many HTPC chassis)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Woot! That did it. Thank you Dave! Big Grin
Thanks for the great guide (and everyone else's tips)!

I've got this all working with one small problem - when I first start up my machine, and xbmc starts, the remote doesn't work:

xbmc.log:
Code:
18:00:19 T:3053037392 M:3247878144    INFO: LIRC Initialize: connect failed: No such file or directory

If I then stop and start with,

Code:
sudo stop tty2
  sudo start tty2

xbmc.log:
Code:
18:13:44 T:3051796304 M:3098210304    INFO: LIRC Initialize: sucessfully started on: /dev/lircd

Everything works perfectly! Nothing else touched at all, other than the restart.

Quite strange. At first I thought it might be a permissions thing, but it all looks ok,

Code:
[email protected]:~$ ls -la /dev/l*
crw-rw-rw- 1 root root 180, 144 2009-03-16 18:11 /dev/lcd0
crw-rw-rw- 1 root root  61,   0 2009-03-16 18:11 /dev/lirc0
crw-rw-rw- 1 root root  61,   1 2009-03-16 18:11 /dev/lirc1
srw-rw-rw- 1 root root        0 2009-03-16 18:12 /dev/lircd
...

Any ideas?
lens Wrote:Any ideas?

yes, it's a matter of timing. At the time lirc is called during startup, either: one/more modules are not loaded yet or the scripts in etc/init.d are not in the correct (or best possible) order.

but don't ask me how exactly to solve it - other than dirty solutions like re-calling a modprobe or lirc-start script from rc.local...
Cool, yeah, that was my other thought. I will have a poke about with the orders and see what happens.
Been playing with this timing issue. I had a look at reordering, but there didnt seem to be much room to manouver. I also tried rerunning init/lirc again, later.

Anyway, for the sake of expedience in the WAF dept, I wrote a simple program which attempts to create and connect socket to lircd every second until it succeeds. I stuck this in my .xsession before xbmc, and the good news is that, as expected, it eventually connects. Seems to be ~20 seconds on average.

So it's working for me now, and the slight delay isn't the end of the world!
1. you could write your script here, it could help or be inspirational to someone else

2. look up an /etc/modprobe.conf or the /etc/modprobe.d folder. It might be a better idea to move something in there to have the wanted reordering without having to wait additional 20 secs - although "it works"
> 1. you could write your script here, it could help or be inspirational to someone else

Just a hacky workaround so ymmv. Will try messing with modprobe later.

waitforlirc.cpp:
Code:
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
#include <iostream>

#define LIRC_DEVICE "/dev/lircd"
#define MAX_ATTEMPT 20

using namespace std;

int main( int argc, char *argv[] )
{
  int attempts = MAX_ATTEMPT;
  int attempt = 0;
  struct sockaddr_un addr;
  int fd = -1;
  int status = -1;
  
  if( argc == 2 )
  {
    attempts = atoi( argv[1] );
  }

  addr.sun_family = AF_UNIX;
  strcpy( addr.sun_path, LIRC_DEVICE );

  while( status!=0 && attempt++<=attempts )
  {
    cout << "Attempt " << attempt << ": ";

    fd = socket( AF_UNIX, SOCK_STREAM, 0 );

    if( fd == -1 )
    {
      cout << "Socket failed" << endl;
      status = 2;
      close(fd);
      sleep(1);
      continue;
    }

    if( connect( fd, (struct sockaddr *)&addr, sizeof(addr) ) == -1 )
    {
      cout << "Connect failed" << endl;
      status = 3;
      close(fd);
      sleep(1);
      continue;
    }

    cout << "Connected!" << endl;
    status = 0;
    close(fd);    
  }

  if( status!=0 )
  {
    cout << "Couldn't connect after max attempts." << endl;
  }
    
  return status;
}

Build it:
Code:
g++ waitforlirc.cpp -o waitforlirc

.xsession
Code:
export XBMC_PLATFORM_MODE=1
/home/mediabox/bin/waitforlirc 60 > /var/tmp/waitforlirc.log
/usr/share/xbmc/xbmc.bin  -q -p --standalone
case "$?" in
    0 ) # Quit
        touch /tmp/noRestartXBMC
        break ;;
    64 ) # Shutdown System
        sleep 10 ;;
    65 ) # Warm Reboot
        echo Restarting XBMC ... ;;
    66 ) # Reboot System
        sleep 10 ;;
     * ) ;;
esac
rickx Wrote:did you try my suggestions?

another one:
once you installed, try "modinfo lirc_imon".
It will show some info. Make sure your model's id 15c2:0036 is there. Otherwise, the module compiled won't work.

I tried that, but it lists only similar model's like "v15C2p0038d", not the "0036". Does that mean that the 0036 is totally unsupported?
Fitho Wrote:I tried that, but it lists only similar model's like "v15C2p0038d", not the "0036". Does that mean that the 0036 is totally unsupported?


I am answering to my own question:

Using modinfo lirc_imon I got my device 15c2:0036 listed.

I followed the instructions on:
http://mythtvblog.blogspot.com/2008/04/g...-lirc.html
in step 4 / part 5 / "notice to ubuntu users" (had to edit the paths to match mine):

sudo mv /lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/lirc_imon.ko{,.OLD}
sudo ln -s /lib/modules/2.6.24-19-generic/misc/lirc_imon.ko /lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/
ok, nice: that's the first one to make happy.
Once it's up and running, start testing the remote and keep
an eye on the logs.
rickx,

Now that the driver supports my device I tried:
sudo modprobe lirc_imon

But this results in error:
FATAL: Error inserting lirc_imon (/lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/lirc_imon.ko): Unknown symbol in module, or unknown parameter (see dmesg)

Using dmesg I get the messages:
[ 2846.503961] lirc_imon: Unknown symbol lirc_unregister_driver
[ 2846.504126] lirc_imon: Unknown symbol lirc_register_driver


What could I be doing wrong?
Fitho Wrote:rickx,

Now that the driver supports my device I tried:
sudo modprobe lirc_imon

But this results in error:
FATAL: Error inserting lirc_imon (/lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/lirc_imon.ko): Unknown symbol in module, or unknown parameter (see dmesg)

Using dmesg I get the messages:
[ 2846.503961] lirc_imon: Unknown symbol lirc_unregister_driver
[ 2846.504126] lirc_imon: Unknown symbol lirc_register_driver


What could I be doing wrong?

hmm, that sounds bad. Is that the actual version of your kernel? are you using lirc-modules_source? what lirc version? self-compiled? my only experience is with ubuntu 8.10...
It's the actual kernel version (it's the version of XBMC Live 8.10). I got a Lirc version from CVS using (setup.sh tells me it is Lirc 0.8.5-CVS):
Code:
cvs -d:pserver:[email protected]:/cvsroot/lirc login
cvs -z8 -d:pserver:[email protected]:/cvsroot/lirc co lirc
./autogen.sh
./setup.sh
sudo make
sudo make install

I had to use a newer version then the latest release, because my 15c2:0036 device is not in the Lirc 0.8.4.a release.

I followed your advise NOT to use lirc-modules-source.

The installation only produced the files (as far I can tell):
/lib/modules/2.6.24-19-generic/misc/lirc_imon.ko
/lib/modules/2.6.24-19-generic/misc/lirc_dev.ko

But XBMC is using Lirc from:
/lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/

I renamed the old and linked to the 2 files from there:
sudo mv /lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/lirc_imon.ko{,.OLD}
sudo ln -s /lib/modules/2.6.24-19-generic/misc/lirc_imon.ko /lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/

On the internet I found a thread were someone claimed (a few months back) that a newer CVS did the trick. Another suggested it is using a wrong version (there are about 6 files/vesions of lirc_imon.ko in ubuntu).

As for the version, modinfo points to:
/lib/modules/2.6.24-19-generic/kernel/drivers/input/misc/lirc_imon.ko

Maybe I should try placing a copy of lirc_imon.ko file in that folder instead of linking to it?

I can try a new version from CVS, but how do I tell if its newer?

It looks like Lirc got updated but it depends on something that isn't there.

Any ideas?

Oh, one more thing. XBMC Live has an empty sources.list (size 0). But there is also a folder sources.list.d in which there are 2 files:
/etc/apt/sources.list.d/ubuntu.org.list
/etc/apt/sources.list.d/xbmc.org.list

In ubuntu.org.list were only the deb lines, so I copied each uncommented line and made a deb-src line. Otherwise "sudo apt-get build-dep lirc lcdproc" would fail. Maybe I should do that for xbmc.org.list too or is anything missing from the ubuntu.org.list?

The current contents of the files is.

/etc/apt/sources.list.d/ubuntu.org.list (I did not remove anything, just added the deb-src)
Code:
# deb cdrom:[Kubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016.1)]/ gutsy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://it.archive.ubuntu.com/ubuntu/ hardy main restricted
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://it.archive.ubuntu.com/ubuntu/ hardy-updates main restricted
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://it.archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy universe
deb http://it.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://it.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://it.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://it.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. This software is not part of Ubuntu, but is
## offered by Canonical and the respective vendors as a service to Ubuntu
## users.
deb http://archive.canonical.com/ubuntu hardy partner
deb-src http://archive.canonical.com/ubuntu hardy partner

# deb http://ubuntu.fastbull.org/ubuntu/ hardy main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu/ hardy-security universe main multiverse restricted
deb-src http://security.ubuntu.com/ubuntu/ hardy-security universe main multiverse restricted
# deb http://ubuntu.fastbull.org/ubuntu/ hardy-updates universe main multiverse restricted
# deb http://ubuntu.fastbull.org/ubuntu/ hardy-backports universe main multiverse restricted
# deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse
/etc/apt/sources.list.d/xbmc.org.list
Code:
deb http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu hardy main
OK, figured out my issue above.
I feel a bit stupid. I am still a linux noob.

As I said before Lirc installed 2 files:
/lib/modules/2.6.24-19-generic/misc/lirc_imon.ko
/lib/modules/2.6.24-19-generic/misc/lirc_dev.ko

I was only paying attention to this howto. And only modprobed lirc_imon. Until I realised what I was doing. So I also tried modprobing lirc_dev. That worked. And after that Lirc_imon. That worked too now. According to modinfo lirc_dev is the LIRC base driver module.

The message it previously returned:
[ 2846.503961] lirc_imon: Unknown symbol lirc_unregister_driver
[ 2846.504126] lirc_imon: Unknown symbol lirc_register_driver
seems to be due to some new symbols in the lirc_dev driver which are used in lirc_imon.

The output from dmesg confirmed it's now installed and working.

Next step...
Please remove this post. The question that was here does not need answering.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19