diff options
Diffstat (limited to 'libusbmuxd')
| -rw-r--r-- | libusbmuxd/libusbmuxd.c | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c index 6721fe6..01d67e0 100644 --- a/libusbmuxd/libusbmuxd.c +++ b/libusbmuxd/libusbmuxd.c @@ -70,6 +70,7 @@ static int libusbmuxd_debug = 0;  #define DEBUG(x, y, ...) if (x <= libusbmuxd_debug) fprintf(stderr, (y), __VA_ARGS__);  static int libusbmuxd_initialized = 0; +static int first_lookup = 0;  static struct collection devices;  static int handle_events = 0; @@ -633,6 +634,7 @@ static void *device_monitor(void *data)  	while (handle_events) {  		listenfd = usbmuxd_listen(); +		first_lookup = 1;  		if (listenfd < 0) {  			continue;  		} @@ -665,8 +667,10 @@ int usbmuxd_init()  		mutex_unlock(&init_mutex);  		return res;  	} -	struct timespec ts = {0, 250000000}; -	nanosleep(&ts, NULL); +	struct timespec ts = {0, 100000000}; +	while (!first_lookup) { +		nanosleep(&ts, NULL); +	}  	libusbmuxd_initialized = 1;  	mutex_unlock(&init_mutex);  	return 0; @@ -684,6 +688,7 @@ int usbmuxd_deinit()  		thread_join(devmon);  	}  	libusbmuxd_initialized = 0; +	first_lookup = 0;  	mutex_unlock(&init_mutex);  	return 0;  }  | 
