WinLIRC Plugin (outdated) (2 Viewers)

jlb1234

Portal Member
April 29, 2005
7
0
Brazil
You must copy the link above and paste in the address field. Direct click is not working. Sorry for that. :oops:
 

jadz

Portal Pro
August 30, 2004
150
0
Canada
jlb1234 said:
Sorry for my bad english, i'm a Brazilian Developer :)
1) I am using the repeat counter sent by the WinLIRC instead of a delay/repeat timer in the plugin. The alteration solved some problems with the precision and the repetition of keys.

2) The setup screen now shows two sliders for control of delay and the repetition of the keys, in the same way that the function "keyboard" in Windows Control Panel.

3) I replaced the GUIWindowManager object for the GUIGraphicsContext object when sending the actions to MP. The alteration solved the problem of the volume control and the sub-menus response.

The code works with the last CVS version.

Great to have some feedback. The current source code uploaded to the patches section of SF.net also uses the GUIGraphicsContext instead of GUIWindowManager .

The repeate counter from WinLIRC is also used in the original code (it is stored in the WinLIRCCommand.iRepeat. The advantage of using the time delay is that it debounces the signal from the remote. You might recieve the following remote signals

000000000002f5c9 00 Down
000000000002f5c9 01 Down
000000000002f5c9 02 Down
000000000002f5c9 00 Down

When you check the "do not allow repeats" it only allows for 00 signals from WinLIRC.
 

jlb1234

Portal Member
April 29, 2005
7
0
Brazil
I am happy to know that you also found the problem with GUIWindowManager.

I am using the WinLIRC with my programs for some time and already tried many forms to configure the delay and the repeat rate.
The repeat counter from WinLIRC was the best way that I found.

The option "do not allow repeats" is not acceptable, because it makes the navigation very slow.
When I use a low delay setting, the action is sent twice. When I use a hight delay setting, the navigation is very slow and sometimes the action is sent twice.
None of these problems occurs with the use of the repeat counter from WinLIRC.

Here is the code:

Code:
if (command.iRepeat == 0)
{
    SendCommand = true;
}
else
{
    if (command.iRepeat > RepeatDelay)
    {
        if ((command.iRepeat - RepeatDelay) % RepeatRate == 0)
        {
            SendCommand = true;
        }
    }
}
 

htpcNoob

Portal Pro
January 23, 2005
52
0
I've actually been using a custom modded version of your winlirc plugin for a while now. It included the GUIWindowManager fix as well as repeat gap instead of timed gap. I also added an extra feature to allow one exclusive button to prompt the user to shutdown MediaPortal. To accomplish this I added a function to the WinLIRCReciever source similar to what is invoked when the X is pressed in the topbar plugin:

Code:
		private void WinLircShutdownManager()
		{
			Log.Write(" WinLIRC: ShutdownManager Activated!");
			if (GUIWindowManager.ActiveWindow != (int)GUIWindow.Window.WINDOW_HOME)
			{
				Log.Write(" WinLIRC: ShutdownManager Aborted - Not at HOME!");
				return;
			}

			// Show shutdown/exit dialog
			GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ASKYESNO,0,0,0,0,0,0);
			msg.Param1=631;
			msg.Param2=0;
			msg.Param3=0;
			GUIWindowManager.SendMessage(msg);
			if (msg.Param1 != 1)
			{
				return;
			}
			
			// Shutdown players
			MediaPortal.Player.g_Player.Stop();

			// Ask all plugins to see if we can shutdown
			ArrayList wakeables = PluginManager.WakeablePlugins;
			foreach (IWakeable wakeable in wakeables)
			{
				if (wakeable.DisallowShutdown())
				{
					Log.Write(" WinLIRC: ShutdownManager Aborted by module/plugin - {0}", wakeable.PluginName());
					return;
				}
			}

			Log.Write(" WinLIRC: ShutdownManager - Hibernating!");

			/*
						LogOff = 0
						PowerOff = 1
						Reboot = 2
						ShutDown = 3 (DEFAULT)
						Suspend = 4
						Hibernate = 5
			*/
			RestartOptions tempRO;
			switch(shutdownType)
			{
				case 0:
					tempRO = RestartOptions.LogOff;
					break;
				case 1:
					tempRO = RestartOptions.PowerOff;
					break;
				case 2:
					tempRO = RestartOptions.Reboot;
					break;
				case 4:
					tempRO = RestartOptions.Suspend;
					break;
				case 5:
					tempRO = RestartOptions.Hibernate;
					break;
				default:
					tempRO = RestartOptions.ShutDown;
					break;
			}
			WindowsController.ExitWindows(tempRO, false);
		}

This prompted me with a GUI asking whether I wanted to shutdown or not. If i select yes, then it will GRACEFULLY shutdown MediaPortal (actually in my case, it was Hibernate) .

To invoke the method, I added code within processWinLIRCCommand(...) to check if the button being pressed was the one to shutdown. If it was, I checked to make sure that the repeat count equaled a specific value (= and NOT <>).

Code:
					// Check if the shutdown command button is being pressed.  if it is
					// for a specific number of repeat count, call WinLircShutdownManager
					// and exit the function
					if(command.sCommand == shutdownCommandButton)
					{
                                                // Only invoke this ONCE and dont let it repeat
						if(command.iRepeat == shutdownGapRepeat)
						{
							WinLircShutdownManager();
						}
						return;
					}

Since this was my own mod, I didnt create any settings options and basically hardcoded the values for shutdownCommandButton, shutdownGapRepeat and shutdownType.

Just thought I'd share.
 
S

schlogi

Guest
Hi.

I've tried for a long time now to get the WinLIRC-Plugin working. It seems now I know why it's not.
I've set it up in the Menu and the plugin is receiving commands (in the "about" window) from WinLIRC. When MP is running it sometimes (very rarely, close to never) responds to the IR.
I figured out that, when MP is running, the CPU usage is at about 25% even when there is no activity. This may be the reason, why WinLIRC itself doesn't receive input from the remote (it's not flashing up in the systray). When I close MP, WinLIRC is receiving as usual. I already checked, that WinLIRC has realtime priority and MP is set to normal.
I don't think my PC is THAT slow (AMD Duron 1,4GHz, 512MB RAM, nForce2 + integrated Geforce4MX) that it can't even handle running MP and receiving remote commands at the same time.

Does anybody have similar problems? Or maybe someone can tell me his CPU usage when running MP.

Okay, thanks.
 

jadz

Portal Pro
August 30, 2004
150
0
Canada
That text was copied from the WinLIRC/LIRC website. But I am running on a 1.7GHz Celron no less, and it works fine for me.

Try running MediaPortal not full screen but windowed and see if the WinLIRC is turning green while MediaPortal is running (when the icon in the task bar turns green it means that it received and processed a command).
 
S

schlogi

Guest
Ok. Thanks for your reply.
I found out why WinLIRC didn't respond to my remote: it's simply because I always have a connection between my HTPC and my other PC via TightVNC (a remote desktop program). When I disconnect, everything works fine. :) Stupid, but simple.

Nevertheless your hint is right. I already tried that and wondered why the WinLIRC icon did not turn to green. That's why I thought, MP uses too much CPU time.

Thank you for your help! Great plugin!
 

SpaceProtector

Portal Member
November 30, 2004
23
0
There is one problem with the plugin. Once you learned a command and saved the config file try learning another command. The old one is not deleted from the config file and so it is not really freed up for other use. If I remember right, the colors (green/red) where not correct after restarting the plugin setup.
 

Users who are viewing this thread

Top Bottom