diff options
author | 2024-01-09 02:02:20 +0100 | |
---|---|---|
committer | 2024-01-09 02:02:20 +0100 | |
commit | 33bdb731adb4f2309ecff1815d4df8d7b80084d4 (patch) | |
tree | 5abf9035482e3f9cbb1f414fe554bbbfda9ca187 | |
parent | dd52fcee588518ba0910844579cdb58af13e6bab (diff) | |
download | libirecovery-33bdb731adb4f2309ecff1815d4df8d7b80084d4.tar.gz libirecovery-33bdb731adb4f2309ecff1815d4df8d7b80084d4.tar.bz2 |
irecovery: Print a message for unsupported commands in Debug USB (KIS) mode
-rw-r--r-- | tools/irecovery.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/irecovery.c b/tools/irecovery.c index 5546ac2..6303b55 100644 --- a/tools/irecovery.c +++ b/tools/irecovery.c | |||
@@ -584,6 +584,8 @@ int main(int argc, char* argv[]) | |||
584 | if (device) | 584 | if (device) |
585 | debug("Connected to %s, model %s, cpid 0x%04x, bdid 0x%02x\n", device->product_type, device->hardware_model, device->chip_id, device->board_id); | 585 | debug("Connected to %s, model %s, cpid 0x%04x, bdid 0x%02x\n", device->product_type, device->hardware_model, device->chip_id, device->board_id); |
586 | 586 | ||
587 | const struct irecv_device_info *devinfo = irecv_get_device_info(client); | ||
588 | |||
587 | switch (action) { | 589 | switch (action) { |
588 | case kResetDevice: | 590 | case kResetDevice: |
589 | irecv_reset(client); | 591 | irecv_reset(client); |
@@ -596,6 +598,10 @@ int main(int argc, char* argv[]) | |||
596 | break; | 598 | break; |
597 | 599 | ||
598 | case kSendCommand: | 600 | case kSendCommand: |
601 | if (devinfo->pid == 0x1881) { | ||
602 | printf("Shell is not available in Debug USB (KIS) mode.\n"); | ||
603 | break; | ||
604 | } | ||
599 | if (_is_breq_command(argument)) { | 605 | if (_is_breq_command(argument)) { |
600 | error = irecv_send_command_breq(client, argument, 1); | 606 | error = irecv_send_command_breq(client, argument, 1); |
601 | } else { | 607 | } else { |
@@ -605,6 +611,10 @@ int main(int argc, char* argv[]) | |||
605 | break; | 611 | break; |
606 | 612 | ||
607 | case kSendExploit: | 613 | case kSendExploit: |
614 | if (devinfo->pid == 0x1881) { | ||
615 | printf("Shell is not available in Debug USB (KIS) mode.\n"); | ||
616 | break; | ||
617 | } | ||
608 | if (argument != NULL) { | 618 | if (argument != NULL) { |
609 | irecv_event_subscribe(client, IRECV_PROGRESS, &progress_cb, NULL); | 619 | irecv_event_subscribe(client, IRECV_PROGRESS, &progress_cb, NULL); |
610 | error = irecv_send_file(client, argument, 0); | 620 | error = irecv_send_file(client, argument, 0); |
@@ -618,10 +628,18 @@ int main(int argc, char* argv[]) | |||
618 | break; | 628 | break; |
619 | 629 | ||
620 | case kStartShell: | 630 | case kStartShell: |
631 | if (devinfo->pid == 0x1881) { | ||
632 | printf("This feature is not supported in Debug USB (KIS) mode.\n"); | ||
633 | break; | ||
634 | } | ||
621 | init_shell(client); | 635 | init_shell(client); |
622 | break; | 636 | break; |
623 | 637 | ||
624 | case kSendScript: | 638 | case kSendScript: |
639 | if (devinfo->pid == 0x1881) { | ||
640 | printf("This feature is not supported in Debug USB (KIS) mode.\n"); | ||
641 | break; | ||
642 | } | ||
625 | buffer_read_from_filename(argument, &buffer, &buffer_length); | 643 | buffer_read_from_filename(argument, &buffer, &buffer_length); |
626 | if (buffer) { | 644 | if (buffer) { |
627 | buffer[buffer_length] = '\0'; | 645 | buffer[buffer_length] = '\0'; |
@@ -638,7 +656,6 @@ int main(int argc, char* argv[]) | |||
638 | break; | 656 | break; |
639 | 657 | ||
640 | case kShowMode: { | 658 | case kShowMode: { |
641 | const struct irecv_device_info *devinfo = irecv_get_device_info(client); | ||
642 | irecv_get_mode(client, &mode); | 659 | irecv_get_mode(client, &mode); |
643 | printf("%s Mode", mode_to_str(mode)); | 660 | printf("%s Mode", mode_to_str(mode)); |
644 | if (devinfo->pid == 0x1881) { | 661 | if (devinfo->pid == 0x1881) { |
@@ -648,6 +665,10 @@ int main(int argc, char* argv[]) | |||
648 | break; | 665 | break; |
649 | } | 666 | } |
650 | case kRebootToNormalMode: | 667 | case kRebootToNormalMode: |
668 | if (devinfo->pid == 0x1881) { | ||
669 | printf("This feature is not supported in Debug USB (KIS) mode.\n"); | ||
670 | break; | ||
671 | } | ||
651 | error = irecv_setenv(client, "auto-boot", "true"); | 672 | error = irecv_setenv(client, "auto-boot", "true"); |
652 | if (error != IRECV_E_SUCCESS) { | 673 | if (error != IRECV_E_SUCCESS) { |
653 | debug("%s\n", irecv_strerror(error)); | 674 | debug("%s\n", irecv_strerror(error)); |