summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-01-09 15:13:33 +0100
committerGravatar Martin Szulecki2013-01-09 15:17:42 +0100
commitb82fcb5e6190183179673a92f487b37f3b9cc5f1 (patch)
tree7b8e2270005378d28d250b31996110361971e195
parentc2a143f02e1181429d0f486a787df25038b2a3d1 (diff)
downloadidevicerestore-b82fcb5e6190183179673a92f487b37f3b9cc5f1.tar.gz
idevicerestore-b82fcb5e6190183179673a92f487b37f3b9cc5f1.tar.bz2
dfu: Implement dfu_check_device() helper
-rw-r--r--src/dfu.c21
-rw-r--r--src/dfu.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/dfu.c b/src/dfu.c
index 895a347..e93030a 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -107,6 +107,27 @@ int dfu_check_mode(struct idevicerestore_client_t* client, int* mode) {
return 0;
}
+int dfu_check_device(struct idevicerestore_client_t* client) {
+ irecv_client_t dfu = NULL;
+ irecv_error_t dfu_error = IRECV_E_SUCCESS;
+ irecv_device_t device = NULL;
+
+ irecv_init();
+ dfu_error = irecv_open(&dfu, client->ecid);
+ if (dfu_error != IRECV_E_SUCCESS) {
+ return -1;
+ }
+
+ dfu_error = irecv_get_device(dfu, &device);
+ if (dfu_error != IRECV_E_SUCCESS) {
+ return -1;
+ }
+
+ irecv_close(dfu);
+
+ return device->index;
+}
+
int dfu_send_buffer(struct idevicerestore_client_t* client, char* buffer, uint32_t size)
{
irecv_error_t err = 0;
diff --git a/src/dfu.h b/src/dfu.h
index 8df31f3..2d4627c 100644
--- a/src/dfu.h
+++ b/src/dfu.h
@@ -38,6 +38,7 @@ struct dfu_client_t {
int dfu_client_new(struct idevicerestore_client_t* client);
void dfu_client_free(struct idevicerestore_client_t* client);
int dfu_check_mode(struct idevicerestore_client_t* client, int* mode);
+int dfu_check_device(struct idevicerestore_client_t* client);
int dfu_send_buffer(struct idevicerestore_client_t* client, char* buffer, uint32_t size);
int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_identity, const char* component);
int dfu_get_cpid(struct idevicerestore_client_t* client, unsigned int* cpid);