Help wanted inquire within.

Keep up to date with EG related information here.
User avatar
kgschlosser
Site Admin
Posts: 3952
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Help wanted inquire within.

Post by kgschlosser » Thu May 31, 2018 5:24 pm

OK folks. I have started the process of tearing EG into 2 pieces. The core and the GUI. The purpose for this is so that we can run EG as a service. The part I would like some help with is the GUI end of things. The original GUI i will modify to work. but what I would like some help with is the connection between the GUI and the service. specifically the data that is going to flow between the 2. My plan is to have the service be a websocket server. this way a web based front end can be made. So the data set is something that i want to make in a manner that will be easy to use on the web side. I am thinking that JSON is the way to go. probably JSON RPC. its the organization of the data structure that i need some schooling in. So if there is someone that is proficient in web development and is willing to spend the the it would be appreciated. I have already stripped down the core of all the GUI related code. I restructured the core so there is no more DynamicModule (everything in EG now displays without errors when using an IDE). what i have left is the creation of the service. and the mechanism to send the data back and forth. I still have to create a GUI only version of EG. and create a builder. I am going to remove the use of pywin32 in favor of a builder that has the ability to compile cross platform. I have also started redesigning the WinApi section of eg to prepare for being cross platform. I should have a working service within the next few days. I won't have a GUI for it. but i will be able to see what is going on through a console of sorts.

Unfortunately due to some of the changes there is going to have to be some API alterations. specifically with the use of wxPython.I am going to do my best to override the bits that will cause issues. But i am going to have to create a secondary Configure class that will handle displaying of configuration dialogs for a web based control. This is also something that I can use a hand with.
If you like the work I have been doing then feel free to Image

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

Re: Help wanted inquire within.

Post by kgschlosser » Fri Jun 01, 2018 8:47 am

well i wanted to post an opdate. I have EG running with wx and stackless removed completely. and how about this... from the time it take from initially starting EG to the time the Main.OnInit is fired with 3 plugins to load plus the 4 core plugins. it takes exactly 1.71200013161 seconds. that a 6 core AMD running at 3.4ghz with 8gigs of ram. and a 250gig OCZ ARC SSD. i have less then 1gig of available memory. my swap file is set to 512meg and there are 112 processes running. So i would have to say that is pretty blazing speed if you ask me. Then I added 10 additional plugins and the speed is 1.82500004768 seconds. The control and output is through the python interpreter console.

I am pretty stoked about this. This is a GREAT outcome. because it runs like this it should run as a service as well. I am going to test that ability once i get a websocket server in place to simply spit out the logging data.
If you like the work I have been doing then feel free to Image

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

Re: Help wanted inquire within.

Post by kgschlosser » Fri Jun 01, 2018 11:30 am

ok so here goes. IT WORKS! I have EG running as a service. There are a lot of changes that will have to be made if this is something that people want.

I have to change the default config directory location.
I have to figure out why the clipboard events are not working (i suspect this is due to registering a dummy window.)
It seems to be that anything involved with a specific user logon are toast. they are not going to work. I am sure I might be able to come up with a way around it. I know that you can set a service to logon as a specific username. But it will always be the same name that is logged in
If you like the work I have been doing then feel free to Image

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

Re: Help wanted inquire within.

Post by kgschlosser » Sat Jun 02, 2018 8:11 am

well here is a screen shot of EG running without a GUI. It also shows a very basic transfer of data over a websocket connection.
eventghost.service.png
If you like the work I have been doing then feel free to Image

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

Re: Help wanted inquire within.

Post by kgschlosser » Sat Jun 02, 2018 6:31 pm

in case anyone that has some python skill wanted to give this a try. I put it up on my github Repository.

Here are the requirements
python 2.7 x32
pywin32
sphinx
Pillow (PIL)
comtypes
ctypeslib
commonmark

be sure when installing pyhton that you check off adding python to the path

you will need to download the repository as a zip file. and expand it to a temporary folder

open up a command window to that bath. in the main directory there are 2 files we are going to run.


there are 2 ways you can run the service. some of the user specific goodies won't be available if you do not choose the second.

Code: Select all

spython service.py
this is an optional way to run it

Code: Select all

python service.py --username SOMECOMPUTERNAME\SOMEUSERNAME --password SOMEPASSWORD
[code]
you need to replace the computername/username with the account you want to have the service login as and the password with that accounts password

after the service installs and runs. you then want to execute the following

[code]
python websocket_client.py
This is going to show you the output of EG
It is mostly non functioning meaning you can't add/delete from the tree. and you will probably experience plugin errors because of the lack of wxPython but it will show that it is possible.

I have to change the system plugin to get the events for devices, sessions, power notifications working again. I am not sure what to do about the clipboard. some of the features that require a hidden window are not going to work because it requires a user to be logged in. now providing the username and password takes care of some things. like the process watcher plugin and the user login stuff. But it doesn't handle all of it.

here is the link to the repo.

https://github.com/kdschlosser/EventGho ... st_service

I know some of the plugin devs are kicking about. I would really love some input on how to handle the GUI portion of it. should I add a native app?. or make it strictly web based?
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 476
Joined: Sat Feb 13, 2016 8:39 pm

Re: Help wanted inquire within.

Post by jachin99 » Sun Jun 03, 2018 4:38 am

I don't have much Dev experience but I'm in favor of a browser based interface. I see a lot of other programs use this and I have been pretty happy working in that environment. If there is a linux port in the works then I've seen this used with that as well. Maybe in the future you can add a way to create a way let other web based programs tap into the EG backend.

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

Re: Help wanted inquire within.

Post by kgschlosser » Sun Jun 03, 2018 9:48 am

the way i am writing the control for the service would be by use of a websocket connections. so all that would happen is EG would hand off data to whatever is asking for the information. and if there is a change to be made. then whatever is connected will send that change back to the EG service so it can make the changes.

The biggest thing I am trying to overcome is things like keyboard/mouse hooking and sending commands to control window objects. because of how windows is designed it does not allow a service to interact with the desktop directly. I understand the logic to it because if a user is not logged in there is nothing to control. so to make this whole thing work properly EG is going to have to get cut up into 3 parts. the service the GUI and an app that hides in the background that runs when a user logs in. that app will house any window control/input/window message code and would relay that information to the service to be processed. and when a user logs out that app will shutdown and will not send any more messages in and any plugin that tries to control any of those items won't be able to. But there is an extremely large portion of EG and it's plugins that do not use those specific parts. as an example is you wanted to dim the lights when you turn on your TV. this would still work. I do not know if windows shuts down ehome when a user logs off this is something that I have to test. as this is probably hands down the most used feature of EG. and it would suck if it does not work when EG is running as a service. I am going to be testing that out specifically really soon. because i do not want to waste time with the whole service aspect if that does not work. But I have learned that adding a way to control EG from a web based GUI is fairly easy to do. And I have also learned how to be rid of stackless python as well as the voodoo magic dynamic module loader in EG that does not allow a programming IDE to function properly.

as far as porting EG goes since I am now able to get EG to run without any GUI whats so ever it is a simple matter of change the windows specific controls out with ones that are designed for other operating systems. and an OS check can be done on startup to load the proper code.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 476
Joined: Sat Feb 13, 2016 8:39 pm

Re: Help wanted inquire within.

Post by jachin99 » Sun Jun 03, 2018 4:33 pm

For ehome working when the user is logged off, I believe there are a few services that must run, even if the machine is sleeping. For example, I believe the ehrec (Spelling?) service runs so that the machine does not miss recordings while asleep or logged off. There are other mechanisms to download updates in the background as well. I don't think any of these help for keyboard input. There are a few good programs on codeplex that utilize IP control, etc. for ehome. I can dig those up, and point you to them. One button that has to work when the machine is sleeping at least is the power/wake button. I can test it with a locked machine if needed. Media Center extenders also probably have to interact with a locked machine come to think of it.

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

Re: Help wanted inquire within.

Post by kgschlosser » Mon Jun 04, 2018 3:29 am

it's not about if the computer is sleeping. It is about if a user is logged in or not. I can key up a quick service that can connect to the AlternateMCEIr service and record the key presses to a log file. this will tell us if the thing can receive key presses if a user is not logged in. It all depends on how Microsoft coded the ehome crap.

Now I am wondering something. if it would be possible to have the service start another process that would be able to interact.. hmmm... more tests
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 476
Joined: Sat Feb 13, 2016 8:39 pm

Re: Help wanted inquire within.

Post by jachin99 » Thu Jun 21, 2018 3:17 am

If EG gets split up into a frontend backend or web client / server configuration then maybe it could get a UWP app listed in the store. It would obviously require a win 32 component to be installed but a store app might bring a chance to modernize parts of EG

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

Re: Help wanted inquire within.

Post by kgschlosser » Thu Jun 21, 2018 3:58 am

There are several issues with store apps.

1: certain aspects of the windows API are not accessible from a store app
2: drivers and the such have to be signed by Microsoft. This is something I would love to do, but it is a very complicated process and it has to be done correctly. If there is someone that has done this and could explain the process to me that would be greatly appreciated. I keep on finding conflicting information on the web.
3: EG uses a series of hidden windows to communicate with the windows API. I do not know if this is something that can be done with a store app. Now that I state this.... I wonder...There is a hidden window for mouse movements, and another for sending keystrokes and yet another for clipboard and then another for the main frame... this is a really bonkers setup. EG was made to have the main frame destroyed when it is minimized to the tray. This was to save on memory. Now.. if i was to keep the main frame. pipe all of the messages into the main frame instead of all of the other hidden frame then i could get rid of those. and when minimizing to a tray we could destroy all of the controls instead of destroying the frame. This would result in a smaller memory footprint. hmmm..... ya got my wheels turning on that one.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 476
Joined: Sat Feb 13, 2016 8:39 pm

Re: Help wanted inquire within.

Post by jachin99 » Fri Jun 22, 2018 12:59 am

There are a few reasons why a store app might benefit EG and deffinately more than a few reasons why having a store app is a bad idea. I'll start with the bad.

The API is limited a developers would have to focus effort on it. All around I hear the argument against store apps being the limited API but maybe that will change or the API will evolve. This I have to give the idea's critics.

Now for the good. Adding some eg app to the store shows others the project is still moving no matter how limited it is. Putting an app in the store and announcing it can bring some attention to the program and it would give EG a good reason to advertise itself as modern. Along with that the UWP platform is likely to evolve as nothing in the technology field stays static and thrives. MS knows that and I'm sure they have devs and insiders banging at the door every day for them to open things up some.

Security is a big issue, and I bet Windows will likely go through an ever expanding code reduction. Old code that let's malicious actors exploit known vulnerabilities in common older protocols are a weakness of windows. It's possible to configure windows to be more secure but that is really hard for most to get perfect. There is a whole other crowd banging on MS's door to finally kill old vulnerable code.
What's more, building some kind of uwp app gets the project through the door on that front. It doesn't have to be much but it's a start.

Finally this is worth considering because if EG is to be broken up into parts then now is the perfect time to plan for it. Adding to the discussion about where to go from here, give something like a UWP or web app the ability to at least display the graphics for EG. There are other apps out there that require a "server" type backend that does all the heavy lifting on the win API front. Hook those hidden apis with a background service and let the uwp app be the front end.

Either way this is more of a brainstorming session and I'm sure whatever direction EG takes it will still be great.

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

Re: Help wanted inquire within.

Post by kgschlosser » Fri Jun 22, 2018 3:48 am

We would love to make EG more of a client/server program. And because of the increased security I am not sure if EG would even be able to even be installed as a service.

And when we are talking about crippling EG. it would be all of the system events. no clipboard events, no MCE IR Support. no keyboard events. no mouse events. No Window actions. Audio actions would be limited to only the endpoint created for EG. this would be basically removing the soul of EG.


I have to read into the requirements for the apps to be 100% certain of what is and is not allowed. But i do know the noose is really tightened with what can be done as far as the Windows API
If you like the work I have been doing then feel free to Image

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

Re: Help wanted inquire within.

Post by kgschlosser » Fri Jun 22, 2018 3:52 am

as far as the client server aspect of EG. if a client connection is made even from a remote PC the user can be given the choice of having the actions carried out on the computer that has made the remote connection or on the server it's self. this is really neat because it's not Home Automation at that point. It's anywhere automation
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 476
Joined: Sat Feb 13, 2016 8:39 pm

Re: Help wanted inquire within.

Post by jachin99 » Tue Jun 26, 2018 1:21 am

They look like they could be opening up the mouse and keyboard apis a little for the XBox at least. https://arstechnica-com.cdn.ampproject. ... ut-soon%2F

Post Reply