Microsoft MCE Remote - Vista and newer

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Fri Aug 09, 2019 7:53 pm

that is an enduring event my friend.

if you place that event into a macro with a repeat action and whatever action it is you want to run then the macro will loop over and over until you release the button.

that is why the EG busy icon stays lit red. that's telling you that it is processing an event because you are holding the button it keeps the same event running.
If you like the work I have been doing then feel free to Image

Snacuum
Posts: 7
Joined: Thu Nov 23, 2017 4:01 am

Re: Microsoft MCE Remote - Vista and newer

Post by Snacuum » Sun Aug 25, 2019 2:40 pm

Unfortunately it doesn't appear to run the loop. The event log on the left literally stops at the send IR action and doe not continue to the repeat macro action. Even if the 'enduring' event is indeed occuring, it's only enduring a single action, and not the whole macro. No matter how long I hold the button, the 'volume up/down' macro only completes once and changes volume by one tick. Unless I've made the macro wrong, it certainly isn't working how enduring events are as described.

The forum doesn't seem to want me to post macro code here so my description is just:

Macro Start
Event - MceRemote.Mce.VolumeDown
Action - MCE_Vista.TransmitIR (Massive IR Code Here) This is where the event log stops until I let go of the button
Action - Auto-Repeat Macro: 0.6
Macro End

Also I'm having another issue where certain transmit actions don't work at all. I record them via the plugin from my receiver remote, but when I try to test or run the action the receiever doesn't respond (it's remote still works fine). Continuing to test/send then just crashes EG like it was overwhelmed or something. I want to use this plugin with my MCE remote, but is there a compatible alternative for me to try out?

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Mon Aug 26, 2019 8:19 am

I really do know this is going to sound completely nutz.. But this is what I want you to do.


Open up eventghost as an administrator..
go into the plugin config dialog for the MCE remote Vista + plugin.
Stop and uninstall the service.

DO NOT REBOOT

save and exit eventghost.
then go to control panel -> administrative tools -> services
scroll through the services list and verify that the alternate MCEIR service is stopped. It may still be there and flagged for removal at next reboot. We just want to make sure it is stopped.

Now go to control panel -> device manager

You are going to need to poke about here a bit. Drivers get stuck in many different places.. I need you to uninstall any drivers that have USBCIR in the name or ehome. DO NOT DELETE THE DRIVER just uninstall it.

DO NOT UNPLUG YOUR RECEIVER

IMPORTANT
read this whole section before you restart!!!!
once you make sure they are all uninstalled. I want you to restart Windows.
Once the system starts to restart.. and I do mean right away. I want you to pick a button on the remote any button doesn't matter. point it at the receiver and keep on tapping the button. do not stop tapping the button even when the login screen appears. keep on tapping that bugger. if you can login with one hand then go right ahead..

You should hear 3-4 device installation successful chimes do not stop tapping that bugger until you have heard a few of them I think the magic number is 3. but it could be 4..

after the PC has started back up and the driver installed. reboot the computer again.
once it has booted up then open EG as an administrator and install the service..
save and close EG

reboot yet again. this is the last time i promise!

after it boots up hopefully the remote should work properly.


This is going to reset the whole USBCIR/ehome stack. You have to keep on pressing that button on the remote because on some remotes and receivers there is a sleep mode. the remote and receiver will enter this mode if they are not being used.. when the PC starts up the receiver wakes up.. it just so happens that the timing on the sleep ends up right in the middle of windows installing the drivers. While the system reports no issues there is actually a problem and the drivers end up 1/2 installed. the tapping of the button ensures the receiver will not go to sleep.

It took me a long time (years) to figure this out. It has corrected all kinds of odd and strange behavior when using the remote.. I personally had the exact same issue you are having now. i never check the enduring events to see if they worked or not but the IR codes not working and EG crashing.. This solved the issue for me..

it's worth a shot and should only take 5 minutes of your time to do.

REMEMBER if you plug the receiver into a different USB port at any point in time. remember to keep on tapping that remote button after you plug the thing in.
Windows will install a new set of drivers for each USB port you plug the thing into.
If you like the work I have been doing then feel free to Image

Snacuum
Posts: 7
Joined: Thu Nov 23, 2017 4:01 am

Re: Microsoft MCE Remote - Vista and newer

Post by Snacuum » Sun Sep 01, 2019 12:50 pm

I've given your solution a few shots (including a complete reinstall of EG) and still my problem persists. Enduring events still don't repeat and some particular signals don't work. However it does seem more stable as it's not crashing as often, thanks!

For continuing to fixing problem is there any information or logs I can provide to help? I'm using EventGhost 0.5.0 rc6 and my receiver is a Pioneer VSX-831. My remote I got off ebay and is a little hard to identify; it looks like the standard black HP remote with the wider bump on the right and the four coloured buttons, the IR unit is the grey box with two blaster leadscoming out the back.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Sun Sep 01, 2019 8:55 pm

it sounds like you have the pinnacle USB IR Receiver. That is the one that I have and It works like a charm..

I did manage to get the original source code to the service to compile,. I had to make some alterations to it to do so because of the missing components. I will have a look see at it and possibly I can determine what is going on. It has been a while since I have messed around with IR remotes hopefully my bean still has the information stored in it and I won't have to spend to mych time learning all over again. LOL
If you like the work I have been doing then feel free to Image

Snacuum
Posts: 7
Joined: Thu Nov 23, 2017 4:01 am

Re: Microsoft MCE Remote - Vista and newer

Post by Snacuum » Thu Sep 05, 2019 4:42 am

It has been a while since I have messed around with IR remotes
Thanks. Is there something else you use nowadays? I bought this one because it was cheap.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Thu Sep 05, 2019 12:22 pm

I do not use the MCE remote vista plugin. I have a slew of Arduino micro controllers scatter throughout my house. Each one handles the decoding of the IR and sends events into EventGhost. Each one also has a static IP address so I know which room the ir code is coming from. so all of my remotes are identical and all have the exact same IR codes programmed into them. so I can carry a remote from room to room and it will automatically switch to controlling the devices in that room without the need for any user intervention.
If you like the work I have been doing then feel free to Image

Snacuum
Posts: 7
Joined: Thu Nov 23, 2017 4:01 am

Re: Microsoft MCE Remote - Vista and newer

Post by Snacuum » Mon Nov 18, 2019 6:21 am

I have an update for my situation.

As I continued to troubleshoot my issues with my receiver I eventually found the pronto codes for it. These worked flawlessly! This leads me to believe that the Pioneer remote sends a multitude of compatible codes for Pioneer devices and when attempting to teach them to EventGhost it fails to correctly learn and reproduce the whole pattern. By using the specific associated code copied into EG it, of course, works.

Unfortunately getting the volume up/down enduring event to work correctly is another problem. I tested out a whole variety of combinations and have at least learned more about what works and what doesn't.

I know enduring events work in general because keyboard commands will transmit recurringly. Also I've set up my system with Kodi and my MCE remote correctly triggers enduring events built by the XBMC2 plugin. What never works is the remote can't seem to work in tandem with the blaster. As described before, when holding the button the remotes little red light stays on, the blasters light stays on and the icon for EG stays red (light enduring) yet no actions start until I let go of the button. I even tried using the receivers own signal in the macro and while it does blink and recur, it's not smooth and endures for too long.

This makes me think it's one of two things:

1) The blaster can't transmit until it stops receiving.
2) The Pioneer receiver expects a second code to start a continuous volume change.

I'm hoping this helps narrow it down.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Tue Nov 19, 2019 6:10 am

enduring events will only work if the plugin that is generating the event generates the event as enduring. In order for a plugin to be able to generate enduring events it needs to know a "pressed" state as well as a "released" state. this is not always available the plugin only knows gets informed of the "pressed" state and generated a single event from that. without knowing when to release the enduring event it would run forever.

you can check to see if an event is enduring or not by adding a python command action below the event and adding this code to it.

Code: Select all

print eg.event.shouldEnd.is_set()
[code]

True = NOT enduring event
False = Enduring event

This test is only going to work while the state is "pressed" you can check this by using the keyboard plugin if you want.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Tue Nov 19, 2019 6:20 am

you can check to see if the blaster is blasting by using the camera on a cell phone (not iphone) just leave it in preview and look at the blaster through the phone and you will see the ir pulsing if the code is being sent. This is a good way to know if anything is being sent in repetition.. Some codes are also LONG!!!! long meaning they take forever to transmit not in actual length. try moving up your repeat time.
If you like the work I have been doing then feel free to Image

Snacuum
Posts: 7
Joined: Thu Nov 23, 2017 4:01 am

Re: Microsoft MCE Remote - Vista and newer

Post by Snacuum » Thu Dec 12, 2019 6:33 am

kgschlosser wrote:
Tue Nov 19, 2019 6:10 am
enduring events will only work if the plugin that is generating the event generates the event as enduring. In order for a plugin to be able to generate enduring events it needs to know a "pressed" state as well as a "released" state. this is not always available the plugin only knows gets informed of the "pressed" state and generated a single event from that. without knowing when to release the enduring event it would run forever.

you can check to see if an event is enduring or not by adding a python command action below the event and adding this code to it.

Code: Select all

print eg.event.shouldEnd.is_set()
True = NOT enduring event
False = Enduring event

This test is only going to work while the state is "pressed" you can check this by using the keyboard plugin if you want.
If I place that command directly after "MceRemote.Mce.VolumeUp" Then I get return False.
If I place it after "Transmit IR" or "Auto-Repeat Macro" it returns True.

However, as I described earlier, the event log freezes on the Transmit IR until I let go of the button. So those results make sense for my situation. The event is capable of enduring programmatically and yet still it gets stuck on transmitting.

When looking at the IR sense through my phone camera the blaster doesn't flash until I let go of the button. This appears to be consistent with my issue. I tried playing around with the repeat settings up to around 2 seconds of repeat delay and no change in bahvior. If I try rapidly pressing the button EGs event log fills up with separate events, but on a bit of a sluggish delay (like it's waiting for the blaster to send each time) and then fills up with a buch of "MceRemote.Unknown" codes like as if the blaster filled up with junk signals.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Thu Dec 12, 2019 6:18 pm

ok the event being produces is an enduring event.. so now we know that.
Snacuum wrote:
Thu Dec 12, 2019 6:33 am
If I place that command directly after "MceRemote.Mce.VolumeUp" Then I get return False.
If I place it after "Transmit IR" or "Auto-Repeat Macro" it returns True.
OK so now we know 100% that it is an enduring event. That is a good thing.


OYE!!!!! I do not know why this did not come to me beforehand...

The blaster can only blast OR receive. it cannot do both at the same time. the reason why it gets "stuck" is because it is busy receiving. so the sending waits until the receiving has finished.

Now.. I do not know if that is the limitation of the device, windows, the service or EG. sem;colon would be the one that would have to answer that question.

I was tinkering about with getting rid of the service by either writing a dll file in c to handle the IR portion or writing a pure python connection to the IR API in Windows. The funny thing is I had misplaced my IR receiver (haven't been able to locate it for almost a year) and just yesterday I found the thing. So I am going to guess that now must be the time when I am supposed to do something with the service LOL...

Strange how things like that happen. Will do some preliminary investigation into the sending and receiving. because honestly it does not make sense that it holds things up like that..
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Thu Dec 12, 2019 6:58 pm

It's a limitation in the service. It as written incorrectly.

Let me give you the rundown..

There is a thread loop. this loop runs until the service gets stopped. this loop does several things. The communications between EG and the service takes place over a named pipe. so the loop is responsible for writing and reading data from the named pipe. when you use the transmit action the ir code gets sent over this pipe to the service. the service is supposed to read the data and then transmit.. Now there is a big BUT in here.. the ay the code is written is like the following.

Code: Select all


# causes thread to loop forever,
while True:
    # reading the pipe for information:
    transmit_packet = pipe.receive()
    
     # send the ir code is there is one to send
    if transmit_packet:
        ir.send(transmit_packet)
        
    # receive a packet and if there is one pass it to EG over the pipe
    receive_packet = ir.receive()
    while receive_packet():
        pipe.send(receive_packet )
        receive_packet = ir.receive()

the above code is not real code it is for the purpose of explaining the loop inside a loop thing.

if you see the portion where it is receiving the code. it is going to continue to loop reading the codes until you let go of the remote button. and then at that point it is able to continue with the thread loop and read the packets in the pipe. there must have been an issue at some point with the pipe "filling up" because of this because in EG there is a program stall in the TransmitIR action that causes the thread that called the action to stop and wait until you let go of the button on the remote.


There are no comments in the source code for the service that indicates that this is an intentional design due to limitations in the hardware.. I am going to guess that it may have been a programming oversight. This does need to be corrected. in order to correct it in the service it is going to be a pretty large modification, large enough that it makes me want to rewrite the thing as a dll. almost 2/3rds of the code is service only code and has nothing to do with the IR pieces. there is no need to have a thread always looping and reading that damned blaster when there is not an application running to even accept the data. This whole things can be simplified.. I know it was written like this to overcome limitations 20 years ago. python was a slow mule back then and the computers available did not keep pace with the software. so the machine were under powered. so this kind of processing NEEDED to be done in c code in order to get the speed needed. I think that with the technology today we should be able to handle this ith the need for any c code and also without the service.

This will allow for several things to happen. optionally w will be able to remove/replace the registry keys that enable the remote for normal Windows operations upon startup and shutdown of EG. this means that the power button on the remote will go back to operating like a power button if EG is not running. and while it is running EG has the abilities to handle the shutdown/suspend of the machine as needed..

the use of multiple threads just to read IR is no longer going to be needed. the problematic named pipe will go bye bye. the lack of error and debug message generated by the service is no longer going to be an issue. we will know hat is happening and why at all times!

This should not take me that long to ut together. I have most of the pieces needed to complete this already written I just have to assemble them together.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Fri Dec 13, 2019 2:59 am

HOLY CRAP!!!

that whole service is coded incorrectly.

They are using the receivers learn mode to read IR all the time for normal operation. So the range is going to be shit they are passing incorrect structires to DeviceIoControl for it to fill with data when receiving. No wonder why so many people complain about issues with this thing.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Microsoft MCE Remote - Vista and newer

Post by kgschlosser » Fri Dec 13, 2019 7:11 am

OK so this is the skinny.

I have finished up writing the back end (the windows API bits and pieces) and I believe it should work.. I did test a bunch of it already. The discovering of the receiver works. I can get the path to the receiver and connect to it without problem. I have to test the receiving and transmitting.

New features thus far...

you can target a specific emitter (blaster) to send to, or you can target all of them at the same time.
no longer using "learn" as the primary way to receive IR data.
if a device has either a single learn port or multiple learn ports it will blink the led of the port it is set to learn on when learning has started (if supported)
the ability to get the number of transmit ports and also the number of learn ports
the ability to get the port ids for transmit and learn
no longer locks out the receiving of IR when a transmit is taking place


this last feature is the proverbial cherry on top.

supports multiple IR receiver devices. so you can now have a single machine with 2, 3, 4, etc.. MCE IR receivers.
The use case for this would be running a program like virtualhere that provides USB over IP functionality. you can set up a single PC that runs EG and grab Raspberry PI's and MCE IR receivers for each of the rooms where you want to have a remote control install virtualhere on the PC and on each of the Raspberry Pi's point the USB for the Pi's to the PC and it is like you plugged the receivers directly into the PC (when you really didn't)
Now I would consider that to be a damned handy ability.... extend the remote control portion of your HA into every room of the house without the need to run wiring for blasters or buying more expensive less reliable devices to do the work. so for around 35.00 USD per room I would say that is pretty cheap actually.

Oh also... NO MORE SERVICE!!!!


I am going to modify the plugin in a manner that the old API for it will still work. and I will add new features to it that can be changed when the action config dialogs get opened up. while I am at it I will probably add an ir code lookup feature to the transmit action that will pull codes from an online IR database.
If you like the work I have been doing then feel free to Image

Post Reply