Sunday, December 25, 2005

The Ball: A Bluetooth Trackball by Chwang Yi

This is a mini-review of a piece of niche equipment: The Ball Bluetooth trackball.

I'm a trackball user. My second computer was a PowerBook 100, the slow, brittle, lightweight, brilliant, quantum leap of a computer PowerBook 100 with its large trackball, not the grape sized trackball trackball of the Duo, but the big as an owl's eyeball trackball of the 100. In the interest of space, modern PowerBooks have trackpads, which are fine and precise, but I still like trackballs.

My favored trackball, probably because I'm used to it, is the Logitech Trackman series. I'm quite adept at using a TrackMan, I can hold it in mid-air with my pinky and thumb and still scroll through a webpage with the scroll wheel, or push it against the top of my back with my hands behind my neck as I lean back and read source code. Basically, what I like about trackballs is how they free me from my desk.

And in terms of freeing me from my desk, I'd like to occasionally browse the Internet from my couch using my HDTV as a monitor. Actually, the TrackMan has a long enough USB cable I could do so, while risking tripping my wife; I want a wireless solution. Something to take advantage of the Bluetooth module in my PowerBook. And so every few months I would google "bluetooth trackball" and it would always be the same: people asking for this product and no companies creating one. And, the vaporous promise and picture of something called "The Ball" which always seemed two months from release. Company problems, you see, and no knowing if things would get straightened out and the product shipped.

And then one day, I was surfing MacSurfer and what should I come across but an AppleLink Review of "The Ball" by Chwang Yi. There was now an actual product you could order, so I did.

The Ball

The charging station is a small USB powered device, which is convenient if you have an available powered USB port, on a hub for example, and inconvenient if you don't. Just plop The Ball onto the charger and wait for the flashing blue light on the charger to go from flashing to constant.

After pairing with my PowerBook, it worked fairly reliably, easily useable from the couch. I did have to turn my mouse tracking speed down to the middle setting as the cursor movement was just too fast, and I kept overshooting my targets. Unfortunately, at this low speed it's hard to throw the cursor at the menu bar as Mac users are wont. Experience with the Trackman does not help with this device. The Trackman is a thumb wheel device, The Ball is an index or middle finger device. I can use the scroll wheel in mid-air, but little else, The Ball likes flat surfaces, so my thigh or tummy are OK, but behind my head is a bit cumbersome. And it will take a while getting used to click dragging, if I ever do. The Ball uses the Apple style zero buttons approach: you move the entire upper shell to click left or right virtual buttons.

I really like the feel of the scroll wheel solid and quiet.

The Ball goes to sleep after a few minutes, so get used to clicking it awake or you'll be wondering why the cursor won't move.

I wish The Ball had Mighty Mouse style side buttons to bring up Expose.

I've dropped The Ball several time with no ill affect. Once the ball popped out, but it popped right back in. It seems tough enough.

In conclusion, I think The Ball a decent product. If your Mac Mini is attached to a big screen TV, and your butt is attached to a couch, this might be your tool to browse the web in comfort. Just be ready to go through a few days of miss-selected menus and overshot links; as with most pointing devices, it takes some acclimating.

Update: Well I did pair it with my HDTV-attached Fedora Core 4 Linux box, at least temporarily as the pairing is lost when the trackball goes into low power mode. And it, is sort of relaxing sitting in my easy chair and browsing the Internet with just three fingers of my right hand. I did set the font size quite high, and I'm only 7 feet from my 26" screen, but it is certainly doable for the most passive mode of browsing. I'll figure out how to get a longer term pairing later.

Update 2: I've been using The Ball in my home office for general computer use: browsing the web, editing source, etc, and I've mostly gotten the hang of using it. The nicest part is the scroll wheel, very convenient for scrolling through web pages or source while leaning back in my chair. I believe the Logitech mechanism is superior in terms of accuracy and range of mouse speed; the unique dot pattern on Logitech balls gives stability, speed and accuracy, with no problem throwing the mouse at the menu bar with a sharp swipe of the thumb. You can't move the mouse cursor with The Ball both fast and accurately.

But I do like having the freedom of position The Ball gives me, and it is smaller. So, I'll keep this on my desk and be fairly happy.

Friday, November 25, 2005

Airport Extreme Base Station Fails (Bad Power Supply)

My three year old Airport Extreme Base Station stopped working last week. It was dead with no blinking lights. My first impulse was to tear it open and see if there was a loose power connector, but after getting the bottom off, I saw difficulty in disassembling it further. Luckily, it occurred to me to attach my multi-meter to the station's power supply, and eureka, no voltage. The external power supply had failed not the hub itself.

Looking around the web, it seems most places are out of of stock for the AirPort Extreme Base Station Power Adapter (Part number M9479LL). Perhaps many are failing right now. But the Apple online store has it in stock, so I ordered one for $20 and problem solved.

Wednesday, November 23, 2005

DVI and the Syntax 26" LT26HVX HDTV

I am not quite sure why HDTV manufacturers put DVI inputs in their sets if they insist on doing it in the most useless way possible, and with no particular advantage over the picture from high quality component inputs. A case in point is my Syntax LT26HVX. And I'm not saying that Syntax is any worse in this regard then any other manufacturer, a search of the AVS Forum will convince anyone that DVI is not used optimally on HDTVs, be they from Sharp, LQ, Syntax or whomever.

You would think companies would realize that there is a market out there for people who want to connect a MacMini up to their huge TV, do a little light web browsing from the couch, watch a DVD, watch their photo slideshows, maybe even hook up an EyeTV 500 and watch some recorded HDTV. These are people who are used to connecting up a DVI cable to their comptuter and have it "just work," not people who will download DisplayConfigX and play around with the horizontal back porch.

And yet, here we have a TV whose native resolution is a useless (not divisible by 8) 1366x768 pixels, and whose DVI EDID block apparently claims its resolution is 1280x768. There is no way we can blame Apple, NVidia or ATI for not working out of the box with such a device.

Anyway, I was curious as to whether I could get this monitor to work with the DVI output of my PowerBook G4 (NVidia Go5200 chipset), and so I downloaded DisplayConfigX, paid Harald his $12, and started playing around. I finally got a set of parameters which look OK, even if the picture is hiding maybe 10 pixels on the right hand edge. And I have to boot the computer first before plugging in the monitor or everybody gets confused.

So here are my DisplayConfigX settings. Use at your own risk, knowing that I don't know what these really mean. [Update: I don't think this looks very good. If you set up this monitor better, please e-mail me the improved settings.] [Update 2: I would say this looks pretty darn awful, so I'm removing these settings.]

I should also say that I have very few complaints about the LT26HVX as a TV, or as a VGA monitor with my MythTV setup (after going through all the trouble to get it just so.). Hi-Def input from either VGA or component inputs looks great. I do complain about the remote setup. I wish that all devices had a dedicated on, and a dedicated off command so my Harmony 520 infrared remote wouldn't turn it off when it was already on. And it would be nice if the TV had dedicated remote codes for each of its inputs, again so the Harmony wouldn't have to go though the fragile process of keeping track of the current input.

[Update 3: From this thread on lcd-tv-reviews, I learn that older Syntax models can be fooled into behaving sort of correctly by setting the aspect ratio menu item to 4:3. Unfortunately, the LT26HVX and other newer models do not let you change the aspect ratio of DVI content. Thus, you cannot turn off the scaler, and DVI signals from a PC will always look lousy.]

Wednesday, November 09, 2005

xorg.conf file for Dual Headed Linux With NVIDIA FX5200

I recently purchased a Syntax 26" LT26HVX HDTV for use as my main TV viewing monitor. I bought the Syntax for its good performance, low price, and good variety of input connectors. Right now I have it hooked up via VGA to my MythTV PC, s-video to my TiVo, s-video to my DVD player, co-axial to my regular analog TV, and I will be connecting a digital Comcast box to either the DVI port, or one of the component inputs.

It was troublesome, to say the least, getting the TV hooked up to my MythTV PC's video card (a Chaintech Geforce FX5200 AGPx4). First, its resolution is an odd 1366x768, which my NVIDIA driver does not like (1366 is not an even multiple of 8), and apparently the DVI connection is reporting the wrong maximum resolution, so I ended up attaching the VGA output of my video card to the TV and the DVI output to my Dell 2005FPW (1680x1050) LCD monitor; which is fine. And I ended up driving the TV at 1360x768, which is fine: I'm not going to scream about 6 pixels, and it really does look great.

Then there were the complications of getting two screens at once. And once everything was working, there was the realization that the system was not up to the task of displaying full screen video on the TV while doing anything, and I do mean anything, on the Dell. I may have to spring for a sprightlier video card. I had gotten the FX5200 because it was fanless and could handle my original single-headed system.

Regardless, it was quite a bit of work getting it to work, so I'm sharing my /etc/X11/xorg.conf file which works on my system (Fedora Core 4), and may be helpful to you. This all presupposes that you have a working NVIDIA driver installed (which is another big can of worms).

# Xorg configuration created by system-config-display

Section "ServerLayout"
Identifier "dual head configuration"
Screen 0 "Screen0" RightOf "Screen1"
Screen 1 "Screen1" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse1" "CorePointer"

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules/extensions/nvidia"
ModulePath "/usr/X11R6/lib/modules/extensions"
ModulePath "/usr/X11R6/lib/modules"
FontPath "unix/:7100"

Section "Module"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "glx"
Load "record"
Load "freetype"
Load "type1"
Load "v4l"
Load "dri"

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "yes"

Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Device" "/dev/lircm"
Option "Protocol" "IMPS/2"
Option "SendCoreEvents"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"

Section "Modes"

# 1680x1050 @ 60 Hz
# Horizontal pixels
# Front porch: 104 Back porch: 280 Sync width: 176
# Sync polarity: - Scan rate: 65.29kHz Active pixels: 1680
# Vertical lines:
# Front porch: 3 Back porch: 30 Sync width: 6
# Sync polarity + Refresh rate 59.954Hz Active pixels: 1050
# Pixel clock: 146.25MHz
# Pixel clock digital: 119 MHz
Identifier "16:10"
Modeline "digital:1680x1050@60" 119.0 1680 1728 1760 1840 1050 1053 1059 1080 -hsync +vsync
Modeline "1680x1050@60" 154.20 1680 1712 2296 2328 1050 1071 1081 1103
ModeLine "analog:1680x1050" 146.2 1680 1960 2136 2240 1050 1080 1086 1089 -hsync +vsync
Modeline "1360x768@60" 84.50 1360 1392 1712 1744 768 783 791 807

Section "Modes"
Identifier "HDTV"
Modeline "1360x768@60" 84.50 1360 1392 1712 1744 768 783 791 807

Section "Monitor"
Identifier "Monitor0"
VendorName "Dell"
ModelName "DELL 2005FPW"
UseModes "16:10"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 75.0
Option "dpms"
Option "XVideoBlitterSyncToVBlank" "0"
Option "XVideoTextureSyncToVBlank" "0"

Section "Monitor"
Identifier "Monitor1"
VendorName "Syntax"
ModelName "Olevia 26 HVX"
UseModes "HDTV"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 75.0
Option "dpms"
Option "XVideoBlitterSyncToVBlank" "0"
Option "XVideoTextureSyncToVBlank" "0"


Section "Device"
Identifier "Videocard0"
Driver "nvidia"
Option "ConnectedMonitor" "DLP"
VendorName "Videocard vendor"
Option "ExactModeTimingsDVI" "True"
BoardName "NVIDIA GeForce FX (generic)"
BusID "PCI:1:0:0"
Option "ConnectedMonitor" "DFP, CRT"
Option "IgnoreEDID" "1"
Screen 0

Section "Device"
Identifier "Videocard1"
Driver "nvidia"
VendorName "Videocard vendor"
BusID "PCI:1:0:0"
Option "ConnectedMonitor" "DFP, CRT"
BoardName "NVIDIA GeForce FX (generic)"
Option "ConnectedMonitor" "CRT"
Option "IgnoreEDID" "1"
Screen 1

Section "Screen"
Identifier "Screen1"
Device "Videocard1"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 16
Modes "digital:1680x1050@60" "1280x768" "800x600" "640x480"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "digital:1680x1050@60" "1280x768" "1024x768" "800x600" "640x480"

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 16
Modes "1360x768@60" "800x600" "640x480"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1360x768@60" "1024x768" "800x600" "640x480"

Section "DRI"
Group 0
Mode 0666

Wednesday, October 19, 2005

Remote MythFrontend for Mac OS X

I have a policy of reporting on my blog the result of any research which took me some serious yahooing to discover. Here's one such entry.

On a whim, I tried the Myth Frontend for Mac OS X, and of course there was trouble from the start connecting to the backend running on my Linux Fedora Core 4 desktop machine.

First, you have to have mysql setup to allow remote usage. If you followed the Wilson Myth(TV)ology instructions, it will be almost there, but you have to give access to the other machines on your local network (which in my case has the assigned IP address pattern of 192.168.0.x, where x is between 1 and 15; your's might be different. So on the Linux box, you have to do the following:

$mysql -u root mythconverg -p

(enter password)

mysql>grant all on mythconverg.* to mythtv@"192.168.0.%" identified by "yourpassword";

mysql>flush privileges;


Then you have to make sure the firewall allows the three ports you need for this job. So again on Linux (KDE) open up the Security Level control panel from the System Settings menu, and add the following to the "Other ports" field:

mysql:tcp, 6543:tcp, 6544:tcp

Then I was able to run the mythfrontend for Mac OS X and discover my 1.33GHz Powerbook G4 is not up to the task of displaying the stream, it's worse than the EyeTV performance, which is actually viewable on the same hardware.

Oh, how I am looking forward to Intel based Mac Minis. I've got a little space here next to the monitor just for one.

Sunday, October 09, 2005

The Intel Transition

I spent Thursday and Friday at a workshop Apple put on to help developers transition their code onto Mac OS X for Intel. I won't get into the technical aspects of the workshop, as that was labled as confidential (although I have no idea why), but I would like to say that the Apple employees were great. They are comitted to the success of the transition, and know it is important to have plenty of native software available at first hardware launch. They were helpful, and never condescending in the face of ignorance. If you are a Mac developer, and get offered a chance to go to one of these events, go. It's a rare and immensely valuable experience.

Also, DTS engineers have some interesting side jobs.

Saturday, October 01, 2005

could not get file information for /dev/lirc

I ended up ruining my Mythtv setup and reinstalling from scratch. The Wilson Myth(TV)ology instructions have moved on to using Fedora Core 4. Frustration was around every corner, as little things were missing. For example, it wasn't mentioned that you had to download and install the firmware for the pcHDTV capture board.

But the longest running problem was getting my ATI Remote Wonder working again. The OS recognized the existence of the USB receiver, and it worked as a mouse, but everytime I tried running irw, irw would immediately quit, and in the process lockup the lircd daemon. If I looked in the log files, I would see the warning "could not get file information for /dev/lirc" and true enough, the only device for the lirc framework was the /dev/lircd interface, no lirc or lirc0 nodes as every online tutorial said there would be after the install.

I did a lot of googling, and finally found this posting on the MythTV website. Basically, it said, I couldn't use both the module which gave me mouse functionality (ati_remote), and the module which allowed lirc to read from the device (lirc_atiusb). Sure enough


said that both modules were loaded. I had to disable the ati_remote module, so I first found it:

#locate ati_remote

So, I went in and changed the name of the ati_remote.ko kernel extension to ati_remote_disabled, rebooted, and all of a sudden lirc could see the Remote Wonder.

Wednesday, September 14, 2005

Image Tricks - Free & Fun

This morning, I downloaded a cool application by BeLight Software called Image Tricks which leverages Cocoa and Core Image.

The Kaleidoscope effect amused me, and I used Snapz Pro to capture a movie while playing with the kaleidoscope count parameter.

Sunday, September 11, 2005

My ATI Remote Wonder Stopped Working

Just a quick note about a problem I had (and have partially fixed) with the ATI Remote Wonder I bought to control my MythTV using Fedora Core 3. I had initially installed it a couple weeks ago, and it worked as a mouse, and would send recognizable keystrokes to the irw utility, and I could create a .xmodmaprc to map the buttons to special keystrokes in the mythfronted application.

Then I rebooted and it stopped working entirely. No mouse. No keystrokes. No controlling MythTV.

I did a lot of web searching, and tried a lot of things. Then I found some mention of using the irrecord utility to create my own lircd.conf file. I already had such a file, which I downloaded from somewhere, but at least with irrecord, I can see if the device was doing anything at all. So:

#irrecord lircd_temp.conf

After going through the irrecord wizard, I compared the generated file with the one I had downloaded, I found that 1) the "gap" value was different, and 2) that all the key codes were off by one in the most significant hex digit, such that the OK button, for instance, was 0xF31E instead of 0xE31E. I edited my original /etc/lircd.conf file to use the appropriate gap, and updated key codes, and after restarting the lircd daemon, the remote started working with my ~/.mythtv/lircrc mapping file to allow me to control mythtv.

I still don't get mouse motion, mouse buttons or keystrokes out of the remote. So I assume there is some other configuration file somewhere which has the wrong key codes in it.

And I don't know why the codes changed, or whether they will do so again in the future, but I thought I'd let the universe know what I discovered.

Saturday, August 27, 2005

PVC Furniture

I'm enthusiastic about Make Magazine. It's always an interesting and inspiring read.

For example, a few weeks ago on the Make blog, there was mention of using PVC tubing to make furniture. As it happens, my mother-in-law had been pestering me for a small chair, of very specific dimensions, so she could sit and wash my son, or clean vegetables near the floor. Local stores had no chairs of the proper dimensions or stability for an adult, and in an off moment I told her I'd build her one. How I planned to do this was unclear, as I have no wood shaping tools. Thank goodness, I came across the blog entry, as I was able to make a seat to the precise dimensions my mother-in-law required.

PVC Stool

PVC pipe is fairly cheap: $0.50 per foot of 1¼" diameter tubing. It's the joints which add up; I paid $2.20 per joint at the "PVC Store" display at the hardware store, but I'm sure I could have gotten a much better price. I sawed each segment roughly (no precision required) and fit everything together by hand. Then I attached a surplus shelf from a DVD rack as a seat.

Presto, one made to order, sturdy, unique miniature chair. Thanks, Make Magazine.

Wednesday, August 24, 2005

MythTV - A User's Impression

After 3 weeks of weekends, I have a fairly functional MythTV box running. I jumped hurdle after hurdle: ungainly audio support, package managers, the pickiness of gcc 4.0, lack of support for Fedora Core 4, weak broadcast strength, out of spec cable data streams, uncooperative Comcast, odd video defects, and unwanted clipping. And now, I can watch and record beautiful high definition television, with crystal clear digital sound, all added at a cost of perhaps $275 to my existing desktop system.

I'm in a position to give informed opinions.

My time is not valueless; I want a working system. I appreciate the educational value of learning the ins and outs of Linux audio mixing, mysql database maintenance, parameters to chmod, but the amount of effort I was looking for was around the level of: insert tuner card, attach cables, insert CD, type in ZIP code, watch TV; not install Linux twice, scour the web for the contents of a .asoundrc file for a Chaintech AV710 sound card, spend two hours trying to figure out why the scan channels button is disabled, etc. Basically, all I want to do is watch some TV. I've a TiVo. It's based on Linux and similar to MythTV (minus the Hi-Def); it just works. My son will be using it before he's three. MythTV has to get to that point before I like it.

I have an El Gato EyeTV 500 HDTV tuner box for my Mac. It just works, or it would work if my computer was up to the task of decoding 1080i signals. It auto-tuned all my channels and displays them without distortion: even PBS-HD. It's text overlay is flicker free and beautiful. It's a Mac product, and acts as Mac users expect. When a channel is unavailable, it displays "No Signal"; it doesn't lockup for 20 seconds and not allow me to change channels.

From a commercial developer's point of view, I think there is a lot right and a lot wrong with the whole MythTV project. It is immature to waste time on such features as theme's. Choose an appearance, optimize the heck out of it, and live with it. Do not waste a minute of precious development time working out some lame bitmapped based system of pluginable skins. Figure out the core needs of the product, and focus on those. For instance, getting the auto-tuner to handle out of spec QAM streams. Also, what's the deal with having separate modes for watching live TV, and watching recordings? If I want to watch something being recorded right now, I shouldn't have to go one level up and three levels down from the live TV panel. Or how am I supposed to change the channel if something is wrong with the default channel? Do you really mean, I have to quit the frontend, quit the backend, and re-run the setup application because my default station isn't broadcasting? Watching TV is the core functionality of the application, get that right first.

To be fair, it is free. The images and sound, when they work at all, are fantastic. Once you do have it setup it's serviceable. If you are a cheap techno-geek with time on his hands, it's a gratifying project.

Thursday, August 11, 2005

NVidia versus 2005FPW in MythTV

I've been consumed the last few weeks with trying to get a working HD PVR working in my Dell desktop. I haven't been posting on this subject, because I think it's pretty well covered elsewhere on the web, and I am too confused much of the time to give coherent advise to anyone. However, I came across a problem which others might be beating themselves up on.

My PVR is composed of a Dell Dimension with a 2 GHz Pentium 4, a pcHDTV-3000 tuner card, an NVidia GeForce FX 5200 video card, and a Chaintech AV710 audio card. I'm using DVI to output to my desktop monitor, a Dell 20" widescreen 2005FPW with a native resolution of 1680x1050. I'm using Fedora Core 3 Linux (Core 4 is out but not well supported by all the other things you want to install, believe me, I've tried). I've installed NVidia's native Linux drivers.

Anyway, the unusual problem is whenever I want to display HD content from my local PBS HD station, which I think is in the 1080i format, it is distorted in a funny way. Every centimeter or so, there is a a wavelike distortion, like someone dragged their fingers through cake frosting. It's horrible.

I did some Yahoo searching. By the way, Yahoo is much more likely to find all the web pages you are interested in than Google. And it turns out someone else was having the exact same problem, and he had tracked it down to the 1680x1050 resolution that MythTV was trying to display content at. Practically any other resolution would be fine, but not 1680x1050. If I go into the MythTV setup, and I tell the GUI to use 1648x1050 with a 16 pixel X inset, it will play without distortion and look beautiful, although there will be these 16 pixel bands on either side of the MythTV where the Linux desktop shows through. I believe the problem must lie with the drivers, something with how they handle de-interlacing and scaling.

I'm still not finished. The audio over SPDIF from the AV710 card stutters horribly, and is not in the proper format for my receiver. It looks like the player is having to slow itself down to try to convert the audio, so everything is in slow motion. I thought the audio was in AC3 format, so it shouldn't convert at all. So I've been up to my ears in .asoundrc files, and getting alsamixer just so, I'm sure I will try this and that, and think of new searches and someday it will just work, and I'll be able to watch some live TV, and it will be very satisfying, but until then it's pure frustration.

Update: I can get full 1680x1050 video display if I use the VGA connector instead of the DVI. I don't know how much quality is lost when using the analog connector, especially with possibly annoying flicker.

Tuesday, July 26, 2005

"Why is the fan so loud on my PowerBook?"

I asked myself that a few seconds ago. I'm in bed. My 12" Powerbook is on my chest, and the fan is on full blast. Which means its running hot. Which means it's doing something processor intensive. But what could that be? I'm just browsing the web. I'm not even listening to iTunes. There is no reason for this.

Luckily, as a developer, I've installed Apple's free development tools. (If you bought Mac OS X, they are on the separate CD) and I can run the "top" utility. So I launch the "Terminal" application, and type in:

top -o cpu

And what do I see, but that Sherlock is using up half my CPU doing nothing but pausing a movie trailer:

[Lefler:/System/Library/Extensions] glenn% top -o cpu

Processes: 79 total, 6 running, 73 sleeping... 280 threads 07:52:47
Load Avg: 1.81, 0.89, 1.07 CPU usage: 62.7% user, 37.3% sys, 0.0% idle
SharedLibs: num = 238, resident = 42.7M code, 4.61M data, 4.86M LinkEdit
MemRegions: num = 15609, resident = 457M + 12.0M private, 138M shared
PhysMem: 132M wired, 416M active, 318M inactive, 867M used, 285M free
VM: 7.38G + 151M 410626(15) pageins, 308443(0) pageouts

2637 Sherlock 41.4% 0:21.33 14 235 336 15.3M+ 17.5M 25.4M+
782 DashboardC 11.8% 4:20.41 4 105 210 5.97M+ 7.52M 12.1M+

What would a typical user do in this situation? How would they know which of dozens of applications is killing the performance of their expensive toy? I know enough to feel the symptoms and run top, but what would someone else do? It might not even be an application taking up all the cycles. The installer for my HP printer installs a background process which occasionally goes crazy and uses 60% of my cycles. It's inconceivable that the typical user would know how to make their computer speedy again. They would just have a poor experience with Mac OS X.

And what is wrong with Sherlock that it can't idle a QuickTime movie properly? QuickTime does all the work for you these days making efficient use of idle time. It's not like the old days when you set your sleep time to zero and gave QuickTime idle time every pass through your WaitNextEvent loop. QuickTime can now register its own Carbon Event timer. It's very nice. It practically writes itself.

[Update: The "Activity Monitor" application under Applications/Utilities is a more user friendly, and informative, way to find out what application is soaking up cycles.]

Saturday, July 16, 2005

Remote Desktop Setup

Another how-to posting.

Out of frustration with Windows and Wintel notebooks, my brother Joe bought an iBook. Unfortunately, he still needed a few pieces of critical Windows software, thus Virtual PC, thus Window's style kludge and instability ruining his otherwise decent Mac OS X experience. He's very close to giving up and getting another real Wintel notebook, but we are experimenting with the other way to add Windows functionality to a Mac: Microsoft Remote Desktop. As long as you have an IP connection, you can keep a cheap desktop PC anywhere in the world to run Windows software natively, without destabilizing your Mac.

Things Needed:

  • A PC running Windows XP Professional. Microsoft does not give this to XP Home users.

  • A router capable of both port mapping and Dynamic DNS.

I purchased a used Netgear RT314 router from a merchant on Amazon for $27 shipped. This is an older router, and quite big, but when updated to the 3.25 firmware version does everything I want.
Netgear RT314
I created a free account at and created a host name named (not the actual name).

I hooked up my network in the following topology, turned off DNS serving in my Airport Extreme hub, and relied on the RT314 to handle DNS.

I logged into the router through the web interface, and configured it for Dynamic DNS using my new account.
Dynamic DNS RT314Now the DynDNS servers will know the IP address Comcast has given my router, and the address maps to that IP address.

But of course, I don't usually want to talk with my router, I want to log into my PC using Remote Desktop. So I have to configure the router to route port 3389 traffic to my PC. So I configure that page under "Advanced" options on the router.
Port Mapping RT314
But what IP address, should I forward it to? My PC has a local IP address that the router assigned it, but the next time I turn it on, it might get another. I need to force the PC to always have the same IP address, so I have to configure my PC.

First, find my active network connection.

Second, click on the "Properties" button of Connection Status dialog.

Third, select the Internet Protocol (TCP/IP) item of the Local Area Connection dialog and hit the "Properties" button.

Fourth, enter an IP address high in the range of local addresses will distribute, as there are only 6 networked devices in my home, and the range starts at, I went with My router ( is also the default gateway and in charge of getting DNS information.

Make sure this fixed IP address is the one in your router's port mapping page.

If all went well, you will now be able to run the Remote Desktop Connection software and log into your PC from around the world, just by typing the address (or whatever you chose). There is, of course a version of Remote Desktop Connection for Windows, and it's installed by default on all XP boxes.

Anywhere in the world, but your own home, however, as you have to be upstream of your router in order to have this work. (Inside your home, you can use the address). Or your ISP might filter port 3389, or any number of things could go wrong, but if your PC is running XP Professional, it's pretty cheap to try, especially if you have mission critical software to run which doesn't require lightning fast screen redraws.

If you have a .Mac account, you can even use the iDisk Utility for Windows XP to provide a shared disk to ease transferring files from the remoted XP box to your Mac. Just drag a file onto the iDisk from the PC and drag it off onto your Mac.

Of course, having done this, I noticed a security advisory against Remote Desktop. So opening up that port in the router and enabling Remote Desktop access might be dangerous, especially given my brother's typical luck with computers.

Saturday, July 09, 2005

Adding Auxiliary Inputs for my iPod in my Civic

This doesn't have anything to do with programming, but it might be of use to Googlers.

I have a 2003 Honda Civic 4 door sedan, with a 5 speed manual transmission. It would be agreeable to listen to my iPod while commuting, or allow my wife to listen to movies playing on my PowerBook, through the built in speakers of the car. Of course, the factory original stereo has no auxiliary inputs, and I'd rather not tear out a perfectly good stereo to put in some ugly after market monstrosity. So a googling, I did go.

Logjam Electronics carries a variety of converter boxes which fool OEM stereo's into thinking they have trunk CD Changers, while in fact, they have auxiliary inputs. So I ordered a Blitzsafe for my Civic. Other manufacturers were available, but this one seems to have a good following, and doesn't have the ground loop noise problem (when charging the iPod) for which other units are known.

The Blitzsafe comes with female RCA jacks, and most people use converter cabling to add a ⅛th inch mini-jack to their dashboard, but I felt it would be more flexible to put a pair of RCA jacks on my console, and converting to mini-jacks in the cable from the console to my iPod or Powerbook. I went to Radio Shack and found a wall plate with 3 RCA jacks, the jacks themselves were female/female connectors and came threaded and with nuts. I'd just have to drill some holes, and use a male/male cable (of which I have many).

I was concerned with stability, so I decided to put a metal strip on the other side of the console to give support whilst pushing cables onto the connector. I took a PCI slot blank out of my Dell and chopped it to give a metal strip (perhaps 1¼ inches long) I drilled two ⅜th holes for the RCA jacks, and one 11/64th hole for a small bolt. I wish I had a drill press, as I managed to cut up my left index finger a bit when I spun the metal, and I found my cordless drill wasn't really up to the task, so I ended up reaming out the larger holes with a flat headed screw driver. But i did get my little bracket. I didn't take a photo, but it looked something like the following, the holes were just separated enough that I could get the nuts in without overlap if they were twisted just so.

Next, I had to figure out how to get to my stereo. Cheap Honda Parts has a variety of installation manuals, and I chose the one for installing a keyless entry system. At that time, I decided to kill two birds with one stone, and I ordered a keyless entry system to install at the same time.

Unfortunately, as I have a manual transmission, the instructions were not quite accurate. For instance, it said to remove the ring around the leather of my stick shift while that was not necessary, and I ended up breaking (a thankfully invisible) area around a hidden screw. I should have known, the ring in the diagram was a round rectangle, while the ring in my car is an oval. But I was able to pop the assembly off, get into the area below the stereo, reach up and find the connector socket and plug the Blitzsafe into place. Then it was a simple matter of taking the lower console into the house and drilling out the 3 holes (2xRCA jacks and 1 bolt hole) to mount my little metal bracket. Thankfully, it looks pretty slick.

I mounted the jacks to the right of the cigarette lighter jack, as I wanted some chance of not blocking the passenger cup holder, and also because the flip top of the lighter jack would have blocked mounting it below.

I also installed the keyless entry system, and that was pretty much according to the instructions, except it was pretty hard finding the loose connector with "the blue tape." But digging around inside the console found it hiding amongst some other cables. Also, the keyless module would not click into place in it's tab..

Oh, and it works great. My iPod is on a long enough cable that my wife can use it in the back seat.

I'll be listening to podcasts on my way to work for sure.

Sunday, June 26, 2005

Refitting with Core Data

I have a project InCDius 2 with which I demonstrate my coding skills, and update my Cocoa skills. I know I have some users out there, and I'm thankful for them, but it's mainly about me, about either getting me jobs or educating myself.

One of the big new technologies in Mac OS X 10.4 Tiger is Core Data. Core Data is gives you two things: it makes it very easy to create a document or a database for your your Cocoa applications, and it allows you to add functionality without writing code. I'm mostly interested in moving to an Apple maintained database framework; I've used Sleepy Cat's Berkeley DB libraries for the back store of InCDius and I have never been satisfied with the result. I do not have the time to learn the libraries complicated and obscure API well enough to give a rock solid and efficient user experience. I cobbled a usage together once, and it works OK and is quite fast, but people report occasional corruptions. I'd rather use a database with a pre-existing Cocoa API which Apple is actively developing, and I don't have to worry about getting a static library to link properly with a x86/PPC universal binary.

Anyway, I want to refit the database in my pre-existing application. This would be a lot easier if I were writing this from scratch or there wasn't an installed base of people with their carefully filled databases, or if some users weren't still on Panther. So I need to support both databases for a while.

So my needs are:

  • Code to translate from an old database to a new one.

  • Abstracted records where most of the application does not need to know how they were created or how they are stored

  • GUI to let the user know I'm switching the database over.

  • If I'm running under Panther or Jaguar, I have to be using the old database.

  • If I'm running under Tiger, I could be using either database.

  • If I'm running on x86, I need to be using only the new database, because I don't want to deal with endian issues or keeping two versions of the Berkeley static library compiled and linked in. It was painful enough to get it compiled in the first place on one platform.

As in most such things, the first and most important step is increasing the level of abstraction. The first rule of programming says that all problems can be solved with a high enough level of abstraction. We'll see.

BTW, if you are an InCDius user who's come across this entry. You can often fix database problems by opening up a terminal window and pasting in the following two commands (assumes that InCDius is installed in the Applications directory):

cd /Library/Application\ Support/Generally\ Helpful\ Software/InCDius

/Applications/InCDius\ /InCDius\ GH\ db_recover -c

Saturday, June 11, 2005

WWDC - Some Impressions

I'm in the Detroit airport on a 3.5 hour layover awaiting the flight to Manchester after a week at Apple's World Wide Developer Conference. As a "rank and file" developer, I've a few observations of the conference as a whole.

Firstly, the big news was the announcement of the Intel transition. When it comes down to it, I just don't care very much. I've never done any Altivec programming, and I've never written a line of PowerPC assembly. If Apple thinks they can make future Powerbooks which are both cooler and faster than staying with PPC, well that would be very nice. I was already going to have to put in a huge amount of modernization/refactoring on my next project and this will just force the issue. I know there are people out there who've warred for years with PC bigots about which is better PPC or X86, and to them this is a premature surrender; luckily I don't have that kind of baggage. I also don't think it will affect my near term hardware buying decisions, I always knew that if I bought a new Powerbook, there would be one 30% faster within 6 months, and it's going to be a long while before Apple ships a 64-bit Intel PowerMac.

Secondly, there was no second biggest announcement. I was hoping for the release of dual core Powerbooks or some other improvement which would have some immediate affect on my computing experience. The keynote was a bit too short for my taste. No, "one more thing."

Thirdly, I am always impressed by the joyful professionalism of the Apple engineering staff. They love their jobs and are always friendly and helpful even when I'm struggling to even know what words to use in a question. I spent some time talking to the maintainer of the AppleUSBAudio driver, and he is a great young guy, who actually seemed enthusiastic about my little Turtle Beach project.

Fourthly, I think the developers who need to write in C++, and by extension have to use Carbon are getting tired of their second class status. I would love to use Cocoa and Objective C for everything too, thus the name of this blog, but sometimes on cross-platform projects, or where there is a huge amount of legacy code, that is just not possible. It would be helpful if Apple devoted more engineering time to keeping Carbon and Core Foundation on par with Cocoa. For example, the Core Data classes in Cocoa are fantastic, but they won't do a cross-platform developer a lick of good. On the other hand, people who don't use Cocoa just because the Objective-C message calling syntax makes them queazy should suck it up and just learn it.

Fifthly, the new generation of developers are so amazingly young. I talked to the Delicious Library guys and I don't know if they can legally drink yet. I feel so old.

Friday, June 03, 2005

The Thinkpad X23 and the Dell 2005FPW LCD Monitor

I own a Dell 2005FPW LCD monitor, which has a native resolution of 1680x1050. My wife owns a Thinkpad X23 model 2662. The Thinkpad uses an integrated ATI Mobility Radeon 7000 as it's graphics engine. I thought, "Hey it would be nice if I could plug my nice widescreen monitor into my wife's little Thinkpad." So I tried, and it didn't work because there was no 1680x1050 available in the Windows XP display panel.

Then I thought, that perhaps there was a more modern driver available, so I went to ATI's web site and it turns out that they do not provide drivers for integrated notebook video cards. So I went to IBM's web site which a lot of searching ended me up at Lenovo's driver page for the X23. I had some trouble actually downloading from the site from the Thinkpad, due to some Java problem, and ended up using my 12" PowerBook 867 Mhz to download the driver, and move it over to the Thinkpad with a thumb drive.

Installation was quick and easy, and successful. My wife can now surf the web in beautiful widescreen if she so chooses.

I also have a USB hub available which I can plug into the desktop PC, my PowerBook or the ThinkPad which with a single plug gives printing, external keyboard, trackball, and audio out. It's a pretty sweet setup.

Tuesday, May 31, 2005

Darwin Station

Well as luck would have it, Apple has open sourced much of their core operating system, including the driver for USB audio, as part of their Darwin project. So I downloaded the AppleUSBAudio-199.2.10 archive.

Getting it to compile was a bit of a chore, as they are transitioning towards using real 64 bit integers for things like time stamps, so I had to cast this and that, and change a few variable types. I haven't actually figured out how one installs a driver in place of its original.

But I did notice something strange, a probable bug that might lead to the driver not recognizing if a device could support an S/PDIF connection. In the AppleUSBAudioEngine::AddAvailableFormatsFromDevice method there is a for loop

for (altSettingIndx = 1; altSettingIndx < numAltInterfaces; altSettingIndx++) {

and then after the for loop, the altSettingIndx variable is used again to test for an S/PDIF interface, but I don't think it's a valid index and it looks like the test was supposed to be in the for loop.

I'll try to find someone at WWDC to confirm this is a bug.

Sunday, May 01, 2005

What Does the Spec Say?

If I want to get S/P DIF bypass mode, I should first try to do it in a non-hackish, standard compliant way. So, what does USB.ORG have to say about the matter? Well, it does provide some info in the form of version 1.0 of the Universal Serial Bus Device Class Definition for Audio Devices, and more importantly the supplementary Universal Serial Bus Device Class Definition for Audio Data Formats.

What do I learn from this? Well, I find out that what I want is the device to support a Type Ⅲ format. A Type Ⅰ format would be normal PCM. A Type Ⅱ format would be the case where my receiver had a USB connector and took in AC-3 or MP3 files directly. In a Type Ⅲ format, the compressed format is sent along as pseudo-PCM which is what I need. Unfortunately, the specification says that if my device supports such a thing, it should have an alternate streaming interface exactly the same as the PCM interface, except the format type should be FORMAT_TYPE_III, and of course my AAM device has no such interface.

The other potentially useful bit of information that a Type Ⅲ stream “The non-PCM encoded audio bitstreams that are transferred within the basic 16-bit data area of the IEC1937 subframes (time-slots 12 [LSB] to 27 [MSB]) are placed unaltered in the two available 16-bit audio subframes per audio frame of the Type Ⅲ formatted USB stream. The additional information in the IEC1937 subframes (channel status, user bits etc.) is discarded. Refer to the IEC1937 standard for a detailed description of the exact contents of the subframes.” Well that is interesting, and if true, how is the receiver supposed to figure out that it's seeing a compressed stream? Or will a supporting USB device add this information back in for you?

Oh, I watched the director's cut of Daredevil on my PC using the AAM, and I got beautiful DTS 5.1. Given the importance of sound in that film, surround sound is the way to go. Also, the director's cut is the way to go; the story has much better flow, and makes more sense.

Friday, April 29, 2005

The Proof is in the Bi-Phase Coding

Well, I figured it might be helpful to figure out what my speakers expected to see if they were ever to play AC-3 files over S/PDIF. So back to Google. Ah, some company called Audio Precision puts out a series of technotes on audio electronics. Technote 26 is on "The Digital Interface," and it lays out what my speakers expect to see. (You need to register to get the full technote.)

Of non-practical interest to me, the signal sent over the TOS-Link uses Bi-Phase Coding which is a clever encoding scheme which insures that regardless of the data (all binary 1's, all binary 0's or any mixture) the receiver gets a constant stream of regularly spaced signal transitions with which to sync itself.

Of practical import is a little history. The S/P DIF standard did indeed only expect to transport PCM encoded, uncompressed, two channel data, and then at some point, someone asked whether it would be possible to transport multi-channel compressed audio over the same connection, using the same protocol. Would the wires, encoders circuitry, decoder circuitry, etc. care if instead of PCM style data, there were the bytes from a compressed audio stream? Well no, especially if a bit was set in every data frame saying that it was "invalid" audio, and if periodically a channel status block was sent out saying that the channel was sending out "non-audio". Bytes is bytes. A receiver which didn't know about compressed formats would see such a stream and go into mute mode awaiting valid audio. A receiver designed to play raw AC-3 files, would know to see if the stream being sent appeared to be an AC-3 stream. Newer receivers might even look for Microsoft audio streams, and future receivers might know to look for some futuristic format. The only requirement being that the compressed audio fit in a bandwidth adequate for uncompressed stereo, and that your receiver know about it. This extension (hack) to S/P DIF is called IEC61937.

So the question still remains, how do you set the invalid audio bit of the PCM frame, and the channel status packet?

It's in the Chips

As I mentioned in my previous post, the Turtle Beach Audio Advantage Micro uses a USB interface by some company called C-Media Electronics, Inc. A quick Google search finds them in Taiwan. This is the present and future of electronics manufacturing, Taiwanese companies both designing and manufacturing items branded by American companies. It's why PowerBooks ship direct to you from factories on Taipei.

C-Media is quite happy, I'm sure, to sell anyone with enough cash the exact same chip set they sold Turtle Beach, the CM102 USB Audio Controlller. And the provided technical documentation is quite interesting. It looks like almost all the needed functionality you would need to implement a AAM like device is on this single integrated circuit. All that would be needed would be a USB connector, circuit board, a variety of capacitors and resistors and a TOS-Link emitter package; it'd be fun to slap these things together if I did that sort of thing.

But not a lot of help towards knowing what the driver should send the device to get my goal of AC-3 playthrough. It does mention something called "Xear 3DTM Sound Technology," but that is probably something proprietary and useless to me, so I will ignore it for now.

My answers are elsewhere.

Thursday, April 28, 2005

Investigating the Audio Advantage Micro

If you've installed Developer tools on your Mac you will find a useful little application called USB Prober.

If you have a AAM plugged in, and you run USB Prober, you find out what the Apple driver has to work with in configuring and sending it data.
Full Speed device @ 3 (0x19110000): ............................................. Composite device: "USB Audio"
Device Descriptor
Descriptor Version Number: 0x0110
Device Class: 0 (Composite)
Device Subclass: 0
Device Protocol: 0
Device MaxPacketSize: 8
Device VendorID/ProductID: 0x0D8C/0x0001 (C-MEDIA ELECTRONICS INC.)
Device Version Number: 0x0010
Number of Configurations: 1
Manufacturer String: 1 "C-Media INC."
Product String: 2 "USB Audio"
Serial Number String: 0 (none)

It's been a while since I did driver development, but let's break this down: it's a composite device which means it can be treated as two or more types of devices. For instance, it might be a outlet for audio data, and also be a volume control. The actual manufacturer of the USB interface chip was not Turtle Beach, but instead is somebody called C-Media Electronics, who've been issued a VendorID of 0x0D8C by the maintainer of a list of unique vendor IDs. and this is their first product using this ID.

Below this we have 2 interfaces. These are alternate pathways towards controlling the device. A driver will follow a very standardized series of calls over the USB bus to set up a communication pathway, these public interfaces lets the driver what format the device expects on the other side.

The first interface is given as Interface #0 - Audio/Audio Control
and a perusal indicates it is a standard USB protocol for controlling audio playback by giving a standard way to support muting, volume, etc. (I guess)

The second interface is given by Interface #1 - Audio/Audio Streaming
and basically says that this interface will accept a stream of PCM formatted audio data in an isochronous stream. The PCM is 2 channel stereo with a sampling rate of 48Khz. Very similar to what you get off of an audio CD except an audio CD is natively 44.1kHz. It's an isochronous stream which basically means the USB bus will try hard to allocate the stream a constant bandwidth, it's better for your mouse movement to be choppy than your audio playback.

But nothing about S/P-DIF. How does the PC driver send AC-3 to the receiver if it only supports PCM? Well there must be a way.

Necessity is the Mother of Drivers

I've been doing some online research on digital audio.

It all started when I purchased the device pictured below, a Turtle Beach Audio Advantage Micro, at a CompUSA store for $30.

What interests me about this product is I have a set of Logitech Z-5500 digital, 5.1, speakers, which have an unused optical input. The Audio Advantage has an optical output. So I can plug the AAM into my Powerbook 12" and get beautifully clean sound avoiding the auditory ugliness of a ⅛" mini-jack. And it works! iTunes sounds clearer than ever.

But there is something else I would like.

As of Mac OS X 10.3, the DVD Player application has an interesting option. If you have a S/P DIF output (which for all intents and purposes, the TOS-Link on the AAM is), and the driver for that output supports what is called bypass mode, the DVD Player can be set to not decode the AC-3 soundtrack on your DVD, it can be lazy and not convert the beautiful 5.1 soundtrack into old school stereo. Instead, the raw AC-3 file will get spit out the S/P DIF and into your stereo receiver, and if your receiver can handle it (which the Z-5500 most certainly can), you will get surround sound of the highest quality instead of lame stereo with a Pro-Logic II effect to make it sound sort of like surround sound.

So, the DVD Player supports it, the AAM supports it, my speaker system supports it. What doesn't support it? The Apple provided driver does not know about the AAM, and therefore cannot tell the DVD Player to send AC-3 streams through. The AAM supports this bypass mode on the PC, my desktop Dell sounds great, because Turtle Beach has written a driver for Windows XP. They rely on Apple's generic audio driver for the basic stereo support we Mac users get. If someone in the know were to write a Mac driver for the AAM, you could get surround sound out of a Powerbook, Mac Mini, eMac, iMac or iBook for $30+. PowerMac G5's already have an optical output.

As it happens, I have written a handful of USB drivers in my professional life, but never for OS X, and never involving audio. So I am investigating how I would go about writing a driver, and I will test out using the blog form to publish my finds here, if I abandon the effort someone might find my entries useful.

Of course, I'll get my copy of Mac OS 10.4 (Tiger) in a few days, and it's USB audio driver might support the AAM, and I'll say forget it.

Monday, April 11, 2005

On 5.1 sound

Well, it's quite late, and I spent the last 4 days not getting much work done. We are late in the development cycle at my day job and I am in desperate need of two weeks off. My problem with contract work is I have to pay for my own vacations. So I haven't gotten proper R&R in over a year. All those weeks of problem solving and design, of never turning my brain off, have caught up with me. Anyway, I have a new toy to distract me.

Dell had a low price on Logitech Z-5500 desktop speakers. My primary interest was the number of inputs: six. Four analog and two digital which means no more unplugging my PC to give an input for my Powerbook, etc. And it's my first foray into the wonderful world of Dolby Digital 5.1 sound. My Sony DVD player is more than happy to output 96/24 (whatever that means) over the coaxial digital line, so I can watch movies on my widescreen 20.1" LCD monitor while being immersed in sound waves. I watched the Two Towers tonight and I am just amazed how much proper sound adds to the effect. Sonically, it is more real than real. Amazing.

And this is with the subwoofer set to 1 on an 11 point loudness scale, and the satellites at 3. I wouldn't want to keep the downstairs neighbors up.

I also bought a cheap Turtle Beach Audio Advantage Micro USB to optical adaptor, which does not give my Powerbook 5.1 output unfortunately, but does give it beautiful, hum-free, stereo output. iTunes sounds better than I've ever heard it. What a bargain.

Sunday, April 10, 2005

Welcome to My Soon to be Abandoned Blog

I wanted to post a comment on Anne Althouse's blog, which required me to setup this blog account. I doubt I will ever make use of this, but I might use it to run a diary of a Cocoa based multimedia application I have been considering writing. If I do the project, I'll be back. You can see my homepage at