FireFly Media Server (formerly mt-daapd) › Firefly Media Server Forums › Firefly Media Server › General Discussion › adding Windows support for resume-from-standby › Reply To: adding Windows support for resume-from-standby
I’m doing some experiments with my Soundbridge M500, to create the ability to wake my music server via Wake-on-LAN. I have attained some preliminary success, but now have run into an issue which I think could be best handled via minor source code changes to Firefly.
The problem is this: if I wake my music server (Dell Dimension 4600C; XP service pack 2) manually by pressing the power button, it wakes up all the way and my iTunes and Firefly music servers both become “visible” from the Soundbridge. However, if I wake it by sending a Wake-on-LAN message, the monitor doesn’t turn on and the music servers are not yet visible on the Soundbridge. If at this point, for example, I manually click the mouse on the groggy music server, then it wakes up the rest of the way.
Some reading suggests that if Firefly subscribes to the Windows WM_POWERBROADCAST message (wParam PBT_APMRESUMESUSPEND), then it can wake up the rest of the way. See:
I still have to run some independent tests to confirm this idea. But can you tell me which portions of the (SVN) Firefly source code is Windows-specific, and would be a good place to add this functionality? Is there a true Windows event-loop somewhere?
Also, if there are any Windows giants out there, perhaps you can tell me whether you think my idea is misguided.
That’s all in w32-service.c or os-win32.c.
But I’ll warn you, services don’t have the same message pump that regular windowed apps have (DefWndProc). There is a way to subscribe to power messages from a service though… I think it’s when you register the service, you use RegisterServiceCtrlHandlerEx rather than RegisterServiceCtrlHandler, and you get different messages in your dispatch handler. Not sure, but I remember looking through that stuff before.
Anyway, that’s the place to start looking at, I think.
Make sure you are working from 1589, though, as current svn head doesn’t compile on win32. 🙁