Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

WOA (Wake On Access) - 'Just-in-time' WakeOnLan for MySql or File Server #1112

Merged
merged 0 commits into from Oct 23, 2012

Conversation

Projects
None yet
Contributor

t4-ravenbird commented Jul 2, 2012

Ticket : http://trac.xbmc.org/ticket/12739
Forum thread : http://forum.xbmc.org/showthread.php?tid=124340

Replacement for pull-request #1105 by @kricker
This is a refactored solution after comments from @elupus

Member

Karlson2k commented Jul 2, 2012

From my point of view adding functions in root namespace without any class is wrong.
Especially when function name is very general like 'WakeUp' or 'WaitAfterWake' - it can be confused with system wake functions.

Contributor

t4-ravenbird commented Jul 2, 2012

The functions you refer to are just local helpers and not in root namespace. Not public and not supposed to be.

@elupus elupus commented on an outdated diff Jul 2, 2012

xbmc/filesystem/Directory.cpp
@@ -121,7 +122,7 @@ bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, c
CHints hints;
hints.flags = flags;
hints.mask = strMask;
- return GetDirectory(strPath, items, hints);
+ return GetDirectory(strPath, items, hints, allowThreads);
@elupus

elupus Jul 2, 2012

Member

while a completely valid change, it's not really related to the pull request. It still need to be a separate commit.

Contributor

t4-ravenbird commented Jul 2, 2012

OK, as you probably understand I am unfamiliar with the process and how things are done so sorry about that.
'need to be separate commit' - Can it be a separate commit to this pr or must it actually be a separate pull request?

Member

elupus commented Jul 2, 2012

Technically it should have been a separate pull request, since then i
could have pushed the big merge button directly. But at least a
separate commit, since then i can commit it by itself.

Contributor

t4-ravenbird commented Jul 2, 2012

The commit has been updated, do you have more remarks?
Will you handle the GetDirectory() bug or should I? (As it is now the animated 'working..' message is not shown)

@elupus elupus commented on an outdated diff Jul 2, 2012

xbmc/Util.cpp
+ }
+ }
+
+ dialog->Close();
+ }
+
+ Sleep (wait_ms);
+}
+
+static void WakeUp (const CStdString& mac_address, const CStdString& hostAddress, const CStdString& targetName)
+{
+ CLog::Log(LOGDEBUG,"OnAccessWakeUp [%s] trigged by accessing : %s", hostAddress.c_str(), targetName.c_str());
+
+ g_application.getNetwork().WakeOnLan(mac_address.c_str());
+}
+
@elupus

elupus Jul 2, 2012

Member

I see no reason this need to be a separate function. Please just put it in below wakeupfunction.

Contributor

t4-ravenbird commented Jul 2, 2012

It was singled out for readability only (same applies to the other separate function, which I expect any decent compiler will inline anyway)
Moving the other (WaitAfterWake) will severely obfuscate readability in my opinion so I did not touch it, but the function you pointed to is moved in the latest commit

Member

elupus commented Jul 2, 2012

@theuni , @cptspiff , comments. I must admit, that we did end up with very many calls for wakeup. It does look a bit messy.

Also. I don't really like this being a advanced setting without GUI. Nobody will know it's there.

Member

kricker commented Jul 2, 2012

We asked for help to get it added to the GUI, but there was no takers. I've been thinking more about that.

Where in the settings does it make the most sense? I was thinking maybe it is something done during source setup. You can enable or disable it there. But, there could be many sources coming from the same server just in different folders. There would need to be some logic that checked if the root source is already in the wakeup list or not. Even then you have to have a place to put the MAC address.

Owner

MartijnKaijser commented Jul 2, 2012

Since mysql setup isn't in GUI the WOL for that shouldn't be either.
For sources it could be under network settings.

Contributor

t4-ravenbird commented Jul 2, 2012

'.. end up with very many calls for wakeup ..'
Yes. That was what I attempted to avoid when I put it inside an already existing function in URIUtils (even if it was not an intuitive behaviour) I dont really know what is the lesser evil.

Contributor

t4-ravenbird commented Jul 3, 2012

@elupus '.. end up with very many calls for wakeup ..'
Maybe a solution could be to make a new function in 'Util' called 'PreparePath' or something similar
This function then should call 'URIUtils::SubstitutePath' and also do 'WakeUp' logic
In the classes File/Directory the scattered occurrences of this pattern
CStdString realPath = URIUtils::SubstitutePath(strPath); CUtil::WakeUpFileHost(realPath);
could then be replaced with
CStdString realPath = CUtil::PreparePath(strPath);

Comments?

Contributor

t4-ravenbird commented Jul 3, 2012

@MartijnKaijser Agreed! (Personally I dont think GUI-settings is important at all, there is a wiki for how-to use MySql and it should be updated if this thing flies)

@ghost

ghost commented Jul 3, 2012

if many calls are needed and we cannot find anywhere SANE to put it to reduce the amount of calls so be it. ^^^ is entering the non-logical in the name of saving a few chars of typing imo. changing an url and waking up a remote host is different cups of tea.

Member

kricker commented Jul 3, 2012

This works for more than mySQL databases. I use this with the default XBMC databases and a file server.

@elupus elupus commented on an outdated diff Jul 3, 2012

xbmc/settings/AdvancedSettings.h
@@ -198,6 +199,16 @@ class CAdvancedSettings
CStdString m_tvshowMultiPartEnumRegExp;
typedef std::vector< std::pair<CStdString, CStdString> > StringMapping;
StringMapping m_pathSubstitutions;
+
+ struct WakeUpEntry
+ {
+ CStdString host, mac;
+ unsigned timeout_ms, wait_ms;
+ XbmcThreads::EndTime nextWake;
+ };
+ typedef std::vector<WakeUpEntry*> WakeUpMapping;
@elupus

elupus Jul 3, 2012

Member

Will leak on xbmc exit, while normally not a problem per say, it makes valgrind tests harder (and libxbmc leaky). So please just make it:

typedef std::vector<WakeUpEntry> WakeUpMapping;

And skip the new construction. It should copy construct properly without any changes i think.

Alternatively you can add cleanup procedure to the AdvancedSettings destructor.

Contributor

t4-ravenbird commented Jul 3, 2012

OK, was not aware of those ..

Member

kricker commented Jul 5, 2012

Where are we on this? Still waiting for fixes or comments?

Member

elupus commented Jul 5, 2012

Code wise its okey. I just don't like it being advanced setting.
On Jul 5, 2012 11:07 PM, "kricker" <
reply@reply.github.com>
wrote:

Where are we on this? Still waiting for fixes or comments?


Reply to this email directly or view it on GitHub:
#1112 (comment)

Member

kricker commented Jul 5, 2012

Any takers on adding it to the GUI? I'll look myself, but I really suck at coding.

Contributor

t4-ravenbird commented Jul 6, 2012

I tried to look at how GUI-settings are done, but problem is the settings is an array of entries which probably need a brand new dialogue to input data in ..
http://oi47.tinypic.com/e0okg5.jpg
Even if it maybe belongs somewhere else in settings than my attempt here (system/power) a new dialogue is required ?
Unless I am missing something and there IS a way to programatically show an adapted version of a pre-existing generic dialogue?

Member

elupus commented Jul 6, 2012

Best would be a checkbox in add source dialog to wake host on access, and a
way to auto figure out mac address.
On Jul 6, 2012 12:05 PM, "t4-ravenbird" <
reply@reply.github.com>
wrote:

I tried to look at how GUI-settings are done, but problem is the settings
is an array of entries which probably need a brand new dialogue to input
data in ..
http://oi47.tinypic.com/e0okg5.jpg
Even if it maybe belongs somewhere else in settings than my attempt here
(system/power) a new dialogue is required ?
Unless I am missing something and there IS a way to programatically show
an adapted version of a pre-existing generic dialogue?


Reply to this email directly or view it on GitHub:
#1112 (comment)

Contributor

t4-ravenbird commented Jul 6, 2012

Hmm, there can be multiple sources from same host so that does not seem right
Besides ; the feature will also do wake before MySQL connect and the MySQL server may be on a server that is not listed in sources

Member

elupus commented Jul 6, 2012

Right. Maybe just populate the list from sources plus mysql. Then try to
find mac if possible and a checkbox to enable disable.
On Jul 6, 2012 1:10 PM, "t4-ravenbird" <
reply@reply.github.com>
wrote:

Hmm, there can be multiple sources from same host so that does not seem
right
Besides ; the feature will also do wake before MySQL connect and the MySQL
server may be on a server that is not listed in sources


Reply to this email directly or view it on GitHub:
#1112 (comment)

Contributor

t4-ravenbird commented Jul 6, 2012

Populate which list?
A list that comes up in settings/system/power that simply lists all known servers (found by searching sources+mysql+pathsubstitutions..) - and then simply a checkbox for each
Is that what you have in mind?

Contributor

t4-ravenbird commented Jul 6, 2012

^^ Actually just a checkbox will not be enough, we need a couple of time-out settings as well for each entry

Member

kricker commented Jul 6, 2012

Does XBMC already have some magic code to resolve a MAC address from an IP or NetBios name? And as T4_Ravenbird said, there are timeout settings as well, unless you set a default one extremly long to accomodate slow waking servers. So, if there was a way to grab the MAC addresss programatically, you'll then need a checkbox and timeout setting for each server. Or in Network settings, just one checkbox and timeout setting for all servers.

Member

elupus commented Jul 6, 2012

A list that comes up in settings/system/power that simply lists all known servers (found by searching sources+mysql+pathsubstitutions..) - and then simply a checkbox for each Is that what you have in mind?

Yup

Does XBMC already have some magic code to resolve a MAC address from an IP or NetBios name? And as T4_Ravenbird said, there are timeout settings as well, unless you set a default one extremly long to accomodate slow waking servers. So, if there was a way to grab the MAC addresss programatically, you'll then need a checkbox and timeout setting for each server. Or in Network settings, just one checkbox and timeout setting for all servers.

Global timeout seem fine to me. But I don't think there is a way to
get MAC address easily cross platform, so we'd have to be able to
enter MAC address too i think. Adding it is probably not a major
problem on any platform and can be done step by step.

So we would need a list of servers, with a MAC address and checkbox.

I suppose this is getting rather complicated. So i'll probably not
push it. But if you feel like working on it I would much happier about
the the pull request.

Contributor

mikkle commented Jul 6, 2012

Automatically getting a MAC address from an IP address is not at all trivial if the IP address in question is on a different subnet.
You may chose to ignore this, seing as the CNetwork::WakeOnLan always send the magic cookie to the broadcast address. :]
Some people have routers, you know! ;-)

Contributor

t4-ravenbird commented Jul 6, 2012

Is there a way to make that GUI without adding new class(es) for new dialog(s) + new dialog resource file ?
From what I see in the GUI settings code I am led to believe we need to do something similar to the handling of parameters for the usb-cec adapters .. or am I missing something?

Member

kricker commented Jul 15, 2012

Are we waiting for GUI settings and magical MAC discovering before pulling this?

Member

elupus commented Jul 16, 2012

To start with we are waiting for next merge window. But I would love to se
a GUI too.

Contributor

t4-ravenbird commented Jul 18, 2012

I updated the commit

  • bug-fix (null pointer to busy-dialog-window)
  • added wait for network to get connected before sending wol (wol fails to transmit if net not ready shortly after resume)

@elupus ; changed files since last time util.cpp, advancedsettings.cpp/h

example advancedsettings including new parameter "netinittimeout" :

<onaccesswakeup>
    <netinittimeout>60</netinittimeout>
    <wakeup>
        <host>10.0.0.6</host>
        <mac>00:ff:f2:7d:df:1e</mac>
        <tmout>700</tmout>
        <wait>8</wait>
    </wakeup>
    <wakeup>
        <host>TOWER</host>
        <mac>a0:16:f2:7d:df:1e</mac>
        <tmout>2000</tmout>
        <wait>12</wait>
    </wakeup>
</onaccesswakeup>
Member

pieh commented Jul 31, 2012

Didn't notice there was need for some GUI love here - I can help with that (I think I would reuse existing windows/dialog to avoid additional work for skinners). IMO if this need MAC address to be manually entered than GUI setting is not right place for it. I think that if we would have MAC autodiscovery (generic interface and implementaiton for at least 1 platform) we could start doing GUI for this (I don't think that many users will know what MAC address is).

Member

kricker commented Jul 31, 2012

If you could create the GUI stuff, that would be fantastic. I don't think anyone has created that magical MAC auto-discovery code for XBMC yet. I'd hate to have to wait for that and not get the basic usability in. Anyone that has ever done any sort of WOL should know what a MAC address is. Someone who is just toying with the option though as you suggested may not know what it is.

Is it possible to use this feature as it is?

Contributor

t4-ravenbird commented Aug 15, 2012

Sure. It is useful as it is now, but can be improved further.
-Add GUI config. As it is now the config is through advancedsettings.xml, some find it important that things are settable in GUI instead.
-If GUI is made it would be nice to have auto-detect of mac-address, at least as much as possible, it is not trivial as mikkle pointed out.
-Add a Ping function so that the wait for the server can be aborted as soon as server responds. As it is now we will always wait a fixed period of time even if server is in fact alive already.

Member

bobo1on1 commented Aug 16, 2012

Regarding mysql wakeup, no need for a gui dialog here for several reasons:

  1. 99.9% of our users won't know what it's for, users already have trouble figuring out our settings, we don't want too many of them.
  2. You can't c/p into xbmc, it's easier to ssh in, start a text editor and c/p the mac address from ifconfig than it is typing in the mac address in the xbmc gui.
Member

pieh commented Aug 17, 2012

We need to discuss how gui for this should work. If we are to have it in gui I thnk auto-discovery is must. I already did code for win32 mac discovery (mostly copied from example in http://msdn.microsoft.com/en-us/library/windows/desktop/aa366358(v=vs.85).aspx) and moved wakeup entries from advancedsettings to settings and added saving to xml - will be pushing it my repo when I clean it up.

We had small discussion how this should look in gui and more or less figured out that we should autodiscover mac when adding source. There is catch obviously - we don't want this feature enabled for every network share:

  • server could be wifi connected - WoL won't work
  • server might not support WoL (doubtful) or not have WoL enabled
  • user might simply not want this feature

So possible way out is adding "try to wake up server" toggle to add/edit source dialog (along with short text description when it will actually work). Is this acceptable?

Contributor

t4-ravenbird commented Aug 17, 2012

Great to hear that you have been looking at this !

**

My thoughts on how GUI should look ;

  1. It does not belong in 'sources' at all ..
  • A server may very well be mapped up multiple times as source for various movie/music/picture paths .. with your suggestion some source entries to server may be toggled 'yes' on the 'try to wake' while others on the same server is toggled to 'no' .. now what?
  • A simple toggle is not enough, some timeout parameters are needed and manual edit of mac-adress if auto-detection fails
  • If you have no sources on the server you want to wake then there is no place to set it up. There could be a MySQL server that you want to start..
  • There could even be a 'pathsubstitution' setting that remaps some sources (which appears to be local) into a source that is actually on a server .. these will not be able to setup either
  1. I believe it fits into 'settings/system/power saving' like I tried to indicate in the beforementioned link : http://oi47.tinypic.com/e0okg5.jpg
    Upon entering this setting the following could run (some of this is also discussed with @elupus earlier in thread) :
  • enumerate all unique servers we know of by traversing all configured 'sources' + all MySQL databases + all 'pathsubstitusions'
  • auto-detect mac-address as well as we are able to for those servers
  • display this list with the 'try to wake' toggle together with the individual timeout settings..
  • manual adding & editing of mac-address should also be possible
Contributor

t4-ravenbird commented Aug 17, 2012

Another possible improvement to the entire feature is to Ping the server to determine when and if the wakeup is required.

Until this PR gets merged I have my XBMC setup with EventGhost and there I use Ping to abort waiting as soon as server is reachable so I know quite well the sequences that we could use in XBMC if Ping was available.

If someone would help adding a Ping method to the CNetwork class I could update the WakeOnAccess feature ..
(That change would mean we could drop the parameter 'wait' in the setting)

Contributor

t4-ravenbird commented Aug 17, 2012

@pieh Yet another improvement would be to give GUI feedback when the wakeup kicks in ..
As it is now the WINDOW_DIALOG_BUSY is shown in the case where we need to pause execution.. this could have been more informative if a custom dialog with a message was shown that indicate why we are waiting ..
But maybe it is too much effort for too little value?

Member

pieh commented Aug 17, 2012

Obviously wakeup entry would need to be linked to host and not source - in that dialog we would try path substitution and then get host - so if we have 2 source from same host and change toggle in 1st, it would automaticly "change" toggle in 2nd too.

Mysql could have additional entry in av.xml (<trytowakeup [macaddress="auto"]>yes</trytowakeup>). Or just keep it as now - in av.xml since mysql is also av.xml only setting.

You can use use WINDOW_DIALOG_PROGRESS with disabled progress bar instead of WINDOW_DIALOG_BUSY - it has slots for heading and 3 lines of text. Search code to see how to use it.

I don't want to block idea here, but typing mac address, timeout, etc manually in xbmc gui is not the way IMO. Person who know what mac address is will most likely prefer to edit .xml in text editor (where he can actually paste stuff) as bobo1on1 said. Person who doesn't know will only get confused seeing this "weird" fields he needs to fill. I can change my mind but I would need some reasons to do it.

Could You draw/sketch dialog You would see for it? Perhaps I wrongly see what would You like to have.

Owner

MartijnKaijser commented Aug 17, 2012

I agree with @pieh and @bobo1on1 that these options seem to advanced for regular users to be bothered with. One who can set up his network can also add some values to as.xml
If there is a noob simple way of adding one or to bools to the GUI that would function in general purpose it would be ok

Member

da-anda commented Aug 17, 2012

I'm advanced enough to mess with as.xml but don't really want to mess with it. I'd rather enter the mac address in the GUI from my couch then grabbing keyboard and mouse, searching the wiki for the correct xml tags and write that crap from a distance to the TV where that stuff is too hard to read in a texteditor. Entering the IP would be easier though if mac can be determined from that. Maybe we can discuss it on DevCon?

Contributor

t4-ravenbird commented Aug 17, 2012

Obviously wakeup entry would need to be linked to host and not source - in that dialog we would try path substitution and then get host - so if we have 2 source from same host and change toggle in 1st, it would automaticly "change" toggle in 2nd too.

OK, nice- that voids many of my objections.
Is it possible to have it like that and then let the code behind that GUI manipulate the entries in as.xml?
If we could do it that way we would get a good compromise : one-click ease of use and full tweakability by editing as.xml manually ..
Or is that a dirty, nasty hack?
Alternatively, can we make a new woa_settings.xml which is tweakable by your GUI and manually?

Mysql could have additional entry in av.xml ...

My concern is that the settings for WOA should not be scattered with some under sources with GUI and then some under as.xml - that seems messy?

You can use use WINDOW_DIALOG_PROGRESS ..

Thanks, will have a look!

... typing mac address, timeout, etc manually in xbmc gui is not the way IMO ..

Agreed! Therefore I thought it was appropriate to keep it in as.xml

Could You draw/sketch dialog You would see for it? Perhaps I wrongly see what would You like to have.

I could, but it would include editing mac-address and "weird" fields so I think you already know where that is going;-) .. Lets us see how the discussion develops further before I do that exercise..

Member

pieh commented Aug 17, 2012

@t4-ravenbird

Is it possible to have it like that and then let the code behind that GUI manipulate the entries in as.xml?

We don't write to as.xml but I already moved it from there, so we can read from and save to guisettings.xml - given that it doesn't really belong there I think creating seperate .xml (woa_settings.xml) for this alone would be OKish - I will handle that

My concern is that the settings for WOA should not be scattered with some under sources with GUI and then some under as.xml - that seems messy?

Right, we could just add notice to wiki that one could use WOA feature to wake mysql server and link to WOA speciffic page.

@da-anda
Point is to not need to do it manually at all, let xbmc auto-discover mac and hide all the magic from him (apart from toggle to enable/disable it). For me this is pretty much like discussion about having mysql db settings in gui - here we can say it's easier to do it from gui without editing .xml too but gui settings shouldn't have such advanced stuff IMO.

Member

pieh commented Aug 17, 2012

This is how (more or less) I would see this feature in gui:
https://dl.dropbox.com/u/28792047/xbmc/screenshot004.png (local path - toggle greyed out)
https://dl.dropbox.com/u/28792047/xbmc/screenshot005.png (network path, discover mac after enabling toggle)
https://dl.dropbox.com/u/28792047/xbmc/screenshot006.png (network path, disovery failed - i don't have "lol" host in my network)

Thoughts?

Owner

Memphiz commented Aug 17, 2012

i like it :)

Member

kricker commented Aug 17, 2012

If auto discovery fails, will it force the toggle off? Or will you then be able to enter the MAC manually and enable the toggle?

Owner

MartijnKaijser commented Aug 17, 2012

@pieh
Screenies make it look simple enough for users. If more source are added from same server will the dialog detect what settings the other one had? That would make sense

Member

pieh commented Aug 17, 2012

now I wonder if single toggle in add/edit source is good idea given that we can add source that could contain multiple paths: f.e. smb://host1/share and smb://host2/another_share_from_different_server - that toggle would need to be for each path there and this would be ugly

Member

jmarshallnz commented Aug 17, 2012

Can't we just send wol automatically if a general setting is enabled? Ping
the server and if not avail and if we have Mac then send wol?
On Aug 18, 2012 11:17 AM, "Michal Piechowiak" notifications@github.com
wrote:

now I wonder if single toggle in add/edit source is good idea given that
we can add source that could contain multiple paths: f.e. smb://host1/share
and smb://host2/another_share_from_different_server - that toggle would
need to be for each path there and this would be ugly


Reply to this email directly or view it on GitHubhttps://github.com/xbmc/xbmc/pull/1112#issuecomment-7838076.

Member

pieh commented Aug 17, 2012

Problem is we need to wait few secs after sending wol. There are scenarios where sending wol it's not gonna get server up and waiting here is waste of time:

  • server could be wifi connected - WoL won't work
  • server might not support WoL (doubtful) or not have WoL enabled
Member

jmarshallnz commented Aug 18, 2012

Either way we can't ping the server so does it matter?
On Aug 18, 2012 11:59 AM, "Michal Piechowiak" notifications@github.com
wrote:

Problem is we need to wait few secs after sending wol. There are scenarios
where sending wol it's not gonna get server up and waiting here is waste of
time:

  • server could be wifi connected - WoL won't work

  • server might not support WoL (doubtful) or not have WoL enabled


    Reply to this email directly or view it on GitHubhttps://github.com/xbmc/xbmc/pull/1112#issuecomment-7839458.

Member

kricker commented Aug 18, 2012

FYI, I have recently seen wireless NICs that do have WOL, but your point is still valid.

I'm happy to see movement on this.

Member

pieh commented Aug 18, 2012

Either way we can't ping the server so does it matter?

It's senseless to try to wake up server and wait couple of seconds for server that user know for sure that it can't be woken up. Ping doesn't matter here as server will not go online anyway and we will just wait (with busy dialog spinning) for few secs before "wait for server to wake up" time passes.

Member

jmarshallnz commented Aug 18, 2012

I don't see the problem. If the server is unreachable, we have the Mac, yet
it can't respond to a wol then who cares if we have to wait a few seconds?
Not as if you're going to be able to do anything else with the offline
server.
On Aug 18, 2012 12:39 PM, "Michal Piechowiak" notifications@github.com
wrote:

Either way we can't ping the server so does it matter?
It's senseless to try to wake up server and wait couple of seconds for
server that user know for sure that it can't be woken up. Ping doesn't
matter here as server will not go online anyway and we will just wait (with
busy dialog spinning) for few secs before "wait for server to wake up" time
passes.


Reply to this email directly or view it on GitHubhttps://github.com/xbmc/xbmc/pull/1112#issuecomment-7840252.

Member

pieh commented Aug 18, 2012

As a user I would prefer not to wait and just get quickest "can't connect" message possible. I actually didn't think of it as "not a problem" situation. This makes things so much easier.

Member

jmarshallnz commented Aug 18, 2012

Well one presumes that maybe we could intelligently guess based on past
experience if we never manage to wol a particular server
On Aug 18, 2012 1:10 PM, "Michal Piechowiak" notifications@github.com
wrote:

As a user I would prefer not to wait and just get quickest "can't connect"
message possible. I actually didn't think of it as "not a problem"
situation. This makes things so much easier.


Reply to this email directly or view it on GitHubhttps://github.com/xbmc/xbmc/pull/1112#issuecomment-7840533.

Contributor

t-nelson commented Aug 18, 2012

Couldn't this be added as a plugin? I don't think a feature like this belongs in core at all. Add the hooks you need to core to do things pre-access of a share then handle all of your crazy advanced user config stuff from the plugin settings. We can already do things on start up, which is presumably where a mysql server would be woken. This way only users who actually care will be bothered by the settings and you can make the configuration as complicated as you want.

Member

kricker commented Aug 18, 2012

As far as I know, without this patch you can't wake a sleeping mySQL server when XBMC starts. That was one of the main reasons this patch was started. This should be in the core.

Contributor

davilla commented Aug 18, 2012

Not looked but does this patch have a sane fallback for the case of NOT being able to wake a sleeping mySQL server ?

Contributor

t4-ravenbird commented Aug 20, 2012

@pieh What is status now, do you know what direction to go in?

@davilla No. What could be done?

Member

pieh commented Aug 20, 2012

@t4-ravenbird
Nothing is set in stone - we can still throw and evaluate ideas.

Now I'm thinking about about global toggle to turn feature on/off + dialog with list of all hosts (sources + mysql if set) that each could be enabled/disabled. Wake on lan for all host would automaticly be enabled (if we managed to auto-discover mac). If after X tries we never managed to wake server up it would automaticly disable waking for given host (need to implement ping).

Timeouts and such could be finetunned by hand in wake_on_access.xml (if that's what we choose to store stuff).

Member

jmarshallnz commented Aug 20, 2012

I still don't get why we need all this setup stuff. Why overcomplicate
things? Most folk have a single server (if that). It can either be woken
or not and that's all there is to it. Just ping the server, if not
available, send the WOL packet, and if that fails after N seconds don't
bother trying again. User can reset by toggling the "Wake wired network
servers automatically" setting.

If the server is off, no-one will care if it takes 3 seconds (if the server
is off the usual smb:// lookup will take a lot longer than that anyway) to
check for WOL.

On Mon, Aug 20, 2012 at 9:50 PM, Michal Piechowiak <notifications@github.com

wrote:

@t4-ravenbird https://github.com/t4-ravenbird
Nothing is set in stone - we can still throw and evaluate ideas.

Now I'm thinking about about global toggle to turn feature on/off + dialog
with list of all hosts (sources + mysql if set) that each could be
enabled/disabled. Wake on lan for all host would automaticly be enabled (if
we managed to auto-discover mac). If after X tries we never managed to wake
server up it would automaticly disable waking for given host (need to
implement ping).

Timeouts and such could be finetunned by hand in wake_on_access.xml (if
that's what we choose to store stuff).


Reply to this email directly or view it on GitHubhttps://github.com/xbmc/xbmc/pull/1112#issuecomment-7864928.

Member

kricker commented Sep 4, 2012

Where are we on this? Have we stalled out?

Contributor

t4-ravenbird commented Sep 7, 2012

@pieh

You can use use WINDOW_DIALOG_PROGRESS with disabled progress bar instead of WINDOW_DIALOG_BUSY - it has slots for heading and 3 lines of text. Search code to see how to use it.

OK, I made some changes and now have a nicer feedback .. the progress bar now indicates what is going ..
I also found the 'CGUIDialogKaiToast' class and use it to show error notification (If WOL can not be sent - stopped by firewall etc)

Member

da-anda commented Sep 7, 2012

@jmarshallnz how do we define the "N" seconds to wait until abort? Server do have different startup times. My NAS f.e. takes up to 1 minute to boot up.

As for the GUI side when trying to wake a not yet available server, I'd like to see a dialog that tells me what's going on like "Please wait, trying to connect to remote host for playback" and most importantly has a button to cancel the process. This way we can circumvent the different startup timeouts and can just wait for a returning ping or timeout after rather high default max timeout (like 3 mins) that can be configured in as.xml.

@managing the WOL devices
How about a new section within settings. Like "shares" and let it have subsections to manage all the shares and important for this PR WOL devices.

Contributor

alcoheca commented Sep 7, 2012

I'd go for notifications rather than a busy wait dialog, the user should be able to do other things while the server is being woken up..

//begin rant
I totally agree that a new place in settings to manage 'auto discovered' shares - be they samba servers in WORKGROUP, UPnP, iTunes - should be the focus.

In this 'share management' area of settings, you could view all auto discovered shares and then choose to ignore particular ones, chose to have certain UPnP/iTunes/whatever libraries included in your libraries, chose which simple file servers are scanned to library etc etc. WOL could then be integrated properly into that new system rather than it being retrofitted onto what is already a confusing and pretty long winded way of adding a share.

The reason I'm mentioning this is once something is added, it's very hard to find the energy to replace working code... a lot of the code already exists, it just needs sticking it all in one place, with a better GUI.
//end rant

I'm likely to get round to doing this a part of the UPnP work - which also uses WOL, and has the notion of devices in low power states.

Member

pieh commented Sep 7, 2012

@t4-ravenbird
you might like to take a look at my wip branch (this is all stuff dumped into 1 commit): pieh/xbmc@61f1223 it includes mac auto-discover + pinging (windows only now)

Won't write much - here's preview of result http://www.youtube.com/watch?v=C2JB99mcPFM&feature=youtu.be
Added single toggle in settings, that when turned on would try to discover MAC of all hosts from shares + mysql.
MAC also would be discovered when we add/edit source. Rest is configured via wakeonlan.xml in userdata (it will auto-created/edited when we discover any MAC)

Contributor

t4-ravenbird commented Sep 7, 2012

@pieh Fabulous, looking great!
That is a complete refactoring so I guess it voids this PR
I love that you keep the option of manually tweaking it so it is usable on platforms with no ping and/or mac-discovery.

Member

kricker commented Sep 7, 2012

That is a pretty clean and simple approach. Bypassing the "there are too many GUI settings, it is a mess debate", would it seem more appropriate under the system\services section in the settings? If it had it's own section, then you can add in default netinittimeout, timeout, and wait parameters. And possibly whether to have notification or not.

This seems like a user friendly solution.

Member

da-anda commented Sep 30, 2012

bump - do we want this for Frodo now or not? @cptspiff

Member

kricker commented Sep 30, 2012

The newest patch t4-ravenbird created has not been supplied here as of yet. We were doing some additional testing. It is working quite well now. The issue that is not resolved yet is auto MAC discovery for platforms other than Windows.

@t4-ravenbird t4-ravenbird merged commit c2037d1 into xbmc:master Oct 23, 2012

tru added a commit to RasPlex/plex-home-theatre that referenced this pull request Apr 18, 2014

Merge pull request #1112 from RasPlex/PR-case
[FIX] casing fix for linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment