Windows Portable Devices

Friday, 02 May 2008
  • By
  • Jeff Ammons
  • Tags:
  • Devices
  • Programming
  • Windows

The Windows Portable Devices API is to talking to media devices what DirectX is to gaming. It is an attempt to make a secure, standard method of communicating with devices ranging from Media Players to cameras to temperature sensors…

There are things I like about it and things I really, really don't like. For an MP3 player manufacturer one big reason to use this API instead of making the device work like a USB drive is DRM.

But, it looks at this point like DRM (Digital Rights Management) for music files is a dying beast. The recording industry seems to be accepting the fact that their customers HATE DRM. There are now several ways to LEGALLY purchase songs in unencumbered MP3 format. Arguably the only people inconvenienced by DRM were the legal users. The pirates never had a problem circumventing the so called protection.

What does this mean to you (and me)? Well, when I work with my son's Transcend player (which could never play DRM music), it looks just like a USB drive. Easy, peasy. When I work with my Creative Zen or my daughter's Creative Zen V, I have to use the Windows Portable Devices API.

The lack of a .Net version of the API is a bummer, but not insurmountable. You get to take a fun and exciting trip through the world of ILDASM and ILASM, then you get to read the C++ examples and do a bit of mental gymnastics, but you can get there.

So far I have gotten as far as enumerating the connected devices, getting their friendly names, descriptions and manufacturer info. Next I'll be diving into how to get the file info and move files around. Not as straightforward as working with the file system, but always remember, “No matter where you go, there you are.”

Here are some links that are helpful with working with the Windows Portable Devices API.

API documentation in MSDN

Windows Portable Device Team Blog

The team put up an example of using the API to talk to a temperature sensor using c#:

Darene Lewis' Blog

I'm not really sure exactly who Drene is, but I'm guessing Microsoft Employee based on the blog address…

In any event there is much good info here regarding the Windows Portable Device API and how to use it with .Net.