LinuxMCE Forums

General => Users => Topic started by: freymann on June 16, 2008, 01:54:07 am

Title: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: freymann on June 16, 2008, 01:54:07 am
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!)

Title: Re: Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 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.
Title: Re: Trying to fix the 4 repeated numbers in the IR send
Post by: freymann 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!

Title: Re: Trying to fix the 4 repeated numbers in the IR send
Post by: freymann 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?
Title: Re: Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 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
Title: Re: Trying to fix the 4 repeated numbers in the IR send
Post by: freymann 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!
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 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 :)

(http://i229.photobucket.com/albums/ee95/jondecker76/linuxmce/AV_Properties.jpg)
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: freymann 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...
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 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.
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 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
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: seth 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
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 on June 24, 2008, 02:38:30 pm
my bad - it should be ..pluto-admin/operations/irCodes.php

(updated instructions above to reflect)
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: freymann 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!
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: freymann on June 24, 2008, 07:19:08 pm
 Doh!

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





Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: freymann 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]
Title: Re: [Solved] Trying to fix the 4 repeated numbers in the IR send
Post by: jondecker76 on June 25, 2008, 05:15:30 pm
Input codes fall under General IR Codes, so your setting of 4 will repeat it 4 times. (remember, this repeating is only to help ensure the message gets delivered - it doesn't try to actually change the input 4 times) Basically you want your repeats to be as high as possible without the receiving device actually thinking it received more than one command. This may be as low as 1, or as high as 5 or 6. It depends on how often your device actually looks for IR data. If you press the number 5 on your remote, and you are getting a repeated effect at your TV (it tunes to 55, or 555 etc), then the general repeats need lowered. Lower them one at a time until the TV (or other device) responds by just tuning to 5.

The exception for me has been volume IR commands. I like my volume response to be very fast on my remote. To accomplish this, i set my Volume IR Repeats extra high - forcing the "repeat effect" that we were trying to eliminate with the number buttons.

Regarding your TV tuning through all of the inputs on power on - that is a separate bug that I am going to work on separately. There are bugs both in the web admin and in some of the source code contributing to this. If you hit the [Change/Explain] link for your inputs, there is a checkbox "Send input select on toggle" (or similar) that appears if you have toggle inputs. This appears to me to be a setting for TV's that always start at the first input when turned on. On the 2nd page where you can change the order of your inputs, there is a second option "Send input select twice for the first input". This is for tv's where the input select brings up the input menu first, then subsequent presses will cycle through the inputs. The prolem is that there is a bug in the web admin that if you change one of the checkboxes, the other one changes with it. These should be two separate, distinct settings. My guess is that they are both checked on yours.

Hopefully it won't be too long and I'll get that part figured out. Its one of the few bugs remaining in the toggle handling.