summaryrefslogtreecommitdiffstats
path: root/src/normal.c
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-06-20 22:02:18 -0400
committerGravatar Joshua Hill2010-06-21 03:59:31 -0400
commit24afafe06f902bfd9f5652beb8797f24033c68bc (patch)
treec998387441a8e044a07cb3a5ae1282543ddaebad /src/normal.c
parent2a2934ca1568dffe69da9a20420c7c0c71376bce (diff)
downloadidevicerestore-24afafe06f902bfd9f5652beb8797f24033c68bc.tar.gz
idevicerestore-24afafe06f902bfd9f5652beb8797f24033c68bc.tar.bz2
Archived for historical reasons
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/normal.c b/src/normal.c
index b9270d8..7ae4774 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -25,9 +25,49 @@
#include <libimobiledevice/lockdown.h>
#include <libimobiledevice/libimobiledevice.h>
+#include "common.h"
#include "normal.h"
-#include "recovery.h"
-#include "idevicerestore.h"
+//#include "recovery.h"
+
+int normal_client_new(struct normal_client_t** normal) {
+ struct normal_client_t* client = (struct normal_client_t*) malloc(sizeof(struct normal_client_t));
+ if (client == NULL) {
+ error("ERROR: Out of memory\n");
+ return -1;
+ }
+
+ if (normal_open_with_timeout(client) < 0) {
+ normal_client_free(client);
+ return -1;
+ }
+
+ if(normal_check_mode(client) < 0) {
+ normal_client_free(client);
+ return -1;
+ }
+
+ *normal = client;
+ return client;
+}
+
+void normal_client_free(struct idevicerestore_client_t* client) {
+ struct normal_client_t* normal = NULL;
+ if (client) {
+ normal = client->normal;
+ if(normal) {
+ if(normal->client) {
+ lockdownd_client_free(normal->client);
+ normal->client = NULL;
+ }
+ if(normal->device) {
+ idevice_free(normal->device);
+ normal->device = NULL;
+ }
+ }
+ free(normal);
+ client->normal = NULL;
+ }
+}
int normal_check_mode(const char* uuid) {
char* type = NULL;
@@ -106,7 +146,7 @@ int normal_check_device(const char* uuid) {
}
}
- return idevicerestore_devices[i].device_id;
+ return idevicerestore_devices[i].index;
}
int normal_enter_recovery(const char* uuid) {
@@ -162,7 +202,7 @@ int normal_enter_recovery(const char* uuid) {
return -1;
}
- idevicerestore_mode = MODE_RECOVERY;
+ //client->mode = &idevicerestore_modes[MODE_RECOVERY];
irecv_close(recovery);
recovery = NULL;
return 0;