Thanks so much for this!

FWIW, you may want to consider adding a CFRetain immediately after IOServiceMatching, as according to the Apple docs IOServiceGetMatchingServices "consumes" a reference to the the object. Also (and I'm not quite sure about this), but may want to IOObjectRelease both entry_iterator and serviceObject (at the bottom of while loop). I'm a bit of an IOKit newbie, so I'm just trying to interpret the Apple docs as closely as possible.

Again, thanks for pointing out how to do this:-)