|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| .settings/ | H | 20-Apr-2019 | - | 68 | 67 |
| autom4te.cache/ | H | 20-Apr-2019 | - | 14,006 | 12,768 |
| src/ | H | 20-Apr-2019 | - | 3,949 | 2,611 |
| .autotools | H A D | 20-Apr-2019 | 1.4 KiB | 43 | 42 |
| .cproject | H A D | 20-Apr-2019 | 20.1 KiB | 417 | 415 |
| .project | H A D | 20-Apr-2019 | 2.3 KiB | 80 | 79 |
| .pydevproject | H A D | 20-Apr-2019 | 304 | 8 | 6 |
| AUTHORS | H A D | 20-Apr-2019 | 45 | 3 | 1 |
| COPYING | H A D | 20-Apr-2019 | 34.3 KiB | 674 | 553 |
| ChangeLog | H A D | 20-Apr-2019 | 0 | | |
| INSTALL | H A D | 20-Apr-2019 | 15.6 KiB | 378 | 292 |
| Makefile.am | H A D | 20-Apr-2019 | 12 | 2 | 1 |
| Makefile.in | H A D | 20-Apr-2019 | 22.4 KiB | 726 | 641 |
| NEWS | H A D | 20-Apr-2019 | 82 | 7 | 4 |
| README.rst | H A D | 20-Apr-2019 | 4.2 KiB | 101 | 77 |
| aclocal.m4 | H A D | 20-Apr-2019 | 39.6 KiB | 1,132 | 1,014 |
| config.guess | H A D | 20-Apr-2019 | 43.9 KiB | 1,502 | 1,291 |
| config.sub | H A D | 20-Apr-2019 | 33.6 KiB | 1,706 | 1,558 |
| configure | H A D | 20-Apr-2019 | 179.2 KiB | 6,211 | 5,088 |
| configure.ac | H A D | 20-Apr-2019 | 521 | 33 | 19 |
| depcomp | H A D | 20-Apr-2019 | 18.2 KiB | 631 | 407 |
| install-sh | H A D | 20-Apr-2019 | 13.3 KiB | 521 | 344 |
| missing | H A D | 20-Apr-2019 | 11.2 KiB | 377 | 281 |
README.rst
1
2
3jmtpfs:
4
5
6
7
8jmtpfs is a FUSE and libmtp based filesystem for accessing MTP (Media Transfer
9Protocol) devices. It was specifically designed for exchaning files between
10Linux (and Mac OS X) systems and newer Android devices that support MTP but not USB Mass
11Storage.
12
13The goal is to create a well behaved filesystem, allowing tools like find and
14rsync to work as expected. MTP file types are set automatically based on file
15type detection using libmagic. Setting the file appears to be necessary for
16some Android apps, like Gallery, to be able to find and use the files.
17
18Since it is meant as an Android file transfer utility, and I don't have
19any non-Android MTP devices to test with, playlists and other non-file
20based data are not supported.
21
22Building and installing:
23
24See the INSTALL file.
25
26Usage:
27
28Run jmtpfs with a directory as a parameter, and it will mount to that directory
29the first MTP device it finds. You can then access the files on the device as
30if it were a normal disk.
31
32[jason@colossus ~]$ jmtpfs ~/mtp
33Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
34Android device detected, assigning default bug flags
35[jason@colossus ~]$ ls ~/mtp
36Internal Storage
37[jason@colossus ~]$ ls ~/mtp/Internal\ Storage/
38Android burstlyImageCache DCIM Music Notifications Pictures testdir
39[jason@colossus ~]$ df -h ~/mtp/Internal\ Storage
40Filesystem Size Used Avail Use% Mounted on
41jmtpfs 14G 3.1G 11G 23% /home/jason/mtp
42[jason@colossus ~]$ cd ~/mtp/Internal\ Storage/
43[jason@colossus Internal Storage]$ ls
44Android burstlyImageCache DCIM Music Notifications Pictures testdir
45[jason@colossus Internal Storage]$ cat > test.txt
46Hello Android!
47[jason@colossus Internal Storage]$ ls
48Android DCIM Notifications testdir
49burstlyImageCache Music Pictures test.txt
50[jason@colossus Internal Storage]$ cat test.txt
51Hello Android!
52[jason@colossus Internal Storage]$ rm test.txt
53[jason@colossus Internal Storage]$
54
55Pass the -l option will list the attached MTP devices.
56
57[jason@colossus ~]$ workspace/jmtpfs/src/jmtpfs -l
58Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
59Available devices (busLocation, devNum, productId, vendorId, product, vendor):
602, 19, 0x6860, 0x04e8, GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note, Samsung
61
62You can choose which device to mount with the -device option.
63
64[jason@colossus ~]$ workspace/jmtpfs/src/jmtpfs -device=2,19 ~/mtp
65Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
66Android device detected, assigning default bug flags
67[jason@colossus ~]$ ls ~/mtp
68Internal Storage
69
70Unmount with fusermount.
71
72[jason@colossus ~]$ ls ~/mtp
73Internal Storage
74[jason@colossus ~]$ fusermount -u ~/mtp
75[jason@colossus ~]$ ls ~/mtp
76[jason@colossus ~]$
77
78
79Performance and implementation notes:
80
81libmtp (and I assume the MTP protocol itself) doesn't support seeking within a
82file or partial file reads or writes. You have to fetch or send the entire
83file. To simluate normal random access files, when a file is opened the entire
84file contents are copied from the device to a temporary file. Reads and writes
85then operate on the temporary file. When the file is closed (or if a flush or
86fsync occurs) then if a write has occurred since the file was last opened the
87entire contents of the temporary file are sent back to the device. This means
88repeatedly opening a file, making a small change, and closing it again will
89be very slow.
90
91Renaming or moving a file is implemented by copying the file from the device,
92writing it back to the device under the new name, and then deleting the
93original file. This makes renames, especially for large files, slow. This
94has special significance when using rsync to copy files to the device. Rsync
95copies to a temporary file, and then when the copy is complete it renames the
96temporary file to the real filename. So when rsyncing to a jmtpfs filessystem,
97for each file, the data gets copied to the device, read back, and then copied
98to the device again. There is a true rename (but not move) supported by libmtp,
99but this appears to confuse some Android apps, so I don't use it. Image files,
100for example, will disappear from the Gallery if they're renamed.
101