Author Topic: Homebrew serial IR transmitter receiver setup - troublshooting advice  (Read 5009 times)

jamo

  • Guru
  • ****
  • Posts: 463
    • View Profile
    • LMCE user Page
Hi Everyone

I've been hacking around with this for a while. I would like to purchase a USBUIRT or similar but we've been foolishly squandering our funds on food and shelter so when I found this very cheap RS232 IR receiver/transmitter I thought it was worth a shot, esp as it was purported to work with LIRC and mythTV.

Incidentally, it's quite a neat little device- it's a serial port transmitter receiver that gets extra power by having a USB plug as well.

http://bsinnovations.co.za/NewZen/index.php?main_page=product_info&cPath=2&products_id=4

Anyway, my first attempt went along the lines of the LIRC wiki page but of course I needed to setup my own remote with irrecord, which was not interested in responding to any remote - so I tried running mode2 which also didn't respond so clearly something wrong.

Take 2 (after breaking the media director and rebuilding the image). This time I thought I'd follow the instructions for setting up a homebrew receiver in ubuntu here.

That went rather better... at least to the point where I was able to run irrecord and generate a bunch of (raw) config files for my various remotes.

I then tried to continue with the LIRC wiki above by creating a new template for my remote, pasting in the config codes I'd generated, adding the template as a remote to my media director, and setting the media director receiver to "default" as described in the wiki.

After the requisite dcerouter quick reloads etc the MD started up fine and there seemed to be a device starting up to receive commands but it doesn't respond to my remote. In fact, even the little homebrew receiver isn't flashing it's LED when I point the remote at it and hit buttons.

Hmmmm...

I've done this on two different MDs. The first, I followed the instructions above which involve basically rebuilding the modules for the kernel and modprobing them in. Once I'd done that I was able to use irrecord to generate my remote configs so I then used that on the 2nd MD (which hadn't had any of the module rebuilds done) to follow the LIRC wiki directly. So it's really the 2nd MD that I'm trying to get right- the first I may have compromised with my module rebuilds etc.

I get the impression on the 2nd MD that it hasn't actually installed any LIRC packages at all- I never saw anything happening. Is there any way I can check this? Problem is, there are so many places it could be going wrong- lirc might not be installed, I may have messed up the template config, etc etc. Where do I start?

Are there any logs associated with this that I can check? Should I do some kind of aptitude check on the media director to confirm lirc is installed? Typically when my MD starts up it says some devices didn't start correctly. I've never had a problem with it so I've always ignored it but that could now be including my IR receiver device. How can I look and see what devices didn't start and why?

Any suggestions welcome. Sorry I haven't given more useful information but I'll keep tinkering and post what I find.

(PS - next step, and actually the *main* reason I wanted the receiver/transmitter was to control my settop box and TV source switching... but I thought I'd start with the receiver part, thinking that would be easier!)

jamo

  • Guru
  • ****
  • Posts: 463
    • View Profile
    • LMCE user Page
Re: Homebrew serial IR transmitter receiver setup - troublshooting advice
« Reply #1 on: October 03, 2012, 10:18:12 am »
Made slight progress here last night in terms of eliminating issues-

  • Established that lirc is running (ps -aef | grep -i lirc returns results).
  • device exists (/dev/lirc0 and /dev/lircd if I recall correctly)
  • There is a log - /var/log/pluto/XX_LIRCDCE - or similar, not at machine at the moment)

However the log mentioned above shows a message:There are no remote controls -- LIRC will be dormant

Interesting.... so I tracked this down to the actual LIRC_DCE application. In a function called "GetConfig", this message is returned when a loop looking for devices which are remotes finds none. So why is that happening in my scenario?

Logic in that section appears to be:

-> loop through all devices that are siblings of an IRReceiver
  -> if the current device is controlled by the same device as the IRReceiver AND is of device category LIRC remote controls
    -> Get configuration string for device
       -> search that string for a name or something and then increment the numremotes counter.

At first I thought it might be something to do with my configuration string so I tried copying in the string from another template (which didn't work) but looking at the logic, I see since my numremotes counter is remaining zero the code clearly isn't even getting into this innermost loop so the configuration string isn't the problem.

The problem must be higher up so I'm going to test:
  • That the remote device I've created *is* a sibling of the IRReceiver device in the device tree of webadmin
  • That the remote device and IRReceiver device (in the pluto_main db) have the same "controlled by" device
  • That the remote device has the correct device category in the pluto db

And if all that doesn't work I may have to build a test environment and recompile the code with lots of nice debugging statements. But I rather hope it doesn't come to that.

jamo

  • Guru
  • ****
  • Posts: 463
    • View Profile
    • LMCE user Page
Re: Homebrew serial IR transmitter receiver setup - troublshooting advice
« Reply #2 on: October 03, 2012, 02:05:38 pm »
Had a glance at my setup over lunchtime and all those things looked correct, I must say. Hmmmm. Will try to look a bit more extensively this evening getting into the pluto db etc etc but, if anyone has a working LIRC remote setup on an MD can they possibly screenshot the device tree for me? I'll do that as well this evening to show what mine looks like.

jamo

  • Guru
  • ****
  • Posts: 463
    • View Profile
    • LMCE user Page
Re: Homebrew serial IR transmitter receiver setup - troublshooting advice
« Reply #3 on: October 04, 2012, 02:41:25 pm »
Here's the stuff from the database.

Code: [Select]
+-----------+----------+---------+-----------------+--------------+------------------------+-------------------+-------------------------+--------------+-------------------+-------------+-------------------+---------------+-------+--------+----------+-------------------+-------------+---------------------+------------+--------+-----------+----------+------------+---------------------+--------------+
| PK_Device | Disabled | FK_Room | FK_Installation | FK_DesignObj | Description            | FK_DeviceTemplate | FK_Device_ControlledVia | IPaddress    | MACaddress        | IgnoreOnOff | FK_Device_RouteTo | NeedConfigure | State | Status | PingTest | EK_LicensedDevice | IsNewDevice | ManuallyConfigureEA | Registered | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+-----------+----------+---------+-----------------+--------------+------------------------+-------------------+-------------------------+--------------+-------------------+-------------+-------------------+---------------+-------+--------+----------+-------------------+-------------+---------------------+------------+--------+-----------+----------+------------+---------------------+--------------+
|        38 |        0 |       7 |         1030139 |         NULL | HP 6410b               |                28 |                    NULL | 192.168.80.3 | 00:1A:4B:72:CB:33 |           0 |              NULL |             0 |       | MD_OFF |        0 |              NULL |           1 |                   0 |          0 |   NULL |      NULL |     NULL |          0 | 2012-08-02 21:01:17 |         NULL |
|        96 |        0 |       7 |         1030139 |         NULL | er_31607A              |              2213 |                      38 |              |                   |           0 |              NULL |             0 |       |        |     NULL |              NULL |           1 |                   0 |          0 |   NULL |      NULL |     NULL |          0 | 2012-10-01 21:41:12 |         NULL |
|        97 |        0 |       7 |         1030139 |         NULL | default                |              1675 |                      38 |              |                   |           0 |              NULL |             0 |       |        |     NULL |              NULL |           1 |                   0 |          0 |   NULL |      NULL |     NULL |          0 | 2012-10-01 21:43:19 |         NULL |
|        98 |        0 |       7 |         1030139 |         NULL | LIRC Embedded Transmit |              1911 |                      97 |              |                   |           0 |                97 |             0 |       |        |     NULL |              NULL |           1 |                   0 |          0 |   NULL |      NULL |     NULL |          0 | 2012-10-01 21:43:19 |         NULL |
+-----------+----------+---------+-----------------+--------------+------------------------+-------------------+-------------------------+--------------+-------------------+-------------+-------------------+---------------+-------+--------+----------+-------------------+-------------+---------------------+------------+--------+-----------+----------+------------+---------------------+--------------+


mysql> select * from DeviceTemplate where PK_DeviceTemplate in (2213,1675);
+-------------------+-------------+----------+-------------------+-----------------+--------+---------------+------------+-------------+---------------+-----------+----------+-------------+--------------------+------------+----------------+---------------------+--------------------+-----------+-------------------+-----------------+-----------------+-------------------+-----------+--------------+------------------+---------------+-------------+---------+--------+-----------+----------+------------+---------------------+--------------+
| PK_DeviceTemplate | Description | Comments | FK_DeviceCategory | FK_Manufacturer | Define | ImplementsDCE | IsEmbedded | CommandLine | IsPlugAndPlay | IsIPBased | IsPlugIn | IRFrequency | FK_StabilityStatus | FK_Package | DestinationDir | FK_Users_Maintainer | FK_OperatingSystem | FK_Distro | InheritsMacFromPC | ConfigureScript | ManufacturerURL | InternalURLSuffix | WizardURL | FK_Licensing | FK_InfraredGroup | FK_CommMethod | FK_PnpLevel | HelpURL | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+-------------------+-------------+----------+-------------------+-----------------+--------+---------------+------------+-------------+---------------+-----------+----------+-------------+--------------------+------------+----------------+---------------------+--------------------+-----------+-------------------+-----------------+-----------------+-------------------+-----------+--------------+------------------+---------------+-------------+---------+--------+-----------+----------+------------+---------------------+--------------+
|              1675 | default     | NULL     |               133 |             554 |        |             1 |          0 | LIRC_DCE    |             0 |         0 |        0 |        NULL |               NULL |        340 | NULL           |                   1 |               NULL |      NULL |                 0 | NULL            | NULL            | NULL              | NULL      |         NULL |             NULL |          NULL |        NULL | NULL    |   1682 |       545 |    33129 |          0 | 0000-00-00 00:00:00 |         NULL |
|              2213 | er_31607A   |          |               118 |            1153 |        |             0 |          0 |             |             0 |         0 |        0 |        NULL |               NULL |        340 | NULL           |                   1 |               NULL |      NULL |                 0 |                 | NULL            | NULL              | NULL      |         NULL |             NULL |          NULL |        NULL | NULL    |   NULL |      NULL |        1 |          0 | 2012-10-02 06:15:28 |         NULL |
+-------------------+-------------+----------+-------------------+-----------------+--------+---------------+------------+-------------+---------------+-----------+----------+-------------+--------------------+------------+----------------+---------------------+--------------------+-----------+-------------------+-----------------+-----------------+-------------------+-----------+--------------+------------------+---------------+-------------+---------+--------+-----------+----------+------------+---------------------+--------------+

mysql> select * from DeviceCategory where PK_DeviceCategory in (113,118);
+-------------------+--------------------------+----------------------+--------+------+--------+-----------+----------+------------+---------------------+--------------+
| PK_DeviceCategory | FK_DeviceCategory_Parent | Description          | Define | IsAV | psc_id | psc_batch | psc_user | psc_frozen | psc_mod             | psc_restrict |
+-------------------+--------------------------+----------------------+--------+------+--------+-----------+----------+------------+---------------------+--------------+
|               118 |                      117 | LIRC Remote Controls | NULL   |    0 |     74 |         1 |     NULL |          0 | 0000-00-00 00:00:00 |         NULL |
+-------------------+--------------------------+----------------------+--------+------+--------+-----------+----------+------------+---------------------+--------------+

The remote I created is er_31607A (I like meaningful names) which is device 96. The receiver is called "default" and is device 97. Note that both are controlled via device 38 (HP 6410b media director) and since they're both siblings on the device tree it seems those questions are adequately answered.

Then my remote is using device template 2213 which is device category 118 whose *parent* is LIRC Remote Controls. Now does anyone know where I'd find the value of the constant- DEVICECATEGORY_LIRC_Remote_Controls_CONST .... so I can see if that's equal to 118 or 117. Could be the problem.  Best solution would still be to rebuild the LIRC_DCE with debugging logging entries, I guess.

jamo

  • Guru
  • ****
  • Posts: 463
    • View Profile
    • LMCE user Page
Re: Homebrew serial IR transmitter receiver setup - troublshooting advice
« Reply #4 on: October 04, 2012, 02:48:23 pm »
Got it!

#define DEVICECATEGORY_LIRC_Remote_Controls_CONST 118

in http://svn.linuxmce.org/svn/branches/LinuxMCE-1004/src/pluto_main/Define_DeviceCategory.h

so.... the thick plottens. As far as I can tell, then, all should work hunky dory with the device structures. I'm going to have to compile this beast with debugging code. Another sleepless night beckons..
« Last Edit: October 04, 2012, 02:50:54 pm by jamo »