summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libirecovery.h2
-rw-r--r--src/irecovery.c13
-rw-r--r--src/libirecovery.c11
3 files changed, 10 insertions, 16 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index 9848655..a636813 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -61,7 +61,7 @@ struct irecv_client {
};
const char* irecv_strerror(irecv_error_t error);
-irecv_error_t irecv_open(irecv_client_t* client, const char *uuid);
+irecv_error_t irecv_open(irecv_client_t* client);
irecv_error_t irecv_reset(irecv_client_t client);
irecv_error_t irecv_close(irecv_client_t client);
irecv_error_t irecv_receive(irecv_client_t client);
diff --git a/src/irecovery.c b/src/irecovery.c
index 00db72d..7150f90 100644
--- a/src/irecovery.c
+++ b/src/irecovery.c
@@ -119,7 +119,7 @@ void append_command_to_history(char* cmd) {
void init_shell(irecv_client_t client) {
irecv_error_t error = 0;
- load_command_history();
+ //load_command_history();
irecv_set_sender(client, &send_callback);
irecv_set_receiver(client, &recv_callback);
while(!quit) {
@@ -136,7 +136,7 @@ void init_shell(irecv_client_t client) {
quit = 1;
}
- append_command_to_history(cmd);
+ //append_command_to_history(cmd);
free(cmd);
}
}
@@ -160,10 +160,9 @@ int main(int argc, char** argv) {
int opt = 0;
int action = 0;
char* argument = NULL;
- char *uuid = NULL;
irecv_error_t error = 0;
if(argc == 1) print_usage();
- while ((opt = getopt(argc, argv, "vhru:sc:f:")) > 0) {
+ while ((opt = getopt(argc, argv, "vhrsc:f:")) > 0) {
switch (opt) {
case 'v':
verbose += 1;
@@ -173,10 +172,6 @@ int main(int argc, char** argv) {
print_usage();
break;
- case 'u':
- uuid = optarg;
- break;
-
case 'r':
action = kResetDevice;
break;
@@ -205,7 +200,7 @@ int main(int argc, char** argv) {
for(i = 0; i <= 5; i++) {
debug("Attempting to connect... \n");
- if(irecv_open(&client, uuid) != IRECV_E_SUCCESS) sleep(1);
+ if(irecv_open(&client) != IRECV_E_SUCCESS) sleep(1);
else break;
if(i == 5) {
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 131032c..f4d1cca 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -30,7 +30,7 @@
int irecv_default_sender(irecv_client_t client, unsigned char* data, int size);
int irecv_default_receiver(irecv_client_t client, unsigned char* data, int size);
-irecv_error_t irecv_open(irecv_client_t* pclient, const char* uuid) {
+irecv_error_t irecv_open(irecv_client_t* pclient) {
int i = 0;
char serial[256];
struct libusb_device* usb_device = NULL;
@@ -63,16 +63,15 @@ irecv_error_t irecv_open(irecv_client_t* pclient, const char* uuid) {
}
libusb_set_debug(usb_context, 3);
- /* identified a valid recovery device */
- libusb_free_device_list(usb_device_list, 1);
+ libusb_free_device_list(usb_device_list, 0);
- irecv_client_t client = (irecv_client_t) malloc(sizeof(irecv_client_t));
+ irecv_client_t client = (irecv_client_t) malloc(sizeof(struct irecv_client));
if (client == NULL) {
libusb_close(usb_handle);
libusb_exit(usb_context);
return IRECV_E_OUT_OF_MEMORY;
}
- memset(client, '\0', sizeof(irecv_client_t));
+ memset(client, '\0', sizeof(struct irecv_client));
client->interface = -1;
client->handle = usb_handle;
client->context = usb_context;
@@ -154,7 +153,7 @@ irecv_error_t irecv_close(irecv_client_t client) {
}
if (client->context != NULL) {
- libusb_exit(client->context);
+ libusb_exit(NULL);
client->context = NULL;
}