diff options
author | Nikias Bassen | 2022-10-11 12:38:28 +0200 |
---|---|---|
committer | Nikias Bassen | 2022-10-11 12:38:28 +0200 |
commit | d526c74e0562f7991bde3ec7d156cbf8b0b10bd5 (patch) | |
tree | 70a793311e482b0293fb4f0d014c2636e36af614 /tools | |
parent | 0fe2ca4077fef9fda050ace39b549f63d3043462 (diff) | |
download | libirecovery-d526c74e0562f7991bde3ec7d156cbf8b0b10bd5.tar.gz libirecovery-d526c74e0562f7991bde3ec7d156cbf8b0b10bd5.tar.bz2 |
irecovery: Make sure to send certain commands with bRequest set to 1
Diffstat (limited to 'tools')
-rw-r--r-- | tools/irecovery.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/irecovery.c b/tools/irecovery.c index 392f912..faf0a92 100644 --- a/tools/irecovery.c +++ b/tools/irecovery.c @@ -199,6 +199,16 @@ static void print_devices() { } } +static int _is_breq_command(const char* cmd) +{ + return ( + !strcmp(cmd, "go") + || !strcmp(cmd, "bootx") + || !strcmp(cmd, "reboot") + || !strcmp(cmd, "memboot") + ); +} + static void parse_command(irecv_client_t client, unsigned char* command, unsigned int size) { char* cmd = strdup((char*)command); char* action = strtok(cmd, " "); @@ -269,7 +279,11 @@ static void init_shell(irecv_client_t client) { char* cmd = readline("> "); if (cmd && *cmd) { - error = irecv_send_command(client, cmd); + if (_is_breq_command(cmd)) { + error = irecv_send_command_breq(client, cmd, 1); + } else { + error = irecv_send_command(client, cmd); + } if (error != IRECV_E_SUCCESS) { quit = 1; } @@ -560,7 +574,11 @@ int main(int argc, char* argv[]) { break; case kSendCommand: - error = irecv_send_command(client, argument); + if (_is_breq_command(argument)) { + error = irecv_send_command_breq(client, argument, 1); + } else { + error = irecv_send_command(client, argument); + } debug("%s\n", irecv_strerror(error)); break; |