I suppose it isn't easy switching a whole country over from old-fashioned analogue TV to the wondrous delights of multi-channel digital, but here in Britain it's hard to see how they could have made more of a pigs-ear of it. Not only is it taking five years, but they seem to be doing it as an unpredictable series of updates; each of which is just significant enough to be really annoying. It's as though they want people to switch over to cable or BSkyB.
For example, sometimes they move a few of the channels around without telling us so that I get an earful when Coronation Street doesn't get recorded. Or they reduce the power on one of the multiplexes for testing so that a random selection of channels turns into a series of static and pixelated scenes that only update every ten seconds. Then, occasionally, they change the channel name just enough so that the Media Center guide listings don't match and my wife misses Emmerdale.
OK, so they assure us that when we reach the magical "final switchover" date and they turn off the analogue signal the digital transmitter power will be increased ten-fold. Or maybe, as my aerial/dish man suggested, four-fold. He also suggested it probably won't make any difference to me due to my "fringe location", and I don't think he was talking about the result of my last haircut. I suppose it's a bit like when they assured us that paying into a pension scheme all your working life would provide for "a comfortable retirement".
Anyway, I finally reached the end of my terrestrial tether last month after re-tuning Media Center twice in a week and still only getting half of the usual channels; and decided to install a DVB-S satellite card instead. We already have a dish hanging off the side of the house (see I Need a Wii...) so the cost of the upgrade was reasonably minimal and worth experimental evaluation.
Unfortunately our Media Center is old enough to have only a PCI socket, not one of those groovy new PCI/e ones, and there seems to be only one dual-tuner satellite card around now (the Pinnacle PcTv 4000i) that doesn't need the "/e" thing. But after I upgraded the Media Center from Vista to Windows 7 and slotted in the new satellite card it found drivers on Windows Update and all seemed to be hunky dory. It "just worked" and now we have over 300 channels of garbage instead of the forty-something that (on a good day) our terrestrial digital antenna and DVB-T card could find. Amazing. And Media Center in Windows 7 is really easy to set up compared to Vista, detecting the correct satellite and channels automatically.
It could well be that my computer is partly to blame - like me it's no Spring chicken and might not be equipped with all the current bells and whistles necessary to fully support suspend mode for complex drivers and multimedia subsystems. Installing the latest version of the PcTv TV card drivers did minimize the occurrence of the problem, so obviously Pinnacle recognized the issue and made efforts to fix it (just a shame they didn't put the latest drivers on Windows Update).
However, determined to finally resolve this issue, I followed the various forum threads and blog posts describing different solutions. In the end, I decided that a custom solution was the only way round the problem and set to creating the necessary bits of code. And discovered just how awkward coping with recalcitrant devices and suspend modes can be...
You can restart a device using Microsoft's DevCon utility, and there are utilities available on the web that can execute scripts and programs when the computer sleeps, hibernates, and wakes up. Batch files can stop and start the required applications and services so that the device can properly reset. However, you need to run DevCon and stop/start the services under the context of an administrative account, whereas - if you follow good practice and run under a standard user account - you have to restart the Media Center shell under the context of the current user (or else you can't see it!). So you have a problem of how to switch execution context for the different operations.
After much experimentation, I combined several of the techniques described to create a utility that does the job. I created a Windows Service that runs under the LOCALSYSTEM account, detects suspend and resume events, and runs scripts when they occur. It also writes messages to the Application Event Log when the events are detected. The service uses a configuration file to specify the scripts/programs to execute and the maximum timeout. It also has a "debug" mode that outputs additional information.
The trick is to allow the scripts that run under the system account to do the stuff that requires administrative privileges; such as stopping and starting the Media Center scheduler and receiver services, and restarting the device and its drivers. The service write an event with ID=4 when it has finished executing the "resume" script, so you can create a task in Task Scheduler that is triggered when this event is added to the Application Event Log. The task is configured to run as a specific user (in the case of our Media Center, my wife's domain account) and it executes another batch file that uses the start command to start the Media Center shell maximized.
So the sequence of events is:
You can download the service as a Visual Studio 2010 project and as a compiled assembly, together with the scripts and other files, if you want to try this on your own system.
The main problem with all this background activity is that the resume operations take anything between ten and twenty seconds to complete, and if you "Green Button" to manually start the Media Center Shell too early it may not detect the tuners if the Receiver service is not fully started. So now I use a desktop background that has a large "Please wait" message to warn impatient people with itchy fingers who think computers should work just like other domestic appliances. And you probably want to consider turning the attached sound system off when you're not watching anything or you'll be serenaded by the charmingly ethereal Media Center start-up tune when it decides to wake up in the middle of the night to record some seriously bad 1960's SciFi movie.
All in all, it seems a lot of effort to get round a glitch in a combination of software, hardware, drivers, BIOS, and operating system that doesn't always behave as it should. Though a regular recycling of the scheduler and receiver services and the TV card drivers doesn't seem like a bad idea. According to many blogs, that's pretty much what the optional "Daily Optimize" feature in Media Center does anyway.
Of course, the extremely non-typical sense of smug satisfaction resulting from having resolved any issue even remotely connected to computers was soon dissipated. Just nine days after finally completing coding, debugging and testing my solution to ensure it was performing perfectly, the BBC effectively did the "/e" thing by moving all it's HD channels from DVB-S to DVB-S2. Which my satellite card can't receive.
I wonder if I can make a pair of external USB satellite receivers work with Media Center....?