Detecting iPods programmatically

Posted by Dave on July 14th, 2006

I’ve been trying to find a way to detect what kinds of iPods are plugged into a Mac (or PC). Turns out that every iPod (apart from the iPod Shuffle) has a hidden SysInfo file, which contains information about the device. And, with the aid of some friends with iPods, I have managed (I think) to come up with a way of detecting which iPod is which, using the SysInfo file. It’ll even detect the colour of the iPod.

The secret is to look at the ModelNumStr entry in the SysInfo file. First, some info about SysInfo.

You can find the SysInfo file on an iPod by making the iPod mount as a hard disk, and browsing to the file at /iPod_Control/Device/SysInfo. If you’re on a Mac, you can use this handy little AppleScript application I wrote, which will ask you to select the iPod from a list of currently connected ejectable drives. It’ll then copy (not move!) the SysInfo file from the iPod to your desktop. (Note: I make absolutely no guarantees about this little app – I just created it to make life easier for my friends who don’t like using Terminal. Use it at your own risk.)

A SysInfo file looks a little something like this:


BoardHwName: iPod M25
pszSerialNumber: XXXXXXXXXXX
ModelNumStr: MA003
FirewireGuid: 0x000A2700147FDCA9
HddFirmwareRev: BU011A
RegionCode: FB(0x001A)
PolicyFlags: 0x00000000
buildID: 0x06118000 (6.1.1)
visibleBuildID: 0x01118000 (1.1.1)
boardHwRev: 0x00000000 (0.0 0)
boardHwSwInterfaceRev: 0x000B0005 (0.0.11 5)
bootLoaderImageRev: 0x00000000 (0.0 0)
diskModeImageRev: 0x00000000 (0.0 0)
diagImageRev: 0x00000000 (0.0 0)
osImageRev: 0x00000000 (0.0 0)
iPodFamily: 0x00000000
updaterFamily: 0x00000000

That’s for a white 60Gb iPod Video (aka the 5th generation iPod).

So we’re most interested in the ModelNumStr line:


ModelNumStr: MA003

This code actually bears a strong similarity to the ID code you’ll see when you view an iPod in your shopping basket on the Apple Store. It’s the ID Apple use to refer to that particular iPod – so different coloured iPods have different model numbers, for example.

From the SysInfo files I’ve gathered from friends and the Internet, I’ve found that sometimes the ModelNumStr value doesn’t quite match the known model number for an iPod. Usually, this means that the model number begins with M, but the ModelNumStr begins with P. However, the rest of the ModelNumStr matches perfectly.

So, I propose that if you take the ModelNumStr value, strip off the first character (usually an M or a P), and compare it with the model numbers in the list below (likewise with the first character removed), then you’ll be able to deduce what iPod is plugged in. It’s worked for all the iPods I’ve tested so far.

There’s an exception to this rule – first and second generation iPods don’t have the ModelNumStr line in their SysInfo files. For these iPods, you’ll need to use an alternative approach. Take a look at the boardHwSwInterfaceRev line in the SysInfo files. If the value of boardHwSwInterfaceRev begins with 0×0001, then you have a first-gen iPod. If it begins with 0×0002, then you have a second-gen iPod. This doesn’t detect the disk size or features of the iPod, but it does still allow you to work out which generation of iPod is connected. You can use boardHwSwInterfaceRev as a general fallback for checking the generation of iPods – where I know it, the corresponding value is in the table below.

Not all of the info below has been checked, so if you have an iPod in the list, please do post a comment if you can confirm (or refute) any of the model numbers etc.

Especially usefull to confirm are the HP iPods, which are a bit more of an unknown. I’ve found the SysInfo file for one HP iPod posted on the web, and it matched the rules above, but I’d like to test more!

All of the information I have gathered, together with what it all means, can be found in my Big List Of iPods.



Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Hi Dave, that’s a nice bit of info about the SysInfo file there – I’ve squirreled it away onto del.icio.us so that I can make use of it on a rainy day.

I’m glad Standardista Table Sorting is working out for you there too – it’s good to see it being used out there in the wild :D

Hi Neil,

Thanks! The Standardista code is very handy – something I’ve been meaning to write myself for a while, but you’ve done a much better job of it :-) I did hack it a little, to strip out the sup tags I’m using for sources, so it still sorts properly. Thanks!

is there anyway i can see the source of you applescript that gets the sysinfo file you can e-mail it to fiftyfour123@gmail.com

Hi Evan,

Here’s the AppleScript code:

tell application "Finder" to get name of every disk whose ejectable is true

choose from list (result)

set theFile to (result as string) & ":iPod_Control:Device:SysInfo"

set theDest to (path to desktop as string)

tell application "Finder" to duplicate alias theFile to alias theDest

You should try libipoddevice from GNOME CVS. I wrote all of this over a year ago for exactly this purpose in Banshee. It’s a shame you had to go through all this research again when the code and tactics were already solved, openly.

However, SysInfo is now obsoleted by iTunes 7 / latest firmware update (no device information is actually stored on the mass storage partition anymore). I am working on the next way to detect all this great device information. It’ll land in libipoddevice soon.

I have a [b]red[/b] Ipod Nano second gen. Can you include that? Also is there a firmware hack for the second gen ipods yet? Because I would like to modify the UI graphics.

[...] A while back, I wrote a post about detecting iPods connected to your Mac, and finding out their model number in order to deduce information such as the iPod model and colour. Then, in September, Aaron Bockover of the Banshee Project informed me that Apple have changed their approach to storing this information, and no longer store it in an easily-accessible file. It is now hidden in the iPod’s SCSI codepages, and these are remarkably tricky to access and query under Mac OS X. Fortunately, I’ve worked out how to do it The iPodLinux project wiki provided me with the base information about how this info is stored in the SCSI codepages, for which I am eternally grateful. Kudos to Aaron for deducing this info and sharing it with me too. The missing link was now how to query these codepages under Mac OS X. [...]

Great I have been trying to come up with the sysinfo file but hasn’t been able to. I will like to know if you know a command in MSDOS that I can use to extract the serial number, view the entire file as well the type of file the sysinfo file is.
great job, its been very helpful so far

PC download?