What's new
DroidForums.net | Android Forum & News

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Anyone Know How to Use MTP from Linux (Ubuntu 10.04)

OK, thanks. Will try the link.

libmtp-1.1.1 is installed.

I was able to link to the phone using sshfs, so I have that route also.
 
OK, got all the dependencies taken care of, and the typos in the id3tag.pc file fixed. So now it'll configure, but won't compile - it appears to be missing a header file:

[rcs@yoda: ~/Downloads/mtpfs-read-only]$ make check
gcc -DPACKAGE_NAME=\"MTPfs\" -DPACKAGE_TARNAME=\"mtpfs\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"MTPfs\ 1.0\" -DPACKAGE_BUGREPORT=\"Chris\ Debenham\ \<[email protected]\>\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mtpfs\" -DVERSION=\"1.0\" -DDEBUG=0 -I. -DFUSE_USE_VERSION=22 -D_FILE_OFFSET_BITS=64 -pthread -I/usr/local/include/fuse -I/usr/local/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DUSEMAD -g -O2 -MT mtpfs-mtpfs.o -MD -MP -MF .deps/mtpfs-mtpfs.Tpo -c -o mtpfs-mtpfs.o `test -f 'mtpfs.c' || echo './'`mtpfs.c
In file included from mtpfs.c:9:
./mtpfs.h:29:20: error: id3tag.h: No such file or directory
In file included from ./mtpfs.h:30,
from mtpfs.c:9:
./id3read.h:4: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:4: warning: its scope is only this definition or declaration, which is probably not what you want
./id3read.h:5: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:6: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:7: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:8: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:9: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:10: warning: ‘struct id3_tag’ declared inside parameter list
./id3read.h:11: warning: ‘struct id3_tag’ declared inside parameter list
mtpfs.c: In function ‘mtpfs_release’:
mtpfs.c:484: error: ‘ID3_FILE_MODE_READONLY’ undeclared (first use in this function)
mtpfs.c:484: error: (Each undeclared identifier is reported only once
mtpfs.c:484: error: for each function it appears in.)
mtpfs.c:485: warning: assignment makes pointer from integer without a cast
mtpfs.c:487: warning: passing argument 1 of ‘getArtist’ from incompatible pointer type
./id3read.h:4: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
mtpfs.c:488: warning: passing argument 1 of ‘getTitle’ from incompatible pointer type
./id3read.h:7: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
mtpfs.c:489: warning: passing argument 1 of ‘getAlbum’ from incompatible pointer type
./id3read.h:5: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
mtpfs.c:490: warning: passing argument 1 of ‘getGenre’ from incompatible pointer type
./id3read.h:8: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
mtpfs.c:491: warning: passing argument 1 of ‘getYear’ from incompatible pointer type
./id3read.h:6: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
mtpfs.c:499: warning: passing argument 1 of ‘getSonglen’ from incompatible pointer type
./id3read.h:9: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
mtpfs.c:507: warning: passing argument 1 of ‘getTracknum’ from incompatible pointer type
./id3read.h:10: note: expected ‘struct id3_tag *’ but argument is of type ‘struct id3_tag *’
make: *** [mtpfs-mtpfs.o] Error 1
 
Sorry -- That's my fault. I just saw that what I had pasted into my post for creating the id3tag.pc file was not correct. I went back and updated it. The file should look like this:

Code:
# id3tag pkg-config source file


prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include


Name: id3tag
Description: id3lib is a software library for manipulating ID3v1/v1.1 and ID3v2 tags.
Version: 0.15
Requires: 
Conflicts:
Libs: -L${libdir} -lid3tag 
Libs.private:
Cflags: -I${includedir}

Fix that file, do your ./configure again and see if mtpfs compiles for you.
 
Sorry -- That's my fault. I just saw that what I had pasted into my post for creating the id3tag.pc file was not correct. I went back and updated it. The file should look like this:

Code:
# id3tag pkg-config source file


prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include


Name: id3tag
Description: id3lib is a software library for manipulating ID3v1/v1.1 and ID3v2 tags.
Version: 0.15
Requires: 
Conflicts:
Libs: -L${libdir} -lid3tag 
Libs.private:
Cflags: -I${includedir}

Fix that file, do your ./configure again and see if mtpfs compiles for you.


Did that, and after installing the dev package for libid3tag (oops!), it compiled fine...

THANKS!
 
Last edited:
However, it compiles - but it has a problem finding the phone (wrong product ID) and can't do anything else with it:

[mythtv@vader: ~]$ mtp-detect
libmtp version: 1.1.1

Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7510/Galaxy Tab 10.1/S2.
Found 1 device(s):
Samsung: GT-P7510/Galaxy Tab 10.1/S2 (04e8:6860) @ bus 1, dev 0
Attempting to connect device(s)
ignoring usb_claim_interface = -1ignoring usb_claim_interface = -22PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
inep: usb_get_endpoint_status(): Operation not permitted
outep: usb_get_endpoint_status(): Operation not permitted
usb_clear_halt() on IN endpoint: Operation not permitted
usb_clear_halt() on OUT endpoint: Operation not permitted
usb_clear_halt() on INTERRUPT endpoint: Operation not permitted
ignoring usb_claim_interface = -1ignoring usb_claim_interface = -22LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device 0
OK.

Hmmm....
 
I am able to mount and access the phone using sshfs on the Linux box and SSHDroidPro on the phone, so I *can* do what I need to do.

However, this pisses me off. I don't like loose ends....I would like to get it working, anyway.
;-)
 
What do you have in your /etc/udev/rules.d/51-android.rules file?

My file had this in it:

Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", SYSFS{idProduct}=="6860", MODE="0666", OWNER="wam"

"wam" is my user id on the machine. I got the idVendor and idProduct values from doing the mtp-detect. You will probably need to run the mtp-detect as the root user.

Take a look at this article:

http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access/

N
ow that you have mtp-tools and mtpfs installed on your machine, you can do the other things described in that article.

I fully understand the feeling of wanting to get it working. After a while it becomes a challenge, and you just don't want to give up. Even if you do have another workable solution.
 
Last edited:
I had looked at that article.

I had the product ID, 685c, that they said was for the GNex (rather than the one that it's actually coming up with), in my /udev/rules.d/51-android.rules file. Fixed it, now I can mount as root, will make the other changes when I get home from work tonight.

Thanks!
 
Still not working right. Oh, well.

I can use AirDroid or sshfs to transfer files now - will wait until I upgrade to 12.04 LTS in a few months to sort this out.
 
Back
Top