Author Topic: [Solved] Trying to fix the 4 repeated numbers in the IR send  (Read 9489 times)

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Following information in a previous thread, to try and make LinuxMCE NOT repeat the channel numbers 4 times when changing channels on my external Bell dish receivers, it's still sending the numbers 4 times each.

Asking to view channel 201 results in 2,2,2,2 0,0,0,0 1,1,1,1 being sent and the dish responds to all sequences sent to it and you don't end up on channel 201 at all.

I followed the instructions here:

http://wiki.linuxmce.org/index.php/Setting_Up_A_Development_Environment

and it didn't complete, but I went looking to see if

~/charon-merge/src/IRBase

was there, and it was!

So I then edited "IRBase.cpp"

On line 200 I set:  int iRepeat = 1;

and on line 215 I set:  iRepeat=1;

This affects this part of the code:

 if(!ircode.empty()) {
                int iRepeat = 1;
                if( pmsg->m_mapParameters.find(COMMANDPARAMETER_Repeat_Command_CONST)!=pmsg->m_mapParameters.end() )
                        iRepeat = atoi( pmsg->m_mapParameters[COMMANDPARAMETER_Repeat_Command_CONST].c_str() );
                else
                {
                        if( m_mapDevice_IRRepeat.find(devid)!=m_mapDevice_IRRepeat.end() )
                        {
                                pair<int,int> p = m_mapDevice_IRRepeat[devid];
                                if( cmd==COMMAND_Vol_Up_CONST || cmd==COMMAND_Vol_Down_CONST )
                                        iRepeat = p.second;
                                else
                                        iRepeat = p.first;
                                }
                }
                if( iRepeat<1 )
                        iRepeat=1;

                LoggerWrapper::GetInstance()->Write(LV_STATUS, "Sending Infrared Code for dev <%d> cmd <%d>, channel$
                                        devid, cmd, irport.c_str(), iRepeat, ircode.c_str());


 I then saved that, issued a "make" command...

 I then found "/usr/pluto/lib/libIRBase.so" and copied that to another name for backup

 I then copied the new libIRBase.so I just made into /usr/pluto/lib and chmod 644 and chown root:root

 Quick Reload Router, jump into TV and drats, it's still sending each channel 4 times.

 I then power off and restart. Same thing.

 Is there something I missed? (most likely!)

« Last Edit: June 16, 2008, 06:48:15 pm by freymann »

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: Trying to fix the 4 repeated numbers in the IR send
« Reply #1 on: June 16, 2008, 04:06:15 am »
i think see the problem with your code..  add the iRepeat = 1; (or even 2) after the if clause, so instead of
Code: [Select]
if( iRepeat<1 )
     iRepeat=1;
Try to force it after the clause to make sure it is getting exectued:
Code: [Select]
if( iRepeat<1 )
     iRepeat=4;

iRepeat = 1;


after copying IRBase.so to usr/pluto/lib then all you have to do is a "Force Reload Router" (not just a quick reload) and all should work fine.

On a side note, I started working on a permanent solution today that involves just adding a Repeat device data entry for a device so that this can be adjusted per device directly from the device template. I'm hoping to have it ironed out this week.


Also pay attention to this line:
Code: [Select]
LoggerWrapper::GetInstance()->Write(LV_STATUS, "Sending Infrared Code for dev <%d> cmd <%d>, channel <%s>, repeat <%d> code <%s>",
devid, cmd, irport.c_str(), iRepeat, ircode.c_str());
Watch your log and it will tell you the value it used for iRepeat - this is a good way to make sure this is causing your problem.
« Last Edit: June 16, 2008, 04:10:34 am by jondecker76 »

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: Trying to fix the 4 repeated numbers in the IR send
« Reply #2 on: June 16, 2008, 04:50:40 am »
i think see the problem with your code..  add the iRepeat = 1; (or even 2) after the if clause, so instead of
Code: [Select]
if( iRepeat<1 )
     iRepeat=1;
Try to force it after the clause to make sure it is getting exectued:
Code: [Select]
if( iRepeat<1 )
     iRepeat=4;

iRepeat = 1;

 OMG! Success!! Yippie!

 This is wonderful news! That was a major problem and I can't thank you enough for your suggestions and help.

 Cheers!

« Last Edit: June 16, 2008, 05:12:11 am by freymann »

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: Trying to fix the 4 repeated numbers in the IR send
« Reply #3 on: June 16, 2008, 05:14:46 am »
Hmmm.

While typing in my response to you, the core locked up solid while watching TV. No keyboard, mouse, ssh, web. So I reset it.

When it came back, I SSH'd back in and made a backup copy of libIRBase.so in /usr/pluto/diskless/32/usr/pluto/lib and then copied the modified /usr/pluto/lib/libIRBase.so in there (both the core and the media director are AMD).

When I went upstairs, to the media director, it seemed to be lost, likely due to the reboot of the core, so I rebooted the MD.

Now it's in an endless loop about "rpc failed" but the core seems to be fine. What's that about?

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: Trying to fix the 4 repeated numbers in the IR send
« Reply #4 on: June 16, 2008, 11:34:52 am »
I've had this happen before (the RPC error). Its usually happened after a Mythtv lockup. If you only changed the one line in IRBase.cpp, then it should be totally unrelated.

Anyways, if a few reboots of the core don't clear it up, a rebuild of the diskless image in the web admin will

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: Trying to fix the 4 repeated numbers in the IR send
« Reply #5 on: June 16, 2008, 02:06:47 pm »
I've had this happen before (the RPC error). Its usually happened after a Mythtv lockup. If you only changed the one line in IRBase.cpp, then it should be totally unrelated.

Anyways, if a few reboots of the core don't clear it up, a rebuild of the diskless image in the web admin will

 Yes, that was the same here, for some reason MythTV had locked up the entire box.

 I rebooted the core once last night, and rebooted the MD a few times with no success (on the MD). It was late so I left it till morning.

 This morning, I rebooted the core, went upstairs and fired up the MD and everything is working, including the channel changing up there too!

 Most excellent! Thanks once again for your help. I will document this later.

 Now to see about getting the master-bedroom MD up and running!

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #6 on: June 20, 2008, 03:00:32 am »
Just posting my progress... Check out the attached picture!!!

-Fixed a small bug that used a decimal place incorrectly while display IR delays
-Support for PER DEVICE IR_Repeat settings for both general IR codes, and Volume IR codes (I set my Volume IR codes extra high - kind of like a sensitivity setting!)
Just gotta clean up a few more pieces of code before its usable :)


freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #7 on: June 20, 2008, 03:09:23 am »
Just posting my progress... Check out the attached picture!!!

-Fixed a small bug that used a decimal place incorrectly while display IR delays
-Support for PER DEVICE IR_Repeat settings for both general IR codes, and Volume IR codes (I set my Volume IR codes extra high - kind of like a sensitivity setting!)
Just gotta clean up a few more pieces of code before its usable :)

 Wow! That is great news indeed!! Keep up the good work...

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #8 on: June 20, 2008, 01:10:02 pm »
Good news - this part is all finished, thoroughly tested, and works great!

I'm not sure what your experiences have been, but my volume controls were always way too "dead" through LMCE. That was because by default, most IR codes from LMCE were sent 4 times, while volume codes were only sent 2 times. Now with this change and being able to edit the values,my volume control through LMCE is as fast (and even faster if I want) as it is with the TV's stock remote, while at the same time I tuned in the repeats for the rest of the codes to eliminate the double keypress effect. And the great thing is being able to configure this differently for each device - for the very first time (for me anyways), all of my A/V gear is working like I would expect it to with LMCE.

 However, I found a few more bugs I'm going to take care of (one of them being how toggle input devices will cycle through their inputs at power on and stop on the incorrect input). Odly enough, the bug is in this same set of files. I'm hoping to have that fixed also this weekend then I will commit the changes to SVN and post back what you need to do to use the new fixes/features.

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #9 on: June 24, 2008, 04:03:15 am »
In case you are still following this - I just committed the revision to SVN. (revision 21069, 21070)
This change allows you to set your General IR command and Volume IR command repeats via the A/V properties page (where you enter the IR codes).
It also fixed a few bugs with DSP modes, and unified the IR delays by having all values specified in miliseconds.

If you want to check it out and start using it.....
1) undo the changes you made to IRBase.cpp - they won't be needed any longer.
2) ssh to your core, navigate to your source directory (mine is ~/charon-merge/)
3) run svn update (to get the latest revision)
4) copy the following:
     ~/charon-merge/web/pluto-admin/languages/en/addModel.lang.php to /var/www/pluto-admin/languages/en/addModel.lang.php
     (the rest will use the same method above, but I'm going to truncate the directory paths)
     ..languages/en/irGsdCodes.lang.php
     ..operations/infrared/addModel_step2.php
     ..operations/infrared/addModel_step6.php
     ..operations/infrared/addModel_step7.php
     ..operations/infrared/addModel_step8.php
     ..operations/irCodes.php
Now just go to your A/V device, and the new options will be at the top of the page.

Please let me know if you have any problems
« Last Edit: June 24, 2008, 02:37:27 pm by jondecker76 »

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #10 on: June 24, 2008, 01:40:07 pm »
 :(
I attempted this fix this morning, and cannot find the file below in the charon-merge folder:

~/charon-merge/web/pluto-admin/operations/infrared/irCodes.php

Is it perhaps in a different location?

I await your instructions ;)

Regards,

Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #11 on: June 24, 2008, 02:38:30 pm »
my bad - it should be ..pluto-admin/operations/irCodes.php

(updated instructions above to reflect)

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #12 on: June 24, 2008, 02:48:36 pm »
my bad - it should be ..pluto-admin/operations/irCodes.php

(updated instructions above to reflect)

 I have just finished the SVN process... and I plan on copying over the files later this afternoon. I'll keep you posted!

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #13 on: June 24, 2008, 07:19:08 pm »
 Doh!

 Never mind, I copied the step files one directory too high. Working now.





« Last Edit: June 24, 2008, 07:24:13 pm by freymann »

freymann

  • Douchebag
  • Guru
  • *
  • Posts: 380
    • View Profile
Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
« Reply #14 on: June 25, 2008, 04:40:57 pm »
Just posting my progress... Check out the attached picture!!!

-Fixed a small bug that used a decimal place incorrectly while display IR delays
-Support for PER DEVICE IR_Repeat settings for both general IR codes, and Volume IR codes (I set my Volume IR codes extra high - kind of like a sensitivity setting!)
Just gotta clean up a few more pieces of code before its usable :)

 Jon! This is great work!

 One thing I've noticed is when I press the Green Media button and wait for the system to turn on my LCD TV, it then flips through all the inputs to make sure I'm on HDMI (I guess) but it's sending the input code 4 times each too. Strangely enough, I must have just the right number of inputs to toggle through, because when it's finished, I end up back on HDMI.

 Were you working on that area too?

 Here's the top content from my A/V properties on this particular TV:

Code: [Select]
Edit IR codes
WARNING: the changes will afect all devices created from device template 26 Inch LCD.
Device Template 26 Inch LCD, category LCD and manufacturer Wal-Mart.
Delays: Power: 7000 miliseconds, Mode: 2000 miliseconds, Other: 250 miliseconds [change/explain]
Tuning: No fixed digits [x] terminate with enter [change/explain]
Power: Toggle [change/explain]
Inputs Toggle: Antenna, Component 1, Component 2, HDMI, Video 1, Video 2 [change/explain]
DSP Modes NONE: [change/explain]
IR Repeats: General IR codes: 4, Volume IR codes: 2 [change/explain]