|
Packit |
29108b |
Introduction:
|
|
Packit |
29108b |
|
|
Packit |
29108b |
The goal of this document is to provide an overview of the various parts/files
|
|
Packit |
29108b |
involved when libgpod interacts with a device. Ideally it will be helpful to
|
|
Packit |
29108b |
help application writers/distributors/... figure out what's going wrong when
|
|
Packit |
29108b |
trying to interact with an iPod-like device.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
Please note that not all devices need all these steps (especially the
|
|
Packit |
29108b |
hash58/hash72 stuff and the sqlite databases), see the table at the end for
|
|
Packit |
29108b |
more details
|
|
Packit |
29108b |
|
|
Packit |
29108b |
|
|
Packit |
29108b |
Overview:
|
|
Packit |
29108b |
|
|
Packit |
29108b |
* device is plugged in
|
|
Packit |
29108b |
|
|
Packit |
29108b |
HAL/udev detects the insertion and runs a callout. This callout sends the
|
|
Packit |
29108b |
appropriate commands (raw SCSI/USB commands or special AFC command) to the
|
|
Packit |
29108b |
device to get an XML file describing the device capabilities (artwork formats
|
|
Packit |
29108b |
supported, serial number, ...) and dumps this XML file to
|
|
Packit |
29108b |
iPod_Control/Device/SysInfoExtended for future use by libgpod. libgpod doesn't
|
|
Packit |
29108b |
do it directly because sending these SCSI/USB commands might need elevated
|
|
Packit |
29108b |
priviledges.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
* the application uses libgpod to read the device content
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iPod_Control/iTunes/iTunesDB is accessed as well as a few other files. If
|
|
Packit |
29108b |
the device needs an hash72 (either in its iTunesDB or because it's using sqlite
|
|
Packit |
29108b |
databases), then the necessary information is extracted from the existing
|
|
Packit |
29108b |
iTunesDB to generate an iPod_Control/Device/HashInfo file (if it doesn't
|
|
Packit |
29108b |
exist) which will be useful to generate any hash72 we need for this device.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
* the application uses libgpod to write to the device
|
|
Packit |
29108b |
|
|
Packit |
29108b |
libgpod generates an iPod_Control/iTunes/iTunesDB file. If an hash58 is needed
|
|
Packit |
29108b |
then the device FirewireID is used to generate it. If an hash72 is needed
|
|
Packit |
29108b |
then the HashInfo file is used to generate it. If the device uses sqlite
|
|
Packit |
29108b |
databases, they are generated as well. Post process SQL commands are then
|
|
Packit |
29108b |
extracted from the device (either by getting them from SysInfoExtended or by
|
|
Packit |
29108b |
getting them through AFC) and executed after the sqlite database generation.
|
|
Packit |
29108b |
These post process commands are useful to make sure the sqlite databases layout
|
|
Packit |
29108b |
matches what the current device firmware expects.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
|
|
Packit |
29108b |
Glossary:
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iTunesDB: binary file containing information about all the songs, playlists, ...
|
|
Packit |
29108b |
stored on the device. On recent devices (iPhoneOS 3.x, Nano 5g), it's replaced
|
|
Packit |
29108b |
by iTunesCDB which is a compressed version of iTunesDB.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
sqlite: recent devices (iPhoneOS 3.x, Nano5g) use sqlite databases instead
|
|
Packit |
29108b |
of an iTunesDB to store song information, playlists, ... More accurately, they
|
|
Packit |
29108b |
have both an iTunesCDB (compressed iTunesDB) used by iTunes to know the device
|
|
Packit |
29108b |
content and sqlite databases used by the device. Along with these sqlite
|
|
Packit |
29108b |
databases, there's a .cbk file which contains checksum information and a hash72
|
|
Packit |
29108b |
for the sqlite data.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iPhoneOS: umbrella for iPhone-like devices, ie iPhones, iPod Touch and (likely)
|
|
Packit |
29108b |
iPad. On these devices, what matters is the firmware version, not the device
|
|
Packit |
29108b |
type.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
hash58: first iTunesDB hashing scheme introduced by Apple. It appeared in the
|
|
Packit |
29108b |
iPod Nano Video (3g) and iPod Classic and was used by iPhoneOS 1.x. It's fully
|
|
Packit |
29108b |
reverse-engineered and uses the iPod FirewireID (called this way even on USB
|
|
Packit |
29108b |
devices) as part of the calculation.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
hash72: hashing scheme that was first introduced in iPhoneOS 2.x and has then
|
|
Packit |
29108b |
been used on the iPod Nano with a camera (5g). It was much more complicated to
|
|
Packit |
29108b |
reverse engineer and is not yet 100% known. However, given a file with a valid
|
|
Packit |
29108b |
hash72, we can extract some hashing data to be able to generate valid hash72
|
|
Packit |
29108b |
hashes for any file.
|
|
Packit |
29108b |
|
|
Packit |
29108b |
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iPod feature matrix:
|
|
Packit |
29108b |
|
|
Packit |
29108b |
SysInfoExtended hash58 hash72 sqlite iTunesCDB
|
|
Packit |
29108b |
iPod 1G no no no no no
|
|
Packit |
29108b |
iPod 2G no no no no no
|
|
Packit |
29108b |
iPod 3G no no no no no
|
|
Packit |
29108b |
Mini 1G no no no no no
|
|
Packit |
29108b |
Mini 2G no no no no no
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iPod 4G yes no no no no
|
|
Packit |
29108b |
iPod 5G yes no no no no
|
|
Packit |
29108b |
Nano 1G yes no no no no
|
|
Packit |
29108b |
Nano 2G yes no no no no
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iPod Classic yes yes no no no
|
|
Packit |
29108b |
Nano3G yes yes no no no
|
|
Packit |
29108b |
Nano4G yes yes no no no
|
|
Packit |
29108b |
iPhoneOS 1.x yes yes no no no
|
|
Packit |
29108b |
|
|
Packit |
29108b |
iPhoneOS 2.x yes no yes no no
|
|
Packit |
29108b |
|
|
Packit |
29108b |
Nano5G yes yes[1] yes yes yes
|
|
Packit |
29108b |
iPhoneOS 3.x yes no yes yes yes
|
|
Packit |
29108b |
|
|
Packit |
29108b |
|
|
Packit |
29108b |
[1] surprisingly, the Nano5G uses a hash58 for its iTunesCDB and a hash72
|
|
Packit |
29108b |
for its sqlite cbk file. iPhoneOS 3.x uses hash72 everywhere.
|
|
Packit |
29108b |
|