From: Louis Adiputra <netsharc@gm...> - 2009-12-01 04:54:52
Hi Christophe and others reading,
anyway, as I said I didn't want to depend that much on the SysInfo
and SysInfoExtended, so after too much wondering where to start
modifying the libgpod source, I copied and pasted from parse_itdb to a
parse_itdb_builtin(const gchar *mp, const gchar *firewire_guid,
I added 2 lines after itdb_set_mountpoint (itdb, mp);
itdb_device_set_sysinfo (itdb->device, "ModelNumStr", "MA712");
/* this library is being designed to run on the iPhone, so we just
tell it that device is an iPhone. (although, will this cause problems
with capacity calculations?) */
itdb_device_set_sysinfo (itdb->device, "FirewireGuid",
So later itdb_hash72_extract_hash_info() calls
->itdb_device_get_checksum_type(), which calls
--> itdb_sysinfo_properties_get_db_version(), which will I believe
fail because of the non-existing SysInfoExtended.
--> and as an alternative it calls itdb_device_get_ipod_info()
---> itdb_sysinfo_properties_get_serial_number(), which will also fail.
---> but then it calls itdb_device_get_sysinfo (device,
"ModelNumStr"), which works because I set it earlier :P
So itdb_device_get_ipod_info() returns an appropriate info line,
itdb_sysinfo_properties_get_db_version() returns 4,
itdb_device_get_checksum_type() returns ITDB_CHECKSUM_HASH72 and a
HashInfo is generated.
At the first run it did fail because I didn't have a "Device"
directory to store the HashInfo in.
As for passing the FirewireGUID to the function, The main app passes
it the first 16 bytes of [UIDevice currentDevice].uniqueIdentifier,
making the proper imports from the iPhone SDK makes it compile
properly, which amazed me (that mixing C and Obj-C works).
Well, do tell me if that was really ugly. :)
Anyway, it still works (managed to insert a song into the DB so it
appears on the player).
I do have a question, how far to 0.7.3? :) I see you still have to
detect the proper iPhone OS version to see which database version it
would want. I guess from outside the phone that depends on libiphone.
Inside it there's UIDevice which is nice :)