commit c342d77c30bfedc9636d47e17df1a48e0f182a5d
Author: Christophe Fergeau <[email protected]>
Date:   Mon Nov 16 23:09:24 2009 +0100

    add small test program for afc file writing

 tools/Makefile.am |    6 ++++++
 tools/test-afc.c  |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/tools/Makefile.am b/tools/Makefile.am
index ee6cf1e..5d83f04 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -11,6 +11,8 @@ if HAVE_LIBIPHONE
 ipod_read_sysinfo_extended_SOURCES+=ipod-lockdown.c
 ipod_read_sysinfo_extended_CFLAGS+=$(LIBIPHONE_CFLAGS)
 ipod_read_sysinfo_extended_LDADD+=$(LIBIPHONE_LIBS)
+
+bin_PROGRAMS+=test-afc
 endif
 
 if HAVE_HAL
@@ -41,6 +43,10 @@ if HAVE_LIBIPHONE
 libgpod_callout_SOURCES += ipod-lockdown.c
 libgpod_callout_CFLAGS += $(LIBIPHONE_CFLAGS)
 libgpod_callout_LDADD += $(LIBIPHONE_LIBS)
+
+test_afc_SOURCES = ipod-lockdown.c test-afc.c
+test_afc_CFLAGS = $(LIBIPHONE_CFLAGS)
+test_afc_LDADD = $(LIBIPHONE_LIBS)
 endif
 
 if HAVE_SGUTILS
diff --git a/tools/test-afc.c b/tools/test-afc.c
new file mode 100644
index 0000000..51b60ce
--- /dev/null
+++ b/tools/test-afc.c
@@ -0,0 +1,36 @@
+#include <glib.h>
+
+extern char *read_sysinfo_extended_by_uuid (const char *uuid);
+extern gboolean iphone_write_sysinfo_extended (const char *uuid, const char 
*xml);
+
+static gboolean write_sysinfo_extended (const char *uuid)
+{
+    gboolean write_ok;
+    char *sysinfo_extended;
+
+    sysinfo_extended = read_sysinfo_extended_by_uuid (uuid);
+    if (sysinfo_extended == NULL) {
+        g_print ("couldn't read SysInfoExtended from device %s\n", uuid);
+        return FALSE;
+    }
+
+    write_ok = iphone_write_sysinfo_extended (uuid, sysinfo_extended);
+
+    if (!write_ok) {
+        g_print ("couldn't write SysInfoExtended to device %s\n", uuid);
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+int main (int argc, char **argv)
+{
+    if (argc != 2) {
+        g_print ("Usage: %s <uuid>\n", argv[0]);
+        return 1;
+    }
+
+    return write_sysinfo_extended (argv[1]);
+}
+

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to