1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
From d71c6108901460842de25012d5ece727a0c70d27 Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Tue, 11 Jun 2013 11:33:23 +0000
Subject: afc: Update to libimobiledevice new api
https://bugzilla.redhat.com/show_bug.cgi?id=951731
https://bugzilla.gnome.org/show_bug.cgi?id=702577
---
diff --git a/configure.ac b/configure.ac
index 12dbdcd..2846d82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,14 +372,11 @@ AFC_LIBS=
AFC_CFLAGS=
if test "x$enable_afc" != "xno" ; then
- PKG_CHECK_EXISTS(libimobiledevice-1.0 >= 1.1.0 libplist >= 0.15, msg_afc=yes)
+ PKG_CHECK_EXISTS(libimobiledevice-1.0 >= 1.1.5 libplist >= 0.15, msg_afc=yes)
if test "x$msg_afc" = "xyes"; then
PKG_CHECK_MODULES(AFC, libimobiledevice-1.0 libplist)
AC_DEFINE(HAVE_AFC, 1, [Define to 1 if AFC is going to be built])
- PKG_CHECK_EXISTS(libimobiledevice-1.0 >= 1.1.2,
- [AC_DEFINE(HAVE_LIBIMOBILEDEVICE_1_1_2, 1,
- [Define to 1 if libimobiledevice-1.1.2 found])])
fi
fi
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index ab4a9ce..6b0b64f 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -349,12 +349,7 @@ _idevice_event_cb (const idevice_event_t *event, void *user_data)
if (event->event != IDEVICE_DEVICE_REMOVE)
return;
-#ifdef HAVE_LIBIMOBILEDEVICE_1_1_2
event_udid = event->udid;
-#else
- event_udid = event->uuid;
-#endif
-
if (g_str_equal (event_udid, afc_backend->uuid) == FALSE)
return;
@@ -401,7 +396,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
const char *str;
char *tmp;
char *display_name = NULL;
- guint16 port;
+ lockdownd_service_descriptor_t lockdown_service = NULL;
int virtual_port;
GMountSpec *real_spec;
GVfsBackendAfc *self;
@@ -414,6 +409,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
char **dcim_afcinfo;
plist_t value;
lockdownd_error_t lerr;
+ afc_error_t aerr;
const gchar *choices[] = {_("Try again"), _("Cancel"), NULL}; /* keep in sync with the enum above */
gboolean aborted = FALSE;
gchar *message = NULL;
@@ -649,41 +645,38 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
switch (self->mode) {
case ACCESS_MODE_AFC:
- lerr = lockdownd_start_service (lockdown_cli, self->service, &port);
+ lerr = lockdownd_start_service (lockdown_cli, self->service, &lockdown_service);
if (G_UNLIKELY(g_vfs_backend_lockdownd_check (lerr, G_VFS_JOB(job))))
{
goto out_destroy_lockdown;
}
- if (G_UNLIKELY(g_vfs_backend_afc_check (afc_client_new (self->dev,
- port, &self->afc_cli),
- G_VFS_JOB(job))))
+ aerr = afc_client_new (self->dev, lockdown_service, &self->afc_cli);
+ if (G_UNLIKELY(g_vfs_backend_afc_check (aerr, G_VFS_JOB(job))))
{
goto out_destroy_lockdown;
}
break;
case ACCESS_MODE_HOUSE_ARREST:
- lerr = lockdownd_start_service (lockdown_cli, "com.apple.mobile.installation_proxy", &port);
+ lerr = lockdownd_start_service (lockdown_cli, "com.apple.mobile.installation_proxy", &lockdown_service);
if (G_UNLIKELY(g_vfs_backend_lockdownd_check (lerr, G_VFS_JOB(job))))
{
g_warning ("couldn't start inst proxy");
goto out_destroy_lockdown;
}
- if (G_UNLIKELY(g_vfs_backend_inst_check (instproxy_client_new (self->dev,
- port, &self->inst),
- G_VFS_JOB(job))))
+ aerr = instproxy_client_new (self->dev, lockdown_service, &self->inst);
+ if (G_UNLIKELY(g_vfs_backend_inst_check (aerr, G_VFS_JOB(job))))
{
g_warning ("couldn't create inst proxy instance");
goto out_destroy_lockdown;
}
- lerr = lockdownd_start_service (lockdown_cli, "com.apple.springboardservices", &port);
+ lerr = lockdownd_start_service (lockdown_cli, "com.apple.springboardservices", &lockdown_service);
if (G_UNLIKELY(g_vfs_backend_lockdownd_check (lerr, G_VFS_JOB(job))))
{
g_warning ("couldn't start SBServices proxy");
goto out_destroy_lockdown;
}
- if (G_UNLIKELY(g_vfs_backend_sbs_check (sbservices_client_new (self->dev,
- port, &self->sbs),
- G_VFS_JOB(job))))
+ aerr = sbservices_client_new (self->dev, lockdown_service, &self->sbs);
+ if (G_UNLIKELY(g_vfs_backend_sbs_check (aerr, G_VFS_JOB(job))))
{
g_warning ("couldn't create SBServices proxy instance");
goto out_destroy_lockdown;
@@ -705,6 +698,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
/* lockdown connection is not needed anymore */
lockdownd_client_free (lockdown_cli);
+ lockdownd_service_descriptor_free (lockdown_service);
/* Add camera item if necessary */
if (self->mode == ACCESS_MODE_AFC)
@@ -723,6 +717,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
out_destroy_lockdown:
lockdownd_client_free (lockdown_cli);
+ lockdownd_service_descriptor_free (lockdown_service);
out_destroy_dev:
idevice_free (self->dev);
@@ -794,10 +789,11 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
{
AppInfo *info;
lockdownd_client_t lockdown_cli;
- guint16 port;
+ lockdownd_service_descriptor_t lockdown_service = NULL;
house_arrest_client_t house_arrest;
afc_client_t afc;
plist_t dict, error;
+ lockdownd_error_t lerr;
info = g_hash_table_lookup (self->apps, id);
@@ -812,7 +808,8 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
g_warning ("Failed to get a lockdown to start house arrest for app %s", info->id);
return;
}
- if (lockdownd_start_service (lockdown_cli, "com.apple.mobile.house_arrest", &port) != LOCKDOWN_E_SUCCESS)
+ lerr = lockdownd_start_service (lockdown_cli, "com.apple.mobile.house_arrest", &lockdown_service);
+ if (lerr != LOCKDOWN_E_SUCCESS)
{
lockdownd_client_free (lockdown_cli);
g_warning ("Failed to start house arrest for app %s", info->id);
@@ -820,14 +817,17 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
}
house_arrest = NULL;
- house_arrest_client_new (self->dev, port, &house_arrest);
+ house_arrest_client_new (self->dev, lockdown_service, &house_arrest);
if (house_arrest == NULL)
{
g_warning ("Failed to start house arrest for app %s", info->id);
lockdownd_client_free (lockdown_cli);
+ lockdownd_service_descriptor_free (lockdown_service);
return;
}
+ lockdownd_service_descriptor_free (lockdown_service);
+
dict = NULL;
if (house_arrest_send_command (house_arrest, "VendContainer", info->id) != HOUSE_ARREST_E_SUCCESS ||
house_arrest_get_result (house_arrest, &dict) != HOUSE_ARREST_E_SUCCESS)
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
index 9829077..b7284b0 100644
--- a/monitor/afc/afcvolume.c
+++ b/monitor/afc/afcvolume.c
@@ -80,6 +80,8 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
guint retries;
plist_t value;
char *model, *display_name;
+ lockdownd_service_descriptor_t lockdown_service = NULL;
+ lockdownd_error_t lerr;
retries = 0;
do {
@@ -94,14 +96,14 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
if (self->service != NULL)
{
- guint16 port;
-
if (lockdownd_client_new_with_handshake (dev, &lockdown_cli, "gvfs-afc-volume-monitor") != LOCKDOWN_E_SUCCESS)
{
idevice_free (dev);
return 0;
}
- if (lockdownd_start_service(lockdown_cli, "com.apple.mobile.house_arrest", &port) != LOCKDOWN_E_SUCCESS)
+ lerr = lockdownd_start_service (lockdown_cli, "com.apple.mobile.house_arrest", &lockdown_service);
+ lockdownd_service_descriptor_free (lockdown_service);
+ if (lerr != LOCKDOWN_E_SUCCESS)
{
idevice_free (dev);
return 0;
diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
index 3545bdf..995ef4d 100644
--- a/monitor/afc/afcvolumemonitor.c
+++ b/monitor/afc/afcvolumemonitor.c
@@ -89,12 +89,7 @@ g_vfs_afc_monitor_idevice_event (const idevice_event_t *event, void *user_data)
self = G_VFS_AFC_VOLUME_MONITOR(user_data);
-#ifdef HAVE_LIBIMOBILEDEVICE_1_1_2
event_udid = event->udid;
-#else
- event_udid = event->uuid;
-#endif
-
if (event->event == IDEVICE_DEVICE_ADD)
g_vfs_afc_monitor_create_volume (self, event_udid);
else
--
cgit v0.9.2
|