commit b94fa480f77e767fd2d6137922b30759a6a799ec
Author: Nikias Bassen <nik...@gmx.li>
Date:   Mon Apr 5 20:14:57 2010 +0200

    ipod-lockdown: wait up to 10 seconds for usbmuxd to start up
    
    iphone-set-info (or libgpod-callout) fails if usbmuxd is not exposing
    any devices fast enough. Since usbmuxd itself needs some time to start
    up we give the callout program a bit more time to find the device.

 tools/ipod-lockdown.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/tools/ipod-lockdown.c b/tools/ipod-lockdown.c
index 2e40533..e5508a8 100644
--- a/tools/ipod-lockdown.c
+++ b/tools/ipod-lockdown.c
@@ -48,7 +48,20 @@ read_sysinfo_extended_by_uuid (const char *uuid)
        plist_t value = NULL;
        plist_t global = NULL;
        plist_t ptr = NULL;
-       ret = idevice_new(&device, uuid);
+       int cnt = 0;
+
+       /* usbmuxd needs some time to start up so we try several times
+        * to open the device before finally returning with an error */ 
+       while (cnt++ < 20) {
+               ret = idevice_new(&device, uuid);
+               if (ret == IDEVICE_E_SUCCESS) {
+                       break;
+               }
+               if (ret != IDEVICE_E_NO_DEVICE) {
+                       break;
+               }
+               g_usleep (G_USEC_PER_SEC / 2);
+       }
        if (ret != IDEVICE_E_SUCCESS) {
                printf("No device found with uuid %s, is it plugged in?\n", 
uuid);
                return NULL;

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to