summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README103
-rw-r--r--src/ifuse.c33
2 files changed, 124 insertions, 12 deletions
diff --git a/README b/README
index ee724f8..bce0808 100644
--- a/README
+++ b/README
@@ -1,6 +1,10 @@
1INSTALLATION 1INSTALLATION
2================================================================================ 2================================================================================
3 3
4For:
5 Apple iPhone/iPod Touch 1.0/1.1/1.1.1/1.2/1.3/2.0+
6 + iPod USB cable
7
4You must have: 8You must have:
5 libgnutls-dev 9 libgnutls-dev
6 libusb-dev 10 libusb-dev
@@ -17,25 +21,106 @@ To compile run:
17 ./autogen.sh 21 ./autogen.sh
18 ./configure 22 ./configure
19 make 23 make
20 sudo make install (if you want to install it into your system directories) 24 sudo make install # (if you want to install it into your system directories)
21 libiphone-initconf (as the user you intend to user the library) 25 libiphone-initconf # (as the user you intend to user the library)
26
27On Ubuntu/Debian, you can do:
28 sudo apt-get install build-essential automake autoconf \
29 libgnutls-dev libusb-dev libfuse-dev libglib2.0-dev libxml2-dev
22 30
23USAGE 31USAGE
24================================================================================ 32================================================================================
25 33
26IMPORTANT: Before using the library you must run "libiphone-initconf". It will 34Now comes the fun bit!
27generate keys and a host id for your system. It only needs to be run once but 35
28it MUST be run. 36== Generating keys ==
37
38IMPORTANT: Before using the library you must run "libiphone-initconf"
39as your own user (not root). It will generate keys and a host id for your
40system to be able to communicate with 'lockdownd' on the iPhone.
41
42It will probably take 5-10 minutes, but thankfully only needs to be
43run _once_. It MUST be run otherwise communication will not work:
44
45 libiphone-initconf
46
47The generated keys are saved in '~/.config/libiphone/' in your home directory.
48
49== Tools ==
29 50
30There are currently 2 executables iphoneclient and ifuse, located in src/. 51There are currently two more executables 'ifuse' and 'iphoneclient',
52both located in src/.
31 53
32iphoneclient is a basic commandline interface, it just runs a few various operations. 54
55=== iFuse ===
56
57This is probably what you're after; this mounts a view of your
58iPhone/iPod Touch's filesystem over the USB interface using the native
59Apple protocol (AFC/"com.apple.afc").
33 60
34ifuse is a Fuse filesystem which allows you to mount your iPhone to a directory 61ifuse is a Fuse filesystem which allows you to mount your iPhone to a directory
35like this: 62like this:
36 63
37 ./src/ifuse mountpoint 64 ./src/ifuse <mountpoint> -s
38 65
39To unmount: 66To unmount:
40 umount mountpoint 67 umount <mountpoint>
68
69(nb: '-s' is to force single-threaded mode, as ifuse maybe unstable without it).
70
71Eg:
72 mkdir ~/iphone
73
74 ifuse ~/iphone -s
75 ls -l ~/iphone
76 ...
77 umount ~/iphone
78
79Currently ifuse (via the AFC protocol) only gives access to the
80'/var/root/Media/' chroot on the iPhone (containing music/pictures).
81
82If you have a device that has been jailedbreaked then an additional
83("com.apple.afc2") service will have been installed, without the chroot.
84On jailbroken devices only, you can do:
85
86 ifuse ~/iphone --root -s
87
88And this will mount a full view of the iPhone's filesystem.
89
90
91==== Setting up FUSE ====
92
93Note that on some systems, you may have to load the 'fuse' kernel
94module first and to ensure that you are a member of the 'fuse' group:
95
96 sudo modprobe fuse
97 sudo adduser $USER fuse
98
99You can check your membership of the 'fuse' group with:
100
101 id | grep fuse && echo yes! || echo not yet...
102
103If you have just added yourself, you will need to logout and log back
104in for the group change to become visible.
105
106
107=== iphoneclient ===
108
109'iphoneclient' is a basic commandline interface for testing, it just
110runs a few various test operations such as attempting to view/create a
111test file in the iPhone, but is mainly a developer tool.
112
113
114== Who/what/where? ==
115
116wiki:
117 http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page
118
119code:
120 git clone http://git.matt.colyer.name/2008/libiphone/
121
122mailing list:
123 http://lists.mattcolyer.com/listinfo.cgi/iphone-linux-dev-mattcolyer.com
41 124
125updated:
126 2008-09-02
diff --git a/src/ifuse.c b/src/ifuse.c
index ad34eb5..aef24bd 100644
--- a/src/ifuse.c
+++ b/src/ifuse.c
@@ -169,7 +169,7 @@ static int ifuse_release(const char *path, struct fuse_file_info *fi)
169 return 0; 169 return 0;
170} 170}
171 171
172void *ifuse_init(struct fuse_conn_info *conn) 172void *ifuse_init_with_service(struct fuse_conn_info *conn, const char *service_name)
173{ 173{
174 int port = 0; 174 int port = 0;
175 iphone_afc_client_t afc = NULL; 175 iphone_afc_client_t afc = NULL;
@@ -191,7 +191,7 @@ void *ifuse_init(struct fuse_conn_info *conn)
191 return NULL; 191 return NULL;
192 } 192 }
193 193
194 if (IPHONE_E_SUCCESS == iphone_lckd_start_service(control, "com.apple.afc", &port) && !port) { 194 if (IPHONE_E_SUCCESS == iphone_lckd_start_service(control, service_name, &port) && !port) {
195 iphone_lckd_free_client(control); 195 iphone_lckd_free_client(control);
196 iphone_free_device(phone); 196 iphone_free_device(phone);
197 fprintf(stderr, "Something went wrong when starting AFC."); 197 fprintf(stderr, "Something went wrong when starting AFC.");
@@ -298,6 +298,16 @@ int ifuse_mkdir(const char *dir, mode_t ignored)
298 return -1; 298 return -1;
299} 299}
300 300
301void *ifuse_init_normal(struct fuse_conn_info *conn)
302{
303 return ifuse_init_with_service(conn, "com.apple.afc");
304}
305
306void *ifuse_init_jailbroken(struct fuse_conn_info *conn)
307{
308 return ifuse_init_with_service(conn, "com.apple.afc2");
309}
310
301static struct fuse_operations ifuse_oper = { 311static struct fuse_operations ifuse_oper = {
302 .getattr = ifuse_getattr, 312 .getattr = ifuse_getattr,
303 .statfs = ifuse_statfs, 313 .statfs = ifuse_statfs,
@@ -314,11 +324,28 @@ static struct fuse_operations ifuse_oper = {
314 .rename = ifuse_rename, 324 .rename = ifuse_rename,
315 .fsync = ifuse_fsync, 325 .fsync = ifuse_fsync,
316 .release = ifuse_release, 326 .release = ifuse_release,
317 .init = ifuse_init, 327 .init = ifuse_init_normal,
318 .destroy = ifuse_cleanup 328 .destroy = ifuse_cleanup
319}; 329};
320 330
321int main(int argc, char *argv[]) 331int main(int argc, char *argv[])
322{ 332{
333 char **ammended_argv;
334 int i, j;
335
336 // Parse extra options
337 if (argc > 2 && (ammended_argv = malloc((argc + 1) * sizeof(*ammended_argv)))) {
338 for (i = j = 0; ammended_argv[j] = argv[i], i < argc; i++) {
339 // Try to use the (jailbroken) com.apple.afc2 if requested by the user
340 if (argv[i] && (!strcmp("--root", argv[i]) || !strcmp("--afc2", argv[i]))) {
341 ifuse_oper.init = ifuse_init_jailbroken;
342 continue;
343 }
344 j++;
345 }
346 argv = ammended_argv;
347 argc = j;
348 }
349
323 return fuse_main(argc, argv, &ifuse_oper, NULL); 350 return fuse_main(argc, argv, &ifuse_oper, NULL);
324} 351}