Blame README.overview

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