summaryrefslogtreecommitdiffstats
path: root/src/itdb_device.c
diff options
context:
space:
mode:
authorjcsjcs <jcsjcs@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-09-24 14:59:33 +0000
committerjcsjcs <jcsjcs@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-09-24 14:59:33 +0000
commit3d54de27eddcfa14a5313a22bb09374e8a37aaa8 (patch)
tree4f335a85ef383828ec9d6979fa78fc40a23af043 /src/itdb_device.c
parent86e1c0ae7a8eac138cce370c2c07cea8c5b6f0a0 (diff)
** code courtesy of Christophe Fergeau **
* src/itdb_itunesdb.c (mk_mhbd): write extended header needed for new iPod Nanos (3G Video) and iPod Classics. src/itdb_device.c src/itdb_device.h: Code to parse SysInfoExtended and SysInfo for the FireWireGUID. You must either copy the iPod description XML file to Device/SysInfoExtended or add a line 'FirewireGuid: 000A27....' to Device/SysInfo. You can get your FirewireGuid by using the tests/test-fw-id test program. * src/sha1.c src/sha1.h src/itdb_sha1.c src/itdb_sha1.h New files for obscure hash generation code. * src/Makefile.am: added new files. * tests/test-checksum.c tests/test-fw-id.c tests/Makefile.am: test programs to retrieve the FirewireGuid and calculate/write the obscure hash. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1698 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/itdb_device.c')
-rw-r--r--src/itdb_device.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/itdb_device.c b/src/itdb_device.c
index 10ae719..6b4ee77 100644
--- a/src/itdb_device.c
+++ b/src/itdb_device.c
@@ -223,6 +223,7 @@ static const gchar *ipod_model_name_table [] = {
N_("Nano (Blue)"),
N_("Nano (Green)"),
N_("Nano (Pink)"),
+ N_("Nano (Red)"),
N_("iPhone (1)"),
N_("Shuffle (Silver)"),
N_("Shuffle (Pink)"),
@@ -471,13 +472,14 @@ gboolean itdb_device_read_sysinfo (Itdb_Device *device)
g_free (sysinfo_path);
}
g_free (dev_path);
+
+ itdb_device_read_sysinfo_xml (device, NULL);
+
/* indicate that sysinfo is identical to what is on the iPod */
device->sysinfo_changed = FALSE;
return result;
}
-
-
/* used by itdb_device_write_sysinfo() */
static void write_sysinfo_entry (const gchar *key,
const gchar *value,
@@ -925,7 +927,6 @@ const gchar *itdb_info_get_ipod_generation_string (Itdb_IpodGeneration generatio
*
* Return value: true if @device can display artwork.
*/
-
gboolean itdb_device_supports_artwork (Itdb_Device *device)
{
if (device == NULL) {
@@ -1035,3 +1036,26 @@ static void itdb_device_set_timezone_info (Itdb_Device *device)
device->timezone_shift += 3600;
}
}
+
+/**
+ * itdb_device_get_firewire_id
+ * @device: an #Itdb_Device
+ *
+ * Returns the Firewire ID for @device, this is useful to calculate the
+ * iTunesDB checksum which is expected by newer iPod models
+ * (iPod classic/fat nanos)
+ *
+ * Return value: the guint64 firewire id, or 0 if we don't know it
+ **/
+guint64 itdb_device_get_firewire_id (Itdb_Device *device)
+{
+ gchar *fwid;
+
+ g_assert (device->sysinfo != NULL);
+
+ fwid = g_hash_table_lookup (device->sysinfo, "FirewireGuid");
+ if (fwid == NULL) {
+ return 0;
+ }
+ return g_ascii_strtoull (fwid, NULL, 16);
+}