summaryrefslogtreecommitdiffstats
path: root/src/dfu.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-11-07 22:11:57 +0100
committerGravatar Martin Szulecki2012-11-07 22:11:57 +0100
commit3bd16a8b8b79cd9af20260cdbd5d3ac7ee3dbd8b (patch)
tree124ea4690334903f57007fbf5efafd0730b320fb /src/dfu.c
parentb65a7ce7ebca6730fce5dcbfd820d8ef4124e18f (diff)
downloadidevicerestore-3bd16a8b8b79cd9af20260cdbd5d3ac7ee3dbd8b.tar.gz
idevicerestore-3bd16a8b8b79cd9af20260cdbd5d3ac7ee3dbd8b.tar.bz2
change info(), error(), and debug() into functions and allow redirecting the output
Diffstat (limited to 'src/dfu.c')
-rw-r--r--src/dfu.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dfu.c b/src/dfu.c
index 7d5b0eb..1547430 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -27,6 +27,7 @@
#include "dfu.h"
#include "recovery.h"
#include "idevicerestore.h"
+#include "common.h"
int dfu_progress_callback(irecv_client_t client, const irecv_event_t* event) {
if (event->type == IRECV_PROGRESS) {
@@ -108,18 +109,18 @@ int dfu_check_mode(struct idevicerestore_client_t* client, int* mode) {
int dfu_send_buffer(struct idevicerestore_client_t* client, char* buffer, uint32_t size)
{
- irecv_error_t error = 0;
+ irecv_error_t err = 0;
info("Sending data (%d bytes)...\n", size);
- error = irecv_send_buffer(client->dfu->client, buffer, size, 1);
- if (error != IRECV_E_SUCCESS) {
- error("ERROR: Unable to send data: %s\n", irecv_strerror(error));
+ err = irecv_send_buffer(client->dfu->client, buffer, size, 1);
+ if (err != IRECV_E_SUCCESS) {
+ error("ERROR: Unable to send data: %s\n", irecv_strerror(err));
return -1;
}
- error = irecv_reset(client->dfu->client);
- if (error != IRECV_E_SUCCESS) {
+ err = irecv_reset(client->dfu->client);
+ if (err != IRECV_E_SUCCESS) {
error("ERROR: Unable to reset device\n");
irecv_close(client->dfu->client);
client->dfu->client = NULL;
@@ -134,7 +135,7 @@ int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_ide
char* data = NULL;
char* path = NULL;
char* blob = NULL;
- irecv_error_t error = 0;
+ irecv_error_t err = 0;
int flag = 1;
if (client->tss) {
@@ -185,10 +186,10 @@ int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_ide
info("Sending %s (%d bytes)...\n", component, size);
// FIXME: Did I do this right????
- error = irecv_send_buffer(client->dfu->client, data, size, flag);
+ err = irecv_send_buffer(client->dfu->client, data, size, flag);
free(path);
if (error != IRECV_E_SUCCESS) {
- error("ERROR: Unable to send %s component: %s\n", component, irecv_strerror(error));
+ error("ERROR: Unable to send %s component: %s\n", component, irecv_strerror(err));
free(data);
return -1;
}