mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
add --device-info
This commit is contained in:
4 files changed
+67
-8
No files matched your search
@@ -80,6 +80,7 @@
|
||||
#define host_option_exit_recovery (1 << 7) /* Exit recovery mode */
|
||||
#define host_option_reboot_device (1 << 8) /* Reboot device in normal mode */
|
||||
#define host_option_enter_recovery (1 << 9) /* Enter recovery mode */
|
||||
#define host_option_device_info (1 << 10) /* Print device info */
|
||||
|
||||
#define PALEINFO_MAGIC 'PLSH'
|
||||
#define PALEINFO_CIGAM 'HSLP'
|
||||
|
||||
+53
-4
@@ -59,7 +59,8 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
||||
return -1;
|
||||
}
|
||||
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
||||
unsigned char passcode_state = 0;
|
||||
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
||||
if (ret != 0) {
|
||||
@@ -69,11 +70,25 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
||||
}
|
||||
if (passcode_state) {
|
||||
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
||||
LOG(LOG_ERROR, "Additionally, passcode must never be set since restore on iOS 16+");
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_ERROR, "Additionally, passcode must never be set since restore on iOS 16+");
|
||||
devinfo_free(&dev);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
||||
printf("Mode: normal\n");
|
||||
printf("ProductType: %s\n", dev.productType);
|
||||
printf("Architecture: %s\n", dev.CPUArchitecture);
|
||||
printf("Version: %s\n", dev.productVersion);
|
||||
printf("DisplayName: %s\n", dev.displayName);
|
||||
|
||||
device_has_booted = true;
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
return 0;
|
||||
}
|
||||
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
|
||||
enter_recovery_cmd(usbmuxd_device->udid);
|
||||
devinfo_free(&dev);
|
||||
@@ -184,7 +199,8 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
||||
switch(event->type) {
|
||||
case IRECV_DEVICE_ADD:
|
||||
if (event->mode == IRECV_K_RECOVERY_MODE_1 || event->mode == IRECV_K_RECOVERY_MODE_2 || event->mode == IRECV_K_RECOVERY_MODE_3 || event->mode == IRECV_K_RECOVERY_MODE_4) {
|
||||
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
||||
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
|
||||
exitrecv_cmd(event->device_info->ecid);
|
||||
LOG(LOG_INFO, "Exited recovery mode");
|
||||
@@ -195,11 +211,44 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
||||
pthread_exit(NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
||||
recvinfo_t info;
|
||||
recvinfo_cmd(&info, event->device_info->ecid);
|
||||
printf("Mode: recovery\n");
|
||||
printf("ProductType: %s\n", info.product_type);
|
||||
printf("DisplayName: %s\n", info.display_name);
|
||||
|
||||
device_has_booted = true;
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||
pthread_exit(NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
||||
checkrain_option_enabled(host_flags, host_option_reboot_device)) return;
|
||||
pthread_create(&recovery_thread, NULL, (void* (*)(void*))connected_recovery_mode, event->device_info);
|
||||
} else if (event->mode == IRECV_K_DFU_MODE) {
|
||||
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
|
||||
|
||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
||||
recvinfo_t info;
|
||||
recvinfo_cmd(&info, event->device_info->ecid);
|
||||
printf("Mode: dfu\n");
|
||||
printf("ProductType: %s\n", info.product_type);
|
||||
printf("DisplayName: %s\n", info.display_name);
|
||||
|
||||
device_has_booted = true;
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||
pthread_exit(NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (
|
||||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
|
||||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
||||
|
||||
+6
-2
@@ -98,8 +98,9 @@ int palera1n(int argc, char *argv[]) {
|
||||
pthread_mutex_init(&found_pongo_mutex, NULL);
|
||||
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
|
||||
if ((ret = build_checks())) return ret;
|
||||
print_credits();
|
||||
if ((ret = optparse(argc, argv))) goto cleanup;
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
print_credits();
|
||||
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
|
||||
#ifdef DEV_BUILD
|
||||
if (checkrain_option_enabled(host_flags, host_option_tui)) {
|
||||
@@ -108,7 +109,9 @@ int palera1n(int argc, char *argv[]) {
|
||||
else goto normal_exit;
|
||||
}
|
||||
#endif
|
||||
LOG(LOG_INFO, "Waiting for devices");
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_INFO, "Waiting for devices");
|
||||
|
||||
pthread_create(&pongo_thread, NULL, pongo_helper, NULL);
|
||||
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
||||
pthread_join(dfuhelper_thread, NULL);
|
||||
@@ -117,6 +120,7 @@ int palera1n(int argc, char *argv[]) {
|
||||
checkrain_option_enabled(host_flags, host_option_reboot_device) ||
|
||||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
|
||||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
||||
checkrain_option_enabled(host_flags, host_option_device_info) ||
|
||||
device_has_booted)
|
||||
goto normal_exit;
|
||||
if (exec_checkra1n()) goto cleanup;
|
||||
|
||||
+7
-2
@@ -41,6 +41,7 @@ static struct option longopts[] = {
|
||||
{"reboot-device", no_argument, NULL, 'R'},
|
||||
{"exit-recovery", no_argument, NULL, 'n'},
|
||||
{"enter-recovery", no_argument, NULL, 'E'},
|
||||
{"device-info", no_argument, NULL, 'I'},
|
||||
#ifdef DEV_BUILD
|
||||
{"test1", no_argument, NULL, '1'},
|
||||
{"test2", no_argument, NULL, '2'},
|
||||
@@ -80,6 +81,7 @@ static int usage(int e, char* prog_name)
|
||||
"\t-l, --rootless\t\t\t\tBoots rootless. This is the default\n"
|
||||
"\t-L, --jbinit-log-to-file\t\tMake jbinit log to /cores/jbinit.log (can be read from sandbox while jailbroken)\n"
|
||||
"\t-n, --exit-recovery\t\t\tExit recovery mode\n"
|
||||
"\t-I, --device-info\t\t\tPrint info about the connected device\n"
|
||||
"\t-o, --override-overlay <file>\t\tOverride overlay\n"
|
||||
"\t-O, --disable-ohio\t\t\tDisable Ohio\n"
|
||||
"\t-p, --pongo-shell\t\t\tBoots to PongoOS shell\n"
|
||||
@@ -106,9 +108,9 @@ int optparse(int argc, char* argv[]) {
|
||||
int index;
|
||||
while ((opt = getopt_long(argc, argv,
|
||||
#ifdef DEV_BUILD
|
||||
"12BcDEhpvVldsOLftRnPe:o:r:K:k:i:",
|
||||
"12BcDEhpvVldsOLftRnPIe:o:r:K:k:i:",
|
||||
#else
|
||||
"BcDEhpvVldsOLfRnPe:o:r:K:k:i:",
|
||||
"BcDEhpvVldsOLfRnPIe:o:r:K:k:i:",
|
||||
#endif
|
||||
longopts, NULL)) != -1)
|
||||
{
|
||||
@@ -222,6 +224,9 @@ int optparse(int argc, char* argv[]) {
|
||||
case 'O':
|
||||
host_flags |= host_option_no_ohio;
|
||||
break;
|
||||
case 'I':
|
||||
host_flags |= host_option_device_info;
|
||||
break;
|
||||
#ifdef DEV_BUILD
|
||||
case 't':
|
||||
host_flags |= host_option_tui;
|
||||
|
||||
Reference in new issue
Block a user