summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libirecovery.h2
-rw-r--r--src/irecovery.c3
-rw-r--r--src/libirecovery.c10
3 files changed, 15 insertions, 0 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index c94a3e6..342e99b 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -39,5 +39,7 @@ typedef struct {
int irecv_init(irecv_device** device);
int irecv_open(irecv_device* device);
+int irecv_reset(irecv_device* device);
int irecv_close(irecv_device* device);
int irecv_exit(irecv_device* device);
+
diff --git a/src/irecovery.c b/src/irecovery.c
index dfcf422..90f975b 100644
--- a/src/irecovery.c
+++ b/src/irecovery.c
@@ -49,6 +49,9 @@ int main(int argc, char** argv) {
break;
}
+ printf("Sending USB reset...\n");
+ irecv_reset(device);
+
irecv_exit(device);
return 0;
}
diff --git a/src/libirecovery.c b/src/libirecovery.c
index dfc0aea..cdb0c53 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -78,6 +78,16 @@ int irecv_open(irecv_device* device) {
return IRECV_ERROR_NO_DEVICE;
}
+int irecv_reset(irecv_device* device) {
+ if (device != NULL) {
+ if (device->handle != NULL) {
+ libusb_reset_device(device->handle);
+ }
+ }
+
+ return IRECV_SUCCESS;
+}
+
int irecv_close(irecv_device* device) {
if (device != NULL) {
if (device->handle != NULL) {