summaryrefslogtreecommitdiffstats
path: root/src/dfu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dfu.c')
-rw-r--r--src/dfu.c21
1 files changed, 21 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;