diff options
author | Nikias Bassen | 2015-10-09 03:05:21 +0200 |
---|---|---|
committer | Nikias Bassen | 2015-10-09 03:05:21 +0200 |
commit | 46ead9b3afd6e79fa05a391b94bc929e94101e33 (patch) | |
tree | d889975ee080fcd204cc408aa50a17205728c356 /src/normal.c | |
parent | 54d97a24791dfa879dc2c47092e99e234ecb2952 (diff) | |
download | idevicerestore-46ead9b3afd6e79fa05a391b94bc929e94101e33.tar.gz idevicerestore-46ead9b3afd6e79fa05a391b94bc929e94101e33.tar.bz2 |
Use hardware model instead of product type to identify device correctly
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/src/normal.c b/src/normal.c index 0ca2dff..e019957 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2,7 +2,7 @@ * normal.h * Functions for handling idevices in normal mode * - * Copyright (c) 2012-2013 Nikias Bassen. All Rights Reserved. + * Copyright (c) 2012-2015 Nikias Bassen. All Rights Reserved. * Copyright (c) 2012 Martin Szulecki. All Rights Reserved. * Copyright (c) 2010 Joshua Hill. All Rights Reserved. * @@ -218,7 +218,7 @@ int normal_open_with_timeout(struct idevicerestore_client_t* client) { return 0; } -const char* normal_check_product_type(struct idevicerestore_client_t* client) { +const char* normal_check_hardware_model(struct idevicerestore_client_t* client) { idevice_t device = NULL; char* product_type = NULL; irecv_device_t irecv_device = NULL; @@ -247,9 +247,6 @@ const char* normal_check_product_type(struct idevicerestore_client_t* client) { plist_get_string_val(pval, &strval); if (strval) { irecv_devices_get_device_by_hardware_model(strval, &irecv_device); - if (irecv_device) { - product_type = strdup(irecv_device->product_type); - } free(strval); } } @@ -257,44 +254,7 @@ const char* normal_check_product_type(struct idevicerestore_client_t* client) { plist_free(pval); } - if (product_type == NULL) { - lockdown_error = lockdownd_get_value(lockdown, NULL, "ProductType", &product_type_node); - if (lockdown_error != LOCKDOWN_E_SUCCESS) { - lockdownd_client_free(lockdown); - idevice_free(device); - return product_type; - } - } - - lockdownd_client_free(lockdown); - idevice_free(device); - lockdown = NULL; - device = NULL; - - if (irecv_device) { - if (product_type) - free(product_type); - - return irecv_device->product_type; - } - - if (product_type_node != NULL) { - if (!product_type_node || plist_get_node_type(product_type_node) != PLIST_STRING) { - if (product_type_node) - plist_free(product_type_node); - return product_type; - } - plist_get_string_val(product_type_node, &product_type); - plist_free(product_type_node); - - irecv_devices_get_device_by_product_type(product_type, &irecv_device); - if (irecv_device && irecv_device->product_type) { - free(product_type); - return irecv_device->product_type; - } - } - - return product_type; + return (irecv_device) ? irecv_device->hardware_model : NULL; } int normal_enter_recovery(struct idevicerestore_client_t* client) { |