summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-09-19 15:33:58 +0200
committerGravatar Martin Szulecki2014-09-19 15:33:58 +0200
commit643b47f43e11ed59d674d943b913ad13c7cbaab1 (patch)
tree10d1053b8de48f3365fe095573105a64f327e544 /dev
parent851d665c9686fc9ec847adb8f23d349a25e4e9b6 (diff)
downloadlibimobiledevice-643b47f43e11ed59d674d943b913ad13c7cbaab1.tar.gz
libimobiledevice-643b47f43e11ed59d674d943b913ad13c7cbaab1.tar.bz2
filerelaytest: Print clearer messages to the user and handle new iOS 8 error
Diffstat (limited to 'dev')
-rw-r--r--dev/filerelaytest.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/dev/filerelaytest.c b/dev/filerelaytest.c
index f045620..1069711 100644
--- a/dev/filerelaytest.c
+++ b/dev/filerelaytest.c
@@ -32,24 +32,25 @@ int main(int argc, char **argv)
lockdownd_client_t client = NULL;
lockdownd_service_descriptor_t service = NULL;
file_relay_client_t frc = NULL;
+ file_relay_error_t frc_error = FILE_RELAY_E_SUCCESS;
idevice_connection_t dump = NULL;
const char **sources;
const char *default_sources[] = {"AppleSupport", "Network", "VPN", "WiFi", "UserDatabases", "CrashReporter", "tmp", "SystemConfiguration", NULL};
int i = 0;
if (idevice_new(&dev, NULL) != IDEVICE_E_SUCCESS) {
- printf("no device connected?!\n");
+ printf("No device connected?!\n");
goto leave_cleanup;
}
- printf("connecting...\n");
+ printf("Connecting...\n");
if (lockdownd_client_new_with_handshake(dev, &client, NULL) != LOCKDOWN_E_SUCCESS) {
- printf("could not connect to lockdownd!\n");
+ printf("Could not connect to lockdownd!\n");
goto leave_cleanup;
}
if (lockdownd_start_service(client, FILE_RELAY_SERVICE_NAME, &service) != LOCKDOWN_E_SUCCESS) {
- printf("could not start file_relay service!\n");
+ printf("Could not start file_relay service!\n");
goto leave_cleanup;
}
@@ -59,7 +60,7 @@ int main(int argc, char **argv)
}
if (file_relay_client_new(dev, service, &frc) != FILE_RELAY_E_SUCCESS) {
- printf("could not connect to file_relay service!\n");
+ printf("Could not connect to file_relay service!\n");
goto leave_cleanup;
}
@@ -80,21 +81,38 @@ int main(int argc, char **argv)
sources = default_sources;
}
- printf("Requesting");
+ printf("Requesting ");
i = 0;
while (sources[i]) {
printf(" %s", sources[i]);
i++;
+ if (sources[i])
+ printf(",");
}
printf("\n");
- if (file_relay_request_sources(frc, sources, &dump) != FILE_RELAY_E_SUCCESS) {
- printf("could not get sources\n");
+ frc_error = file_relay_request_sources(frc, sources, &dump);
+ if (frc_error != FILE_RELAY_E_SUCCESS) {
+ printf("Could not request sources.\n");
+ switch (frc_error) {
+ case FILE_RELAY_E_INVALID_SOURCE:
+ printf("At least one of the given sources is invalid and was rejected.\n");
+ break;
+ case FILE_RELAY_E_STAGING_EMPTY:
+ printf("Staging is empty. Perhaps there is no data for the requested sources available.\n");
+ break;
+ case FILE_RELAY_E_PERMISSION_DENIED:
+ printf("Permission denied by device. Possibly missing a signed preferences profile.\n");
+ break;
+ default:
+ printf("An unknown error occoured.\n");
+ break;
+ }
goto leave_cleanup;
}
if (!dump) {
- printf("did not get connection!\n");
+ printf("Did not get connection!\n");
goto leave_cleanup;
}
@@ -107,7 +125,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
setbuf(stdout, NULL);
- printf("receiving ");
+ printf("Receiving ");
while (idevice_connection_receive(dump, buf, 4096, &len) == IDEVICE_E_SUCCESS) {
fwrite(buf, 1, len, f);
cnt += len;
@@ -116,7 +134,7 @@ int main(int argc, char **argv)
}
printf("\n");
fclose(f);
- printf("total size received: %d\n", cnt);
+ printf("Total size received: %d\n", cnt);
leave_cleanup:
if (frc) {