summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-09-26 09:48:26 +0200
committerGravatar Martin Szulecki2013-09-26 09:48:26 +0200
commitafb8735176869db20219c35a341e89158651bffe (patch)
treea46dd916ab836b209f8c89465bc9294e57c6f72f
parent8dffdecf8fd5a080265b9b35e00091961bfd8648 (diff)
downloadlibirecovery-afb8735176869db20219c35a341e89158651bffe.tar.gz
libirecovery-afb8735176869db20219c35a341e89158651bffe.tar.bz2
Revert changes to return errors when sending commands, getenv or getret
This fixes software which did not expect to receive an error after sending specific commands. Sending "go" for instance returned a connection reset error which was interpreted as "could not send command" while this behavior is completely correct. This also fixes idevicerestore's "Unable to send iBEC" problems.
-rw-r--r--src/libirecovery.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index e82bce2..7aebc32 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -822,18 +822,16 @@ void irecv_set_debug_level(int level) {
}
static irecv_error_t irecv_send_command_raw(irecv_client_t client, const char* command) {
- int ret = 0;
-
unsigned int length = strlen(command);
if (length >= 0x100) {
length = 0xFF;
}
if (length > 0) {
- ret = irecv_control_transfer(client, 0x40, 0, 0, 0, (unsigned char*) command, length + 1, USB_TIMEOUT);
+ irecv_control_transfer(client, 0x40, 0, 0, 0, (unsigned char*) command, length + 1, USB_TIMEOUT);
}
- return ((unsigned)ret == (length + 1) ? IRECV_E_SUCCESS: IRECV_E_UNKNOWN_ERROR);
+ return IRECV_E_SUCCESS;
}
irecv_error_t irecv_send_command(irecv_client_t client, const char* command) {
@@ -1077,7 +1075,6 @@ irecv_error_t irecv_receive(irecv_client_t client) {
}
irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** value) {
- int ret = 0;
char command[256];
if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE;
*value = NULL;
@@ -1102,15 +1099,14 @@ irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** v
}
memset(response, '\0', 256);
- ret = irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT);
+ irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT);
*value = response;
- return (ret > 0 ? IRECV_E_SUCCESS: IRECV_E_UNKNOWN_ERROR);
+ return IRECV_E_SUCCESS;
}
irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) {
- int ret = 0;
if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE;
*value = 0;
@@ -1120,11 +1116,11 @@ irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) {
}
memset(response, '\0', 256);
- ret = irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT);
+ irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT);
*value = (unsigned int) *response;
- return (ret > 0 ? IRECV_E_SUCCESS: IRECV_E_UNKNOWN_ERROR);
+ return IRECV_E_SUCCESS;
}
irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) {