Playing the arp

I thought it would be interesting to have a small linux VM running on the ION HTPC. Nothing heavy, just an SSH server. I installed VMWare player from my 7.1 VMWare Workstation install and copied across my linux VM.

It booted but there was a bizarre networking problem. I could ping from the guest (VM) to other machines on my network except its host, for which it would report destination unreachable. The host could ping it and I discovered that after the host pinged the guest, the guest could ping the host, for a while. Then it became “unreachable” again. It wasn’t a host firewall problem.

The same VM was fine on my main PC, both setups were using a bridged network. The only difference was that the ION is using a wireless network.

Some searching found this very useful thread:
http://communities.vmware.com/thread/211266

It turns out that the guest is having problems finding routing information at the ethernet level. It does not know how to reach the host which is sharing the same network adapter. The guest sends out an arp request but the response it gets has the IP address of the host, probably related to them being bridged on the same device on a wireless network.

The solution is simple, in rc.local add an ‘arp’ command to create an association between the host’s IP address and its adapter MAC.

This worked for me:
arp -s xxx.xxx.xxx.xxx yy:yy:yy:yy:yy:yy
where xxx.xxx.xxx.xxx is the IP address of the host and yy:yy:yy:yy:yy:yy is the MAC address of the host.

Interestingly, if I used the MAC address of the guest, it also worked! Not surprising since host and guest are bridged. But pings were about 150us quicker if I used the host MAC address.

Speaking of speed, given the ION is no speed demon and has no hardware VM support, the VM is not exactly fast. It feels like the speed I used to get with VMs on a PIII; good enough for lightweight linux stuff and data rates < 2MB/second.

ION PC Update

The ION 330 HTPC I put together at the beginning of the year is going quite well. Here are some follow up items of interest on it.

Remote Control

I had a DVICO IR receiver that had come with one of my previous HTPC’s tuner cards. I found that the open source software EventGhost works quite well with it.

For my remote to be reliable I found it best to run the HID plugin for the DVICO receiver in raw mode, and only used “initial button press” events.

NVIDIA ION driver leak

I was bemused to find a process was using over 50000 handles after only a few days uptime! It ended up being an NVIDIA component used for stereoscopic 3D display, nvSCPAPISvr.exe. This page has a good tear down of the problem. Its probably fixed but I just set the “NVIDIA Stereoscopic 3D Driver Service” to “Manual” start, what a waste running something so specialised on every install.

HDMI

I initially connected the ION to my tele using VGA and a separate audio cable. I upgraded to a HDMI cable and its worked great for both sound and picture. There is a slight delay in audio starting so short sounds in explorer get missed but this isn’t a problem at all once in ZoomPlayer.

WebScheduler and Windows 7 x64

Having achieved good video playback on my new ION 330 HTPC, the next step was to get WebScheduler running. Being a 32 bit app that had to work with 64 bit BDA drivers for the TV tuner cards, I was concerned about it all working properly.

I started with WebScheduler 4.0.14, the last “free” version before it had gone commercial a few years back. This version has served me well under XP32. It installed without a hitch and ran fine, the only glitch I noticed was that the taskbar icon didn’t reflect when WebScheduler was recording.

It recorded files fine and I left it running about a week while I worked on other stuff. It wasn’t until the weekend that I discovered that the recordings it had made were unplayable!

I determined the recordings were not total trash, just Haali Media Splitter didn’t want to know about them. Using the Gabest splitter or ProjectX to demux them both worked.

So it seemed something was different between the files recorded under XP32 and Win7 x64, both done with the same version of WebScheduler and the kWorld USB Dual DTV Tuner stick capture hardware.

Having determined I was on the latest driver for the KWorld tuner, I was resigned to having to try Win7 x86, but before I did, I thought I’d try the latest version of WebScheduler as it had become open source again. Its now known as TV Scheduler Pro, by Blue Bit Software.

To my total delight, the recordings came good. I was able to export and reimport my schedule match lists between the 2 versions, which happily co-existed on the same machine for a while while I transitioned. The new version has some nice new features and I’m glad its recording properly under the new operating system.

So now recording and playback is in place on the new HTPC.

ASRock ION 330: My new HTPC

Its over 4 years since I built the HTPC to record and watch DTV and given it was P4 based, an upgrade was well overdue. I bought an ASRock ION 330 to serve as a replacement. As if it knew, within a few days of acquiring the ION, the 300GB WD HDD on the old HTPC started reporting CRC errors.

I decided to go with a low power solution rather than eusing the nice Accent HT400 HTPC case (and its iMon remote control), mainly because power saving is a bit of an issue now. This meant buying a new DTV TV tuner solution. I went with the KWorld Dual DVB USB tuner. It is based on the ITETech AF9015 and even comes with a worthless remote control that looks like a calculator.

I was already forewarned that the application software (tvMe) that come with the KWorld (a version 1.0) was bad, but I had to install it on a test system just to see how unbelievably bad it was. It needed dotNET – this should have been a warning. The software looked like someone’s second programming attempt, you know the program you write after “Hello World”. It was badly broken but did indicate the tuner was working. The software stayed installed only long enough for me to notice that the tray icon it installed had the tool tip “My App”. Hello World indeed.

All I wanted from the KWorld TV stick was a functional BDA driver, and after a few days running under XP32 with WebScheduler 4.0.14 I was convinced it would be a viable DTV device (actually, a pair of them since its dual tuner).

Next it was time to setup the ION. I’d bought 4GB of RAM for it so I thought I’d give Windows 7 x64 a go. Whilst XP would have suited my needs, I thought the EVR rendering in Windows 7 would be useful.

The Atom 330 which powers the ION is not exactly a powerhouse but having the NVidia ION able to accellerate video rendering is what makes the ION 330 a winner for HTPC purposes.

My favorite video player after all these years is still ZoomPlayer so the next step was establishing how well a 32 bit app with all its 32 bit codecs would work under Window 7 x64. It turns out that ZoomPlayer 7 works fabulously, but now time came to get the codecs set up right.

Firstly, MPEG2 TS playback. I’ve yet to top the combination of Haali Media Splitter and DScalar for playback of raw TV recordings (TS files). It gives me silky smooth playback of off the air interlaced TV. Other splitters/decoders work but either have laggy response to fast forward/rewind, horrible seeking delays or bad video quality especially for motion. I dont think DScaler is doing acceleration, but it copes with hi-def MPEG2 at about 30% CPU utilisation.

Next was testing some H264 1080P trailers. FFDshow woeked but was maxing out all 4 “processors” on the Atom 330 (its actually two cores each with hyperthreading). So it was time to choose an accelerated video decoder. Supposedly Win7 provides one but the video decoder from the Media Player Classic Home Cinema (MPC-HC) open source project trumps everything else out there for quality.

Downloading MPC-HC codecs, I was faced with the decision of 32 or 64 bit. Given my application is 32 bit but my operating system is 64, I wasn’t exactly sure what I wanted, but my guess of using the 32 bit codec paid off.

The process involved just the file MPCVideoDecoder.ax, put it somewhere and register it with “regsvr32”. This worked, once I learned the Win7 trick of opening an administrative console with ctrl-shift-enter when you type cmd into the search field.

Back in ZoomPlayer, in the Smart Play video decoder configuartion for “H264”, I had to select advanced editing and manually browse the list of codecs to select it. It comes up as MPCVideoDecoder. I selected the EVR renderer as well.

With this in place ZP plays 1080P H264 with 10% CPU utilisation, amazing.

Its worth noting, I’m looking at XBMC as well, either as the front end to ZP or standalone once video acceleration support becomes mainstream for the Windows version.

Drive letters under XP

It can be a nuisance transferring windows to a new HDD for a system when that windows has previously seen that drive as an external.

It boots OK but then has the wrong drive letter for the user profile so it can’t login, since Windows “knows” the drive by the letter it was last used as, not the default C:.

In this case I was updating a laptop with a bigger drive, which I’d previously used as an external USB drive for it.

In this past I’ve used a BartPE XP boot CD to get into it but in this case I got it to allow login by plugging in the original drive as the USB drive. It could now find its profile and let me in.

Then in regedit I removed everything in HKLM\System\MountedDevices (maybe best to just remove the \DosDevices only) then it booted fine from the internal drive.

JQS.exe – huge I/O counts

On my HTPC and work VM, I enabled monitoring I/O Reads and i/O Writes in task manager and noticed that a process ‘jqs.exe’ had something like 30GB against it after just a day of running!

This illuminated why:
http://forums.java.net/jive/thread.jspa?threadID=36505&tstart=-1
it keeps rereading some files to keep them in the system cache. What a hack!

Control panel – Java – Advanced – Miscellaneous has the checkbox to disable the quick starter.

Cant believe all these apps and their ‘quick starters’ that want to bog your system.

Don’t do it on the Desktop with Open Office

If you have Open Office 3.01 or 3.1 installed under XP32, try this:

  • Put a txt file on the desktop, eg test.txt
  • Run notepad and select file-open
  • Browse to the desktop. Hover over the TXT file to get a tooltip
  • Cancel the file open then select file-open again
  • Browse to desktop if needed, then hover over the TXT file again
  • Surprise! NOTEPAD disappears without a trace!

I spent the weekend tracing the source of this behaviour after it was noticed in Planimate®.  Thought it was a bad Windows Update or worse, pwnage. After a lot of hunting in lots of VMs, I traced the culprit: Open Office 3.

Looking closer, I found OOo installs a shell extension (probably to give context tips on its
own files) which is breaking the standard open file dialog for other apps.  You can uninstall it using the following procedure:

  • open CMD prompt
  • cd “\Program Files\OpenOffice.org 3\Basis\program\shlxthdl”
    (there should be shlxthdl.dll in there)
  • regsvr32 -u shlxthdl.dll
    (dialog should appear confirming deregistration of the extension)

The desktop should be safe to use again.

I’ve opened an issue with Open Office Org here:
http://www.openoffice.org/issues/show_bug.cgi?id=102757

ZoomPowr: Full screen zooming/inverting utility

In a past blog entry I briefly mentioned a full screen zoomer that I’d written to replace the hardware zoom I enjoyed when I had a Matrox card in my system a few years back.

After some email showing interest in it, I’ve cleaned it up and named it zoompowr (thanks for the name Dave). It now has global hotkey support and lives in the system tray rather than launching “on demand” from a shortcut key.

Its very easy to use. CTRL-ALT-Z cycles the zoom level and CTRL-ALT-A toggles invert. I’ve set my Logitech MX400 mouse to send a CTRL-ALT-Z when I depress the scroll wheel. This then cycles between 3 zoom levels and no zoom. I’ve found that pressing “A” while holding the scroll wheel down is enough to toggle the invert.

How It Works

Whilst adding semi-transparent window support to Planimate® a few years back, I’d discovered that windows with the WS_EX_LAYERED style did not appear in software like VNC. It was like they were not there. This intrigued me.

It turns out that transparent windows are composited in a separate buffer to the desktop window and the two are then combined to the actual display hardware. I’d thought only Vista did that.

This got me thinking – what if I cover the desktop with an opaque window with the WS_EX_LAYERED style and then periodically blit from GetDesktopWindow() to my window.

The result was that I had a “real time” zoomer. A bit of code to track the mouse cursor (see below), set up hotkeys and alter the blit for invert was all that was needed to whip up a zooming app.

The technique does have a few drawbacks:

  • Applications which use transparent windows (or set the WS_EX_LAYERED flag for no good reason…) wont appear when zooming/inverting.
  • Popup menus appear briefly “real size” before they get zoomed. I have my zoomer continually resetting itself as the foreground window but as popup menus are drawn in the foreground, they briefly flicker when popping up.
  • Task bar tool tips don’t get zoomed (probably the OS transparency for them).
  • This technique isn’t supported by Win2K.
  • I’ve set a slow update rate of about 10 frames/second to avoid hogging the CPU – not suitable for games.
  • This does not zoom the overlay buffer used for video playback.

Most of these issues are mitigated for me given all I do on the host is run virtual machines. All the contents of the VM windows then zoom perfectly, even full screen console windows.

To avoid mouse cursor complexities, I set up the zooming so the zoomed region is positioned such as the mouse cursor is in the same screen position at any zoom level. The co-ordinate math for this ended up being easier than I expected and it means you can change zoom levels without the mouse “jumping” or losing its relative position to the content it has been positioned over.

An interesting issue I had with it was a flicker when the WS_EX_LAYERED flag was first applied. This would create a single frame of junk due to the offscreen buffer for the window being in an indeterminate state. I fixed this by setting the window transparency to 0 (fully transparent) for the first “frame” before setting WS_EX_LAYERED for the window, then setting its transparency to 255 (opaque). This made transitioning from non zoomed to zoomed modes flickerless.

I turn off the layering if there is no zoom or invert so the zoomer has negligble system impact when sitting idle. I’ve had experience with other apps that turn on layering even if they are not using transparency at the time. This is very frustrating as it wastes a lot of CPU and video bus time. This is not good if the application is doing something realtime … say VOIP.

I’ve placed a copy of my app here if you want to try it. Please note that this is freeware and I take no responsibility for what this app might do on your system. Take usual precautions when downloading applications from the internet.

Laptop With Virtual Issues

My 5 year old Tecra M2’s hinge gave out rendering it useless for travel and meetings so I started sourcing a new laptop.

I was surprised how complex buying a laptop can be these days, companies like Toshiba have dozens of models with minor differences in CPU speed and feature set.

I finally settled on a 2GHz Satellite Pro A300 with 4GB RAM, 320GB HDD and 15.4″ 1280×800 widescreen. I would have preferred something physically smaller but the high resolutions and smaller screens just wont work for me and my vision.

All seemed nice; I duly wiped Vista and “downgraded” to the provided XP32. I know I’m wasting 1GB of RAM with a 32 bit OS but I plan to take it to Windows 7 64 bit which Toshiba had better support!

Running Steve Gibson’s securable revealed something nasty. The 7350 Core2Duo CPU doesn’t support hardware virtualisation. ARGH! Something I never thought to check for, having assumed any recent Intel chip would support it.

Performance wise it didn’t worry me much, VMWare’s binary translation works fantastically for me. But it meant I would not be running 64 bit VMs on it.

Without hardware virtualisation support, you cannot run a 64 bit VM on any host – 32 or 64 bit – with either VMWare or VirtualBox.

The binary emulation layers simply haven’t been written for the 64 bit opcodes, not with the availability of hardware virtualisation on most modern CPUs. Except mine.

Fortunately I don’t need to do much in 64 bit apart from test 64 bit builds of Planimate®. I can compile them from a 32bit OS at least. I had partitioned the drive so I had a handy alternate OS partition. I did a test-install of XP64 on it and it works fine. So… if I’m on the road and really need a 64 bit OS, I have one available though none of the Toshiba tools will run under it.

Apart from that and the weight of the 15.4″ screen (and the chunky power supply) I’m happy with the laptop. It was well priced so I was able to get a second screen and extended warranty for it.

Seagate update

Seagate got their act together and released new firmware for their drives. They even replied to my email. I applied it to both my 500GB drives. Both went OK but the original fault in one of my drives remains – bad blocks, chattering sounds even when its idle.

I ran SpinRite on level 5 (reclaim lost sectors) over it for a few hours. Then I restarted SpinRite to test how it had gone… the bad sectors were still there. So the drive is toast and worse still, its S.M.A.R.T reports the drive is imminent to fail.

I don’t know if I’ll bother returning it. I dont really want another Seagate! As for the other drive, I’m going to be testing it regularly and watching it very carefully.

[EDIT April 2009].

I’ve been following the Seagate forum discussion on my ST500320AS drives. One of mine is still working and the other is useless with bad sectors. Kind of given up on it being resolved by newer firmware but I might get around to returning the drive, hopefully at a time in the future when they’ll find it easier to replace it with an SSD 🙂 (wishful thinking).