Pulse-Eight CEC +

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Tue Jun 05, 2018 9:13 am

and 8ms is not fast.



plop this into a python script and run it. this is going to ask for the current cursor position as many times as it can within 8 milliseconds. LOL and then it is going to tell you how many times it got the position when it is done. i have it calculating the time in nanoseconds 0.000000001 seconds. Or a billionth of a second.

run it 3 or 4 times.

Code: Select all

import time
import ctypes

from ctypes.wintypes import BOOL, POINT

user32 = ctypes.windll.user32

tmp = []

GetCursorPos = user32.GetCursorPos
GetCursorPos.restype = BOOL

pos = POINT()
point = ctypes.byref(pos)
start_time = time.time()

while (time.time() - start_time) * 1000000000 < 8000000.0:

    GetCursorPos(point)
    tmp += [[pos.x, pos.y]]

print 'number of gotten positions:', len(tmp)
print 'number of gotten positions per millisecond:', len(tmp) / 8
print 'one position gotten every:', 8.0 / len(tmp), 'milliseconds'
print '                          ', 8000.0 / len(tmp), 'microseconds'
print '                          ', 8000000.0 / len(tmp), 'nanoseconds'

fun facts

1.016703362164 nanoseconds – time taken by light to travel 1 foot in a vacuum
3.3356409519815 nanoseconds – time taken by light to travel 1 metre in a vacuum
20–40 nanoseconds – time of fusion reaction in a hydrogen bomb
If you like the work I have been doing then feel free to Image

tatankov
Posts: 8
Joined: Mon May 28, 2018 1:08 pm

Re: Pulse-Eight CEC +

Post by tatankov » Tue Jun 05, 2018 10:38 am

Nice, this will be a nice stress test.
I will do it tonight.

I am pretty sure the bottleneck is not within Eventghost, but somewhere between the LG Remote Control and Pulse eight device.

Yesterday night I have made a simple test. Pressed during 30 seconds the remote Down key and checked on EG how many events, were reported on the log.
I accounted for 1 Key press event, each 60 milisecs. Thats 7 times slower then a standard mouse, so is not a big surprise it's hard to emulate a natural mouse movements.

Must probably is the remote control that needs 60 ms to send each hdmi-cec event. Infra-red is not the most performant "transport" protocol.

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Tue Jun 05, 2018 4:12 pm

that is correct then. a 60 millisecond spacing sounds about right. the fastest is the sony12 protocol at 45 milliseconds. what we need to do is we need to "smooth" out the mouse movements. instead of using the built in mouse move which works on pixels we are going to use the Windows API and tell it to go in a direction at a specific speed with an acceleration curve. and so long as the events keep on coming in it will keep on heading in that direction. when the events stop then we will tell the pointer to stop.
If you like the work I have been doing then feel free to Image

User avatar
hoksilato
Posts: 3
Joined: Sat Jul 07, 2018 5:40 pm

Re: Pulse-Eight CEC +

Post by hoksilato » Sat Jul 07, 2018 6:08 pm

Greetings @kgschlosser,

I was trying your last version of Pulse-Eight CEC+ plugin for EG, but I have too big problems:

1- Everytime when I open EG, AVR has auto power on. I have "AVR Audio" option with a check and "Wake AVR" without a check.
2- remote key presses used by TV controller are tooooo slow, and if I push quickly a lot of buttons, EG has a crash.

TV: Samsung 40C8000
AVR: Yamaha RX-567
Other HDMI-CEC Hardware: Nexus Player, PS3

Log:

Code: Select all

19:38:47      Plugin: Pulse-Eight CEC+
19:38:47         CEC: Loading Adapters...
19:38:47         CEC: Starting adapter Windows 10+ on port COM3
19:38:56   CEC Adapter Started
19:38:56   Adapter Name: Windows 10+
19:38:56   Adapter Serial Port: COM3
19:38:56   Adapter Device Emulation: recording device
19:38:56   Available Devices: TV, Windows 10+, RX-V567, Playback 3
19:38:56   AVR Volume Control: On
19:38:56   PulseEight.Adapter.Windows 10+.Connected
Thanks for your help :) Im in for more beta tests and sorry for my english.

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Sat Jul 07, 2018 7:15 pm

no worries about the English m8

The remote button press speed I have no control over. This is how fast the device sends out the key presses.
I am going to switch over the events to enduring events this should fix the crash issue but also allow you to make better use of press and hold type of key presses.. as an example volume. You will be able to use the auto repeat action that will cause the macro to keep looping until you release the button. This will bypass the slow key press issue.

I know that with my TV i get events for key presses every 50 milliseconds. This could have been something they improved upon with the D series TV's
Have you tried updating the firmware for your TV???

If the AVR gets powered on at the start of EG before you get a connected event for the device. this is something the device is doing when it receives CEC data from a new device on the CEC network (which would be the CEC adapter it's self) You can test this theory out if you install the pulse eight CEC drivers (uncheck the install EventGhost plugin option). then with EventGhost closed run the CECTray program and see if the AVR turns on when the program first launches. Let me know either way if it does or does not.
If you like the work I have been doing then feel free to Image

User avatar
hoksilato
Posts: 3
Joined: Sat Jul 07, 2018 5:40 pm

Re: Pulse-Eight CEC +

Post by hoksilato » Sun Jul 08, 2018 11:47 am

I compare key presses speed with Pulse-Eight CEC original plugin (I don't remember the version). I think that it's possible error with cache or something like that, because first presses are ok (normal slow speed), but as I press some keys, the slowness increases and sometimes crash.

My TV has the last firmware. Thanks :)

I think that your plugin wake up AVR at start allways. If I disable Plugin and enable again, AVR wake up again. With original plugin. If I start EG without plugin AVR is still in standby.

Thanks for your help!

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Sun Jul 08, 2018 7:50 pm

OK cool that helps. Unfortunately I do not have a CEC compliant AVR to test these things with. so all the input you are giving helps out.

The original plugin used enduring events for the key presses. and I will make the changes to put that into place. I will also have a look see at what could be causing the issue with the AVR
If you like the work I have been doing then feel free to Image

User avatar
hoksilato
Posts: 3
Joined: Sat Jul 07, 2018 5:40 pm

Re: Pulse-Eight CEC +

Post by hoksilato » Sat Jul 14, 2018 12:20 pm

thanks kgschlosser, when you public new version I will prepare my feedback. :D

jonib
Plugin Developer
Posts: 1318
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Pulse-Eight CEC +

Post by jonib » Sun Feb 24, 2019 7:06 pm

What should a raw CEC command look like?

I can send these commands via the commandline tool to change to a specific HDMI input:

HDMI 1
echo tx 4f:82:10:00 | cec-client.exe -s
HDMI 2
echo tx 4f:82:20:00 | cec-client.exe -s
But I can't figure out what I need to put in the EventGhost plugin to change HDMI input.

Code: Select all

   Pulse-Eight CEC+: Send Raw Command tx 4f:82:20:00: Adapter: EventGhost on COM3
      Error in Action: "Pulse-Eight CEC+: Send Raw Command tx 4f:82:20:00: Adapter: EventGhost on COM3"
      Traceback (most recent call last) (0.5.0-beta6):
        File "C:\Program Files (x86)\Utils\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
          return self(*args)
        File "C:\ProgramData\EventGhost\plugins\PulseEightPlus\__init__.py", line 1398, in __call__
          packet = adapter.CommandFromString(command)
        File "C:\ProgramData\EventGhost\plugins\PulseEightPlus\__cec_core\cec\__init__.py", line 1407, in CommandFromString
          return _cec.ICECAdapter_CommandFromString(self, strCommand)
      TypeError: in method 'ICECAdapter_CommandFromString', argument 2 of type 'char const *'
jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Sun Feb 24, 2019 8:21 pm

only this

4f:82:20:00
If you like the work I have been doing then feel free to Image

jonib
Plugin Developer
Posts: 1318
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Pulse-Eight CEC +

Post by jonib » Sun Feb 24, 2019 9:38 pm

kgschlosser wrote:
Sun Feb 24, 2019 8:21 pm
only this

4f:82:20:00
I did try that before, but got the same result.

Code: Select all

Pulse-Eight CEC+: Send Raw Command 4f:82:20:00: Adapter: EventGhost on COM3
   Error in Action: "Pulse-Eight CEC+: Send Raw Command 4f:82:20:00: Adapter: EventGhost on COM3"
   Traceback (most recent call last) (0.5.0-beta6):
     File "C:\Program Files (x86)\Utils\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
       return self(*args)
     File "C:\ProgramData\EventGhost\plugins\PulseEightPlus\__init__.py", line 1398, in __call__
       packet = adapter.CommandFromString(command)
     File "C:\ProgramData\EventGhost\plugins\PulseEightPlus\__cec_core\cec\__init__.py", line 1407, in CommandFromString
       return _cec.ICECAdapter_CommandFromString(self, strCommand)
   TypeError: in method 'ICECAdapter_CommandFromString', argument 2 of type 'char const *'
jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Mon Feb 25, 2019 8:34 am

I will bet that the wx control is passing back a unicode object and that is causing the error.

have you tried running the action from a python script?

copy the action as python. past it into a script.. remove the u before the command you are sending. Let me know if that works. if it does I will change thee plugin. if it does not I will have to do more investigating.
If you like the work I have been doing then feel free to Image

jonib
Plugin Developer
Posts: 1318
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Pulse-Eight CEC +

Post by jonib » Mon Feb 25, 2019 2:06 pm

kgschlosser wrote:
Mon Feb 25, 2019 8:34 am
have you tried running the action from a python script?
remove the u before the command you are sending
Yupp this works, thanks.

Is there another command that I missed to change the HDMI input?

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

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

Re: Pulse-Eight CEC +

Post by kgschlosser » Mon Feb 25, 2019 5:18 pm

ok so if you run the action as python code. it works fine. just not from the dialog..

question tho.. why are you using the command input? There should be an action for changing the input and that action will enumerate all available inputs on the TV..
If you like the work I have been doing then feel free to Image

jonib
Plugin Developer
Posts: 1318
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Pulse-Eight CEC +

Post by jonib » Mon Feb 25, 2019 5:31 pm

kgschlosser wrote:
Mon Feb 25, 2019 5:18 pm
question tho.. why are you using the command input? There should be an action for changing the input and that action will enumerate all available inputs on the TV..
Unfortunately I did not find such an action, mind enlightening me?

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

Post Reply