diff options
author | Martin Szulecki | 2009-05-24 14:44:28 +0200 |
---|---|---|
committer | Martin Szulecki | 2009-05-24 14:44:28 +0200 |
commit | 735a3ab42d92a65a39ea6918aeb1ab784cad0da7 (patch) | |
tree | 15973568585031e4244b3a8863503767e4420fa4 /src | |
parent | 36ea32e0064f33d6a285684c3069f4d75bbac7a8 (diff) | |
parent | 7272875df87f1feb2c16259880503812f6acbbf1 (diff) | |
download | libimobiledevice-735a3ab42d92a65a39ea6918aeb1ab784cad0da7.tar.gz libimobiledevice-735a3ab42d92a65a39ea6918aeb1ab784cad0da7.tar.bz2 |
Merge branch 'master' of git://github.com/MattColyer/libiphone into martin
Diffstat (limited to 'src')
-rw-r--r-- | src/iphone.c | 14 | ||||
-rw-r--r-- | src/iphone.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/iphone.c b/src/iphone.c index 9551173..0e179e7 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -43,6 +43,7 @@ iphone_error_t iphone_get_device_by_uuid(iphone_device_t * device, const char *u { iphone_device_t phone; uint32_t handle = 0; + char *serial_number = malloc(41); usbmuxd_scan_result *dev_list = NULL; int i; @@ -53,12 +54,14 @@ iphone_error_t iphone_get_device_by_uuid(iphone_device_t * device, const char *u if (!uuid) { // select first device found if no UUID specified handle = dev_list[0].handle; + strcpy(serial_number, dev_list[0].serial_number); } else { // otherwise walk through the list for (i = 0; dev_list[i].handle > 0; i++) { log_debug_msg("%s: device handle=%d, uuid=%s\n", __func__, dev_list[i].handle, dev_list[i].serial_number); if (strcasecmp(uuid, dev_list[i].serial_number) == 0) { handle = dev_list[i].handle; + strcpy(serial_number, dev_list[i].serial_number); break; } } @@ -68,6 +71,7 @@ iphone_error_t iphone_get_device_by_uuid(iphone_device_t * device, const char *u if (handle > 0) { phone = (iphone_device_t) malloc(sizeof(struct iphone_device_int)); phone->handle = handle; + phone->serial_number = serial_number; *device = phone; return IPHONE_E_SUCCESS; } @@ -100,6 +104,15 @@ uint32_t iphone_get_device_handle(iphone_device_t device) } } +char* iphone_get_uuid(iphone_device_t device) +{ + if (device) { + return device->serial_number; + } else { + return NULL; + } +} + /** Cleans up an iPhone structure, then frees the structure itself. * This is a library-level function; deals directly with the iPhone to tear * down relations, but otherwise is mostly internal. @@ -114,6 +127,7 @@ iphone_error_t iphone_free_device(iphone_device_t device) ret = IPHONE_E_SUCCESS; + free(device->serial_number); free(device); return ret; } diff --git a/src/iphone.h b/src/iphone.h index 94d2f9f..2ed0fba 100644 --- a/src/iphone.h +++ b/src/iphone.h @@ -27,6 +27,7 @@ struct iphone_device_int { char *buffer; uint32_t handle; + char *serial_number; }; #endif |