diff options
| author | 2010-05-13 12:18:17 +0200 | |
|---|---|---|
| committer | 2010-05-13 12:18:17 +0200 | |
| commit | a2a3537ea24d3cdcc1b210b45695d6eed33ee433 (patch) | |
| tree | fc34f08a62dec1776d23ecfad51b1fdd94fc1132 | |
| parent | 89dcc7a5c123cc8ae8cba5af6682930803989a34 (diff) | |
| download | libirecovery-a2a3537ea24d3cdcc1b210b45695d6eed33ee433.tar.gz libirecovery-a2a3537ea24d3cdcc1b210b45695d6eed33ee433.tar.bz2 | |
Added irecv_reset()
| -rw-r--r-- | include/libirecovery.h | 2 | ||||
| -rw-r--r-- | src/irecovery.c | 3 | ||||
| -rw-r--r-- | src/libirecovery.c | 10 |
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 { | |||
| 39 | 39 | ||
| 40 | int irecv_init(irecv_device** device); | 40 | int irecv_init(irecv_device** device); |
| 41 | int irecv_open(irecv_device* device); | 41 | int irecv_open(irecv_device* device); |
| 42 | int irecv_reset(irecv_device* device); | ||
| 42 | int irecv_close(irecv_device* device); | 43 | int irecv_close(irecv_device* device); |
| 43 | int irecv_exit(irecv_device* device); | 44 | int irecv_exit(irecv_device* device); |
| 45 | |||
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) { | |||
| 49 | break; | 49 | break; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | printf("Sending USB reset...\n"); | ||
| 53 | irecv_reset(device); | ||
| 54 | |||
| 52 | irecv_exit(device); | 55 | irecv_exit(device); |
| 53 | return 0; | 56 | return 0; |
| 54 | } | 57 | } |
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) { | |||
| 78 | return IRECV_ERROR_NO_DEVICE; | 78 | return IRECV_ERROR_NO_DEVICE; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | int irecv_reset(irecv_device* device) { | ||
| 82 | if (device != NULL) { | ||
| 83 | if (device->handle != NULL) { | ||
| 84 | libusb_reset_device(device->handle); | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | return IRECV_SUCCESS; | ||
| 89 | } | ||
| 90 | |||
| 81 | int irecv_close(irecv_device* device) { | 91 | int irecv_close(irecv_device* device) { |
| 82 | if (device != NULL) { | 92 | if (device != NULL) { |
| 83 | if (device->handle != NULL) { | 93 | if (device->handle != NULL) { |
