Google Android Nexus 4 and MTP works... almost... [SOLVED]
So my work forced me to get a "smartphone". I scowled and objected, but finally caved in. I absolutely had to do email out on the road.
Well, the fone I got is a Nexus 4, apparently hand crafted by google with Android OS. It's actually pretty cool. I can even make fonecalls :) The issue is getting stuff off it when I get home. It seems silly to email 3MB pix to myself when the thing is sitting here connected and charging off USB. I tried Airdroid, some people praised it. It failed in that "Give Me Your Credit Card Number!" kinda way. adb does nothing. PTP and gphoto make my USB printer get excited but that's about all. Keep in mind I run old uber-hacked Mandrake10 with 2.6.6 kernel, so everything I do is compiled from source. When I plug the fone in, log in as root, and go Code:
mtp-files What I discovered is that if I go to the fone's "USB computer connection" screen, it shows: Code:
CONNECT AS Code:
#!/bin/sh I suppose my question is this: Is there a way of forcing reset on the USB connection on the PC end, maybe a way of hacking libmtp, or is this completely on the Android end? Peace and Cheer. |
seems dependent on human intervention.
try sshdroid; i think you have to be rooted. else you can scp from your fone to your pc using andftp. |
@ mdooligan
I use Airdroid and it never ask for a credit card at any time and it works great. Back on topic, have you tried File Expert HD? it's a cool file manager with tools to manage your files and it can act as a server and client. And it's FREE! https://play.google.com/store/apps/d...?id=xcxin.fehd File Expert HD has a built-in ftp server and you can try file transfers and see if it works for you. |
I might try some of those apps, but I think I'm onto a nice solution involving stuff I already have:
It appears to me that libmtp goes wrong with the android in that it opens the usb connection, does something, then closes it. Android doesn't like this. It likes to open a *session*, do everything, and I'm not so sure it even cares about closing the session. This is mtp after all. It's designed for teenage girls who just want to slap a few tunes/pix on/off their fone and then yank it out and run. None of that courtesy mount/unmount stuff here. I'm going to have a go a creating a modified mtp-connect, that opens the connection, and waits in a loop for instructions (getfile, files, filetree, delfile, etc), then closes when I'm finally done. Looking at the code, it shouldn't be much of a stretch. Peace and Cheer. |
Ok, I understand :)
It's a shame that android discontinue usb mass storage in place of MTP. Usb mass storage did what we wanted, connect our android device and then drop and drag our files to it. Those were the good ol' days... |
Quote:
|
Cool :)
|
Update
My technique works.
I hacked a version of mtp-connect, called it mtp-connect-android, and it runs in a loop, kinda like fdisk or something. I type "f <ENTER>" it shows the file listing of the device. Type "g 123" and it grabs File ID 123 and dumps it in the current directory as it's proper filename, eg "IMG_20131229_123112.jpg" or whatever. I have to be logged in as root, but I can make as many mtp calls as I like without having to reset the device or USB connection. Awesome. It's pretty crude still, the code needs a lot of work, but it does work and proves my theory. BTW, the reason these devices cannot be mounted as USB Mass Storage is so that they can continue working while plugged in. Ever remember mp3 players and stuff that essentially went dead when plugged in? You couldn't listen to music while charging? That's why. MTP allows the device to continue doing it's own thing while also allowing outside connection. Kinda like FTP server or something. Peace and Cheer. |
Update:
I'm slowly smoothing this hack over. I can get ranges like g 145 153-157 and it will get file 145 and all the ones from 153 through 157, dump them in CWD. The beauty of it is that I have 2 send modes: s ~/bin/something 1 will send ~/bin/something to folder 1 (Music). But if I go s 1 it notices the lack of from_path but catches the to_path, and sits in loop, so I can paste a huge chunk from find /mnt/sda1/audio/mp3/C/ -name '*' | sort | less into it. And it works! It chews the buffered terminal input (rxvt) and makes real send commands that work, and I get my Chopin and Corb Lund into the folder 1 on my device. It's fast too. Life is good. I highly doubt that *doze stuff works this good. And Apps, well, there's a gajillion of them, and they never do what I want because they try to anticipate my needs, and always fail because I'm an old school hacker. There's a SMS and MMS grabber I use, and a feeble File Manager deelybob that seems to work, so far that's it for my Apps. Simple MTP *works* with Android Nexus4. You just have to be crafty. In libmtp, you might notice that all of the mtp-* progs are in the dir /examples. That's great. They're examples of how the sh*t works. Learn. I have. Everyone wants stuff spoon fed, but, with all the changing tech, how can this be? Peace and Cheer. |
All times are GMT -5. The time now is 10:53 PM. |