diff options
| -rw-r--r-- | dev/syslog_relay.c | 5 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 2 | ||||
| -rw-r--r-- | src/iphone.c | 19 | ||||
| -rw-r--r-- | src/iphone.h | 2 | 
4 files changed, 15 insertions, 13 deletions
| diff --git a/dev/syslog_relay.c b/dev/syslog_relay.c index 58a2544..a096101 100644 --- a/dev/syslog_relay.c +++ b/dev/syslog_relay.c @@ -52,6 +52,7 @@ int main(int argc, char *argv[])  	char uuid[41];  	int port = 0;  	uuid[0] = 0; +	uint32_t handle = 0;  	signal(SIGINT, clean_exit);  	signal(SIGQUIT, clean_exit); @@ -111,8 +112,8 @@ int main(int argc, char *argv[])  		lockdownd_client_free(client);  		/* connect to socket relay messages */ -		 -		int sfd = usbmuxd_connect(iphone_get_device_handle(phone), port); +		iphone_device_get_handle(phone, &handle); +		int sfd = usbmuxd_connect(handle, port);  		if (sfd < 0) {  			printf("ERROR: Could not open usbmux connection.\n");  		} else { diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 7974526..61820e0 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -62,7 +62,7 @@ void iphone_set_debug_level(int level);  iphone_error_t iphone_get_device(iphone_device_t *device);  iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid);  iphone_error_t iphone_device_free(iphone_device_t device); -uint32_t iphone_get_device_handle(iphone_device_t device); +iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle);  iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid);  #ifdef __cplusplus diff --git a/src/iphone.c b/src/iphone.c index bdabc35..e694373 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -19,13 +19,12 @@   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA    */ -#include "iphone.h" -#include "utils.h"  #include <stdio.h>  #include <stdlib.h>  #include <string.h> -#include <errno.h> -#include <libiphone/libiphone.h> + +#include "iphone.h" +#include "utils.h"  /**   * Retrieves a list of connected devices from usbmuxd and matches their @@ -95,13 +94,13 @@ iphone_error_t iphone_get_device(iphone_device_t * device)  	return iphone_get_device_by_uuid(device, NULL);  } -uint32_t iphone_get_device_handle(iphone_device_t device) +iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle)  { -	if (device) { -		return device->handle; -	} else { -		return 0; -	} +	if (!device) +		return IPHONE_E_INVALID_ARG; + +	*handle = device->handle; +	return IPHONE_E_SUCCESS;  }  iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) diff --git a/src/iphone.h b/src/iphone.h index 2ed0fba..6e14280 100644 --- a/src/iphone.h +++ b/src/iphone.h @@ -24,6 +24,8 @@  #include <stdint.h> +#include "libiphone/libiphone.h" +  struct iphone_device_int {  	char *buffer;  	uint32_t handle; | 
