Related
I have setup adb on ubuntu linux and it works as in all the adb commands work but whenever i enter adb remount it starts and then says that it can't find a device when I know its plugged in. I have tried with it mounted and not mounted.
bump bump bump
Same problem here, on Slackware 13rc1 and Slackware 12.2, the phone is seen on dmesg, it mounts the microSD reader and it works ok, the USB debugging is enabled, but if I run "adb devices" in the SDK directory, it returns an empty list.
try renaming your "50-android.rules.d" file to "51-android.rules.d"
hopefully that sorts out your issue. it was the only adjustment to setup on ubuntu that i had to make.
your path to the file should look like this:
/etc/udev/rules.d/51-android.rules.d
the text file should read:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Download This file and extract.
hit Windows Key + r
Type in devmgmt.msc
right click on nexus one
click update
update from location on computer.
select that folder.
---------------Notes-------------
Be sure to enable debugging on your phone via Settings>Applications>Devlopment>USB debugging.
Confirmed working on:
Win 7 Ultimate x64/x86
Win 7 Home Edition x86?
Win Vista
XP Home x86
XP Pro x64/x86
O.S
What O.S you had this working on?
@th3fallen
143!!
I got it working on win7 Ultimate version
This works for Windows 7 Home Premium Edition as well.
In order to get ADB working on Linux (Ubuntu 9.04) I had to edit /etc/udev/rules.d/51-android.rules (I may have created this file for the G1) and add:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
What I was seeing was the device would sort of show up when I ran adb devices, but it would list ????????? as the ID and no permissions.
~Kenny
I was able to access it by using dream, magic and adb testing device didnt need any specific driver.
I did this to get it working on win 7 ultimate x64
NexVision said:
I was able to access it by using dream, magic and adb testing device didnt need any specific driver.
Click to expand...
Click to collapse
You need the latest refresh of the drivers (and tools for updated fastboot, etc.) from the SDK. If you go to a Windows command prompt and run Android, assuming the tools directory is in your path, you can select the update for both. It will fail in updating tools, since you are using an app in it, but don't close the app, just reapply at that point and it will work on the second go. Then when you install the N1, you will have the drivers you need to install as before.
Not meaning to argue with you but what I was saying is I have had no issues doing anything via adb with it as a magic I have done fastboot as well hey maybe its just working for me.
kfk2 said:
In order to get ADB working on Linux (Ubuntu 9.04) I had to edit /etc/udev/rules.d/51-android-rules (I may have created this file for the G1) and add:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
What I was seeing was the device would sort of show up when I ran adb devices, but it would list ????????? as the ID and no permissions.
~Kenny
Click to expand...
Click to collapse
Hmm...I have that already in my /etc/udev/rules.d/51-android.rules (mine has .rules, not -rules...I'm assuming that's a typo in your post?) and I'm still coming up with ?????????? as the device and no permissions, all attempts to do anything with adb result in it telling me I don't have permission to do these things.
Swervo said:
Hmm...I have that already in my /etc/udev/rules.d/51-android.rules (mine has .rules, not -rules...I'm assuming that's a typo in your post?) and I'm still coming up with ?????????? as the device and no permissions, all attempts to do anything with adb result in it telling me I don't have permission to do these things.
Click to expand...
Click to collapse
Yah that was a typo.. The no permissions error appears to me that adb doesn't have access to the /dev/ devices used. I'm not at home so I cannot lookup what device is created and used in /dev/ for you to check the permissions. I know I killed the adb server and restarted it a few times while trying to get mine to work, along with updating to the latest sdk. So you may want to try those things, you could also try running adb as root and seeing if that fixes it (if so, then it's a simple permission error with udev not creating it with correct permissions).
Alrighty, I think I got it. I'm no udev expert (in fact, I'm rather useless at it), but this worked for me.
1) Make sure USB debugging is turned on on the phone.
2) Plug the phone into the USB port on the machine.
3) Make sure /etc/udev/51-android.rules has
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Click to expand...
Click to collapse
in it.
4) run
adb kill-server
Click to expand...
Click to collapse
5) As root, run
service udev restart
Click to expand...
Click to collapse
6) run
adb start-server
Click to expand...
Click to collapse
Worked for me to get the device recognized.
Hey guys, I have the Android 1.5 SDK/ADB installed on my computer.. so I don't know what will happen when I mount my N1 (haven't tried yet). I want to be able to mount my N1 normally without ADB or anything, 'cause I'm not going to root it for a while. Thanks!
Confirmed on Vista
I can confirm that the instructions in the OP work on Vista. Thanks a lot, th3fallen.
Alleviate said:
Hey guys, I have the Android 1.5 SDK/ADB installed on my computer.. so I don't know what will happen when I mount my N1 (haven't tried yet). I want to be able to mount my N1 normally without ADB or anything, 'cause I'm not going to root it for a while. Thanks!
Click to expand...
Click to collapse
Nothing will happen, ADB doesn't start interacting with your phone without you explicitly telling it to. Also, if you don't have debugging turned on on your phone, then it won't even if you do explicitly tell it to. Feel free to mount the drive on it.
ADB and Root
Maybe I'm doing something wrong, but I can't get ADB to recognize my phone. ADB is all set up correctly, I have it updated (I believe) to the most recent version. I installed the updated USB driver and I see the "Android Phone" in my device manager. I have USB Debugging checked off in my phone settings. ADB worked fine for my G1, but it doesn't recognize my Nexus One.
I shouldn't have to root the phone to have ADB working should I? Can anybody think of something I overlooked? I am running Windows XP Professional SP3
Okay, so I navigated to the "1.1-nexusone-superboot" folder in the command prompt and tried
Code:
adb-windows devices
and my device showed up. Now I want to move those files to where I originally had my adb files in C:\android-sdk-windows\tools so that all I have to type is
Code:
adb devices
to have my phone listed. I tried replacing the files in my \tools folder and renaming them to what they were named before, but that didn't work. Could somebody please help me get this set up properly?
ccunningham83 said:
Okay, so I navigated to the "1.1-nexusone-superboot" folder in the command prompt and tried
Code:
adb-windows remount
and my device showed up. Now I want to move those files to where I originally had my adb files in C:\android-sdk-windows\tools so that all I have to type is
Code:
adb devices
to have my phone listed. I tried replacing the files in my \tools folder and renaming them to what they were named before, but that didn't work. Could somebody please help me get this set up properly?
Click to expand...
Click to collapse
in your command prompt you have to be in the c:\android-sdk-windows\tools\ directory for it to work
ccunningham83 said:
Maybe I'm doing something wrong, but I can't get ADB to recognize my phone. ADB is all set up correctly, I have it updated (I believe) to the most recent version. I installed the updated USB driver and I see the "Android Phone" in my device manager. I have USB Debugging checked off in my phone settings. ADB worked fine for my G1, but it doesn't recognize my Nexus One.
I shouldn't have to root the phone to have ADB working should I? Can anybody think of something I overlooked? I am running Windows XP Professional SP3
Click to expand...
Click to collapse
I was having the same problem yesterday. But i'm on Vista. Nothing seemed to work, but ADB was working fine on my Mytouch. At any rate, I ended up going to download the most recent SDK and trying adb again from a command prompt @ the tools location of the newest SDK, and then everything worked. I don't know if that was something I should have done in the first place and I just didn't know it (duh), but that's what worked for me.
Now works on 32bit and 64bit Linux
Just a quick guide on how to configure Linux for file transfers using MTP. I wrote the instructions and config for Ubuntu Natty 32bit and 64bit, though the same process will work on other platforms - the only real difference being the package manager commands and possibly the config file locations.
The attached files are for the Galaxy Tab 10.1v but should work for the 10.1g / 10.1 as well. See the end of the post to learn how to modify this config to work for other devices.
How to configure for gMTP and other Media Sync tools
1) Install aptitude
Code:
sudo apt-get install aptitude
2) Install mtp-tools and mtpfs
Code:
sudo aptitude install mtpfs mtp-tools
3) Download the attached file ( View attachment 98-gtab.zip for 32bit Linux or View attachment 98-gtab.rules-AMD64.zip for 64bit Linux ) to your desktop.
4) Extract the 98-gtab.rules file to your desktop
5) Copy the rules file to /etc/udev/rules.d/
Code:
sudo cp ~/Desktop/98-gtab.rules /etc/udev/rules.d
6) Reboot
7) Connect your Tab
8) Run the following command to confirm it is working:
Code:
ls /dev | grep gtab
...which should return "gtab" if successful. If not, follow the "Modifying" guide below.
9) Download / install gMTP
Code:
sudo apt-get install gmtp
10) Open gMTP and select "connect" from the menu
11) Hit the thanks button
12) Go nuts!
Setting up for Automount (Optional, but recommended)
***You must have completed Steps 1-8 above before proceeding***
1) Edit your fstab file to add your gtab:
Code:
sudo gedit /etc/fstab
2) Add this to the end of the file:
Code:
#gtab
mtpfs /media/gtab fuse user,noauto,allow_other 0 0
3) Save and exit
4) Open fuse.conf for editing:
Code:
sudo gedit /etc/fuse.conf
5) Find the following line and remove the #
Code:
#user_allow_other
6) Save and exit
7) Open and edit the groups file:
Code:
sudo gedit /etc/group
8) Find the details for the group 'fuse' and append your username to the end of the line eg.
Code:
fuse:x:104:<YOUR USER NAME>
9) Save and exit
10) Create the folder to mount your Tab:
Code:
sudo mkdir /media/gtab
11) Take ownership of the folder:
Code:
sudo chown <YOUR USER NAME>:users /media/gtab
12) Reboot
13) Plug in your Tab.
14) Click on the Places menu and click gtab.
15) You're in business!
Modifying for other devices
If the above doesn't work immediately on the 10.1g / 10.1 (I have only tested on the 10.1v), you can easily edit the rules file to support your device.
1) Install lsusb
Code:
sudo apt-get install lsusb
2) Run lsusb
Code:
lsusb
3) Check the output of this command to find your device. The 10.1v is shown like this:
Code:
Bus 001 Device 010: ID 04e8:6860 Samsung Electronics Co., Ltd
4) Make a note of the Vendor and Product IDs. In the example above, the vendor ID is 04e8 and device ID is 6860 (note 04e8:6860 in the output).
5) Open the rules file for editing (if it's not already in /etc/udev/rules.d, copy it there now)
Code:
sudo gedit /etc/udev/rules.d/98-gtab.rules
6) Find this line:
Code:
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
7) Replace the Vendor ID (04e8) and Product ID (6860) with the ones that you got from step 3 above.
8) Save and exit
9) Reboot
10) Follow step 7 onward in the first guide above
11) Hit the thanks button
If you modify it for a particular device, please post the contents of your new 'rules' file here.
32bit RULES FILE:
Code:
ACTION!="add", GOTO="gtab_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
LABEL="gtab_usb_end"
LABEL="gtab_rules_end"
64bit RULES FILE:
Code:
ACTION!="add", GOTO="gtab_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0777" SYMLINK+="gtab"
LABEL="gtab_usb_end"
LABEL="gtab_rules_end"
Tested, walked through the steps to my friend (Skype ). Works 100% on Linux Mint too
Everything worked for me up to the GMTP part - I can grep through /dev and I can see the "gtab" device there. But GMTP insists "Detect: No raw devices found."
I'm still running Maverick, but I added the maverick-backports repo, which has gmtp, so I would think it would work.
This is a Samsung Galaxy Tab 10.1v (from Google I/O). Any ideas?
EDIT: I also tried the automounting option with FUSE. Attempts to cd into it with bash or open it from the Places menu in GNOME both give the message "Transport endpoint is not connected".
EDIT again:
OK, I disabled USB Debugging and now have a different set of problems. mtp-detect sees the device now, but the message upon running it is:
Code:
libmtp version: 1.0.3
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
Found 1 device(s):
04e8:6860 @ bus 2, dev 26
Attempting to connect device(s)
ignoring usb_claim_interface = -16ignoring usb_claim_interface = -22PTP_ERROR_IO: Trying again after re-initializing USB interface
inep: usb_get_endpoint_status(): Device or resource busy
outep: usb_get_endpoint_status(): Device or resource busy
usb_clear_halt() on IN endpoint: Device or resource busy
usb_clear_halt() on OUT endpoint: Device or resource busy
usb_clear_halt() on INTERRUPT endpoint: Device or resource busy
LIBMTP PANIC: Could not open session! (Return code 767)
Try to reset the device.
Unable to open raw device 0
OK.
Konklone said:
Everything worked for me up to the GMTP part - I can grep through /dev and I can see the "gtab" device there. But GMTP insists "Detect: No raw devices found."
I'm still running Maverick, but I added the maverick-backports repo, which has gmtp, so I would think it would work.
This is a Samsung Galaxy Tab 10.1v (from Google I/O). Any ideas?
EDIT: I also tried the automounting option with FUSE. Attempts to cd into it with bash or open it from the Places menu in GNOME both give the message "Transport endpoint is not connected".
Click to expand...
Click to collapse
Can you post the output from 'lsusb' ?
re the "Transport endpoint is not connected" - I just got this same error on 64bit Natty. Will try and see if I can find out why..
Ah, just saw your reply. I edited my post up above, but the gist is - you can't do this while USB Debugging is enabled. The Tab has to be running its "MTP Application".
Now I'm getting the stranger errors above. I'm going to try mounting it with FUSE now to see if that helps for some reason.
EDIT: For the record, I'm using the correct vendor and product IDs in my rules file:
Code:
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666" SYMLINK+="gtab"
Konklone said:
I edited my post up above, but the gist is - you can't do this while USB Debugging is enabled.
Click to expand...
Click to collapse
You may be right. When I wrote this guide, I was using a VM. It is possible that the fact that I was using both MTP and ADB at the same time has something to do with how VMWare presents the devices to the guest OS.
Now I am using 'bare metal' Natty 64 bit and have the same problem as you.
I have to go out for a while but will look at it again when I get back.
EDIT: Just tried mtp-detect and it is finding the device. I suspect USB Debug is not the issue, but I'll leave it in your capable hands - really got to go now
EDIT2: See here http://www.usb.org/developers/devclass_docs/MTP_1.0.zip OK - Im really REALLY going now. Back online in a few hours
I couldn't get anywhere until I turned off USB debugging. When USB debugging is enabled, I *can* use adb to get into the shell, see files, install apps, etc. I can even transfer files over adb, through the command line! Can you get MTP to detect it with USB debugging enabled?
With USB debugging off, I have once in a great while (only twice in all my attempts) while gotten mtp-detect to connect to the device and print sane output describing the device. Even when those happened, running the command immediately again didn't connect correctly, and gave me the same error messages I was getting before. Both times I got it to connect, it was soon after plugging in the cable, but it doesn't happen every time.
Intermittent heisenbugs are the worst, yet I don't think I have a busted cable, given that adb works perfectly consistently.
Maybe I should try this again after updating to Natty...I'd been meaning to do it anyhow...
EDIT: One thing I notice is that on the Tab, when the "MTP Application" is running after plugging in, the 5-dot "in progress" animation is extremely choppy, as if the device were very very busy. If the device were very very busy for some reason, this could explain why a successful connection can happen only once in a great while. I'll try rebooting the device, I guess.
EDIT2: I rebooted the device, and I removed the USB extension cord I was using, but neither helped, still getting the same intermittent success. (I got mtp-detect to connect to it a few more times - all soon after plugging in the cable, and none were repeatable without unplugging and replugging it in.) The animation actually wasn't choppy before, that's just how it looks - 5 discrete animation frames, one for each dot.
Something interesting though: this time I had the Tab resting on my knee, and I felt a haptic buzz after running mtp-detect on one occasion. I looked down and saw the MTP Application restart itself. Then I ran mtp-detect again and I felt 3 haptic buzzes in quick succession, followed by a successful detection and output. But when running mtp-detect *again*, no dice.
This is messed up.
Messed up indeed.
Konklone said:
Can you get MTP to detect it with USB debugging enabled?
Click to expand...
Click to collapse
Yes, both work simultaneously on 32bit Natty
Note that you have to unmount the gtab for mtp-detect to work. I compared the output from mtp-detect on the 32bit working VM and the 64bit non-working 'bare metal' machine and the output was identical. I suspect this means that mtpfs is not where the problem is
Re the strange problem with haptic feedback - I have had mine power off all by itself when testing some different parameters in the rules file.
[64bit working]
OK. Problem solved... kind of. There seems to be some kind of bug in fuse which requires the filesystem to mount with higher permissions to run properly (at least on Natty AMD64)
If you use the new 64bit rules file I have attached, it should work. Basically it uses 777 permissions instead of 666. Not great, but working nonetheless.
New rules file for 64bit:
Code:
ACTION!="add", GOTO="gtab_rules_end"
SUBSYSTEM!="usb|usb_device", GOTO="gtab_usb_end"
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0777" SYMLINK+="gtab"
LABEL="gtab_usb_end"
LABEL="gtab_rules_end"
EDIT: If someone wants to experiment with lesser permissions and see what the minimum is and post back, that would be helpful for all.
Sigh, thank you for taking so much time to help me so far, but I wonder if I'm a lost cause.
I spent a bunch of today finishing my upgrade to Natty, including a full wipe and reinstall. (I have a 32-bit machine, btw.) Now I can't even get it to detect my MTP device at all (mtp-detect says "No raw devices found."), with or without debugging enabled.
One possibly important topic - it's really surprising to me that yours works either way, because lsusb shows that a different product ID is exposed to the host, depending on whether debugging is on or not. With debugging disabled, it's 6860, like your example. With debugging enabled, it's 685e. When I run lsusb, only one of those will show up, never both. So if yours is the same device, I have no idea how your rules file could be agnostic to debugging being enabled. If yours is not, then that might explain our different experiences.
Anyway, I've Thanks'd all your posts in this thread, solved or not. I appreciate your help.
Konklone said:
With debugging enabled, it's 685e. When I run lsusb, only one of those will show up, never both
Click to expand...
Click to collapse
You're more than welcome.
I noticed that in Windows, both devices appear in device manager. That is a very strange problem you have discovered.
I just posted instructions and files to give you root access! Might take your mind off the MTP issues for a while
Who knows... the problem might just go away
Konklone said:
One possibly important topic - it's really surprising to me that yours works either way, because lsusb shows that a different product ID is exposed to the host, depending on whether debugging is on or not. With debugging disabled, it's 6860, like your example. With debugging enabled, it's 685e. help.
Click to expand...
Click to collapse
Are you sure? On my device its the other way around. Without debugging its 685e and with debugging its 6860?
ajvogel said:
Are you sure? On my device its the other way around. Without debugging its 685e and with debugging its 6860?
Click to expand...
Click to collapse
Ok I got it working on my device, I switched on usb debugging in settings. lsusb now returns 6860 and I am able to mount the galaxy tab using the process outlined above.
This is craziness. Is my Galaxy Tab a rare mutant piece of hardware who had its USB numbers switched?
Also - I noticed that Ubuntu somehow automounts my tablet and can read/write to its disk, through a Nautilus plugin. But I still get nothing with mtp-detect. I don't understand how the world works.
I've also got an I/O tablet (updated to 3.1) and I followed this tutorial, so thanks for the help you provided! I managed to copy some files to the device but it ended up freezing my computer (running Ubuntu 10.10).
So I unplugged the tablet, and saw that effectively those few pictures and pdf files had been copied to the device successfully. Pictures are in the Gallery, pdf can be read with Aldiko... but the funny thing is that when I mounted again the tablet -using Ubuntu again- it shows all folders as empty!
That is, 0 files in all tablet folders.
I tried "showing all hidden files" with Nautilus. No luck, nothing is shown. Went to the folder using command line, did an ls -la (just in case who knows! maybe it would show something!). No luck either, directories are apparently empty and have "1 January 1970" as modification date... if it helps.
I can see the files inside the folders using ADB but it's obviously not ideal, specially compared with simply using Nautilus.
Does it happen to you too?
Anyone get this working? I'm having the same exact issues as Konklone. I'm on Maverick and tried the different udev rules and it still doesn't work. I'm gonna be pissed if I have to buy the stupid Samsung USB adapter just to get USB mass storage.
[ASK]Noobs need solution
gMTP tells me that there is no device. Any ideas?
I'm having the same issue. First try I was able to plug in and mount to my netbook. Tried to plug into my mac and it didn't work. Hasn't worked since then, i'm considering doing a factory reset.
I'm running Ubuntu 10.10 64-bit. Note that you do have to enable backports to install gmtp.
Edit /etc/apt/sources.list, uncomment the lines with:
Code:
deb (http-url) maverick-backports main restricted universe multiverse
deb-src (http-url) maverick-backports main restricted universe multiverse
Run
Code:
sudo apt-get update && sudo apt-get install gmtp
I had to unplug the device and replug it back in a couple of times before gmtp would connect to it properly. It seems to be pretty flaky.
Wow...........
This is nonsense ..... is there a way to enable USB Mass Storage or are we completely hosed with MTP?
trying to start learning to dev, however I need help setting up usb access for the Bionic. Anyone care to help a newb?
ROB281 said:
trying to start learning to dev, however I need help setting up usb access for the Bionic. Anyone care to help a newb?
Click to expand...
Click to collapse
these should help you out
http://forum.xda-developers.com/showthread.php?p=19446284#post19446284
how-to-get-adb-to-work-on-ubuntu
1. Make sure you have the Android SDK for Linux installed with the package for Platform Tools. Take your SDK folder and move it to your home folder, so that for example to navigate to my SDK folder I type: cd /home/miles/android-sdk-linux/
2. Edit your environment path variable. Everyone uses a more complicated way but I change my Linux distribution quite regularly, almost all based off of Ubuntu, and this is a very easy way that I figured out how to do it. Open up a Terminal and type:
sudo gedit /etc/environment
you will be prompted for your password, then a document will open. you can at the end of the text, inside the last quotation mark, type :/home/username/android-sdk-linux/platform-tools:/home/username/android-sdk-linux/tools mine looks like this::
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/brandon/android-sdk-linux/platform-tools:/home/brandon/android-sdk-linux/tools" then save it and exit the word processor
3. Now you have to set up your computer so that it recognizes the Android device through ADB. To do this, type this exactly: sudo gedit /etc/udev/rules.d/51-android.rules
A blank file should open up for you. Assuming you are using a Bionic, copy and paste this, SUBSYSTEM=="usb", ATTR{idVendor}=="22B8", MODE="0666", GROUP="plugdev"
if you are using or will be using any other device go to the link below this text for developer.android.com and scroll down to the manufacturer of your device and take the 4 characters and put them where 22B8 is above. I have various devices and my girl has a droid and my dad so I go ahead and set it up to work with all. All you have to do to set up the file for multiple devices is copy and paste the text above on separate lines for each manufacturer you will be developing for, and replace the value following {idVendor} with the respective value for that Manufacturer. For example HTC would be "0BB4". After you have this file setup, you don't need to type anything else, just save it and exit. Then in the terminal type: sudo restart udev
Link for ADB vendor ID's
http://developer.android.com/guide/developing/device.html
4. Make sure your android device has Debugging enabled. To do this go to Settings > Applications > Development and make sure the box for debugging is checked. After this, plug your phone up to the computer and type: adb devices
If you get an error with the command, just restart your computer and it should then work, that just means that your path environment hadn't taken its new effect. and if it still doesn't recognize adb as a command from the terminal, open up that /etc/environment file and make sure the pathname to your android-sdk platform tools is entered correctly.
This is what I do every time I have to set my computer up for development on my device. Also you should check out the Android Source pages at http://source.android.com/
You are unable to just plug in your Nexus 4 in Linux but it is very easy to mount and unmount to move data to/from your sdcard. This is one option that will allow you to utilize Nautilis (or any other file browser) to copy files to/from your Nexus 4. This is written for Ubuntu, but should work the same for other Linux systems. Also, this should work for Nexus 7 and 10.
1. Enable Developer options and enable USB debugging.
2. Install necessary modules to your computer:
sudo apt-get install mtp-tools mtpfs
3. Configure 51-android.rules:
sudo gedit /etc/udev/rules.d/51-android.rules
paste the following at the end of the file (if the file does not exist then just paste):
#LG - Nexus 4
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Samsung - Nexus 7 & 10
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
Save and exit.
4. Make the file executable:
sudo chmod +x /etc/udev/rules.d/51-android.rules
5. Restart udev
sudo service udev restart
6. Create mount point and permissions (will need to do this for other Nexus' if using for the 7 or 10)
sudo mkdir /media/nexus4
chmod 755 /media/nexus4
7. Plug in the Nexus 4 and make sure MTP is enabled.
8. Mount with the following command:
sudo mtpfs -o allow_other /media/nexus4
9. When you have completed your work you must unmount:
sudo umount /media/nexus4
Now each time you need to copy from/to your Nexus 4 to your Linux computer you only need to plug in and run 8, then 9 when you have completed your work.
Good info! I'll try it out on my Ubuntu laptop later.
Thanks!
Awesome. Thanks
sent from my straight out of limbo 2 Nexus 4 using XDA-premium
This isn't so much a Nexus 4 guide as a general Linux mounting guide, but still cool. Thanks!
First, thanks to the OP! Just wanted to add another way for linux.
Just install and run gMTP plug your phone in and click connect. It is in the Ubuntu software center or for other versions of linux at http://gmtp.sourceforge.net/
I prefer adb+qtadb. Better speed and stability compared to mtp i think.
Sent from my Blade using xda app-developers app
Thanks for that write up. On my gentoo box my galaxy nexus worked flawlessly but the nexus 4 did not. Hopefully this will do it!
Sent from my Nexus 4 using Tapatalk 2
Kaar3l said:
I prefer adb+qtadb. Better speed and stability compared to mtp i think.
Sent from my Blade using xda app-developers app
Click to expand...
Click to collapse
Yes QtADB works very nicely also. It requires a little more setup than gMTP, but you are correct that it is a little faster and stable.
Kaar3l said:
I prefer adb+qtadb. Better speed and stability compared to mtp i think.
Sent from my Blade using xda app-developers app
Click to expand...
Click to collapse
the3dman said:
Yes QtADB works very nicely also. It requires a little more setup than gMTP, but you are correct that it is a little faster and stable.
Click to expand...
Click to collapse
Never heard of that. What is it?
Generating random authentication keys
---------- Post added at 07:48 AM ---------- Previous post was at 07:47 AM ----------
Konsyst said:
This isn't so much a Nexus 4 guide as a general Linux mounting guide, but still cool. Thanks!
Click to expand...
Click to collapse
Haven't gotten my N4 yet but I'm gonna try this on my sIII.
Generating random authentication keys
Thanks for your work! very useful..!
Konsyst said:
This isn't so much a Nexus 4 guide as a general Linux mounting guide, but still cool. Thanks!
Click to expand...
Click to collapse
Not such a general Linux guide as a Debian-derivative guide.
Helpful nonetheless marty331 for the correct udev strings, thanks!
I personally think using sshfs and sshdroid is a much more stable solution. MTP support on Linux is... shoddy to say the least.
Thanks given anyway though.
It seems that mtpfs 1.1 is broken. I downgraded to 1.0 and it worked. However, there is usually lag for some reason whenever the screen is off.
I had MTP/PTP crash several sdcards of mine which required me to format them (no write permissions had no way to get that back.)
Ever since that I just use ADB (Android Debugging Bridge) there are several GUI front-ends available in the default deb/rpm repositories, or if you are comfortable with the terminal (and with ADB it's really really simple to master) you can just get the binary and put it in your bin folder and transfer it via that. Highly reliable, speed is about 2-3mb/s -- but it works.
I gave up on this on Debian Testing. My Galaxy Nexus would not mount no matter what udev rules I used and mtpfs is not a solution. Instead, I just use a ftp server on the phone and ftp things to it or push things using adb. I've also tried airdroid a few times. I would not mind trying the sshfs alternative either. Gonna check that one out.
jamcar said:
Never heard of that. What is it?
Click to expand...
Click to collapse
QtADB is just a GUI for ADB and it works very well. Search QtADB on Google and you will find the download page with instructions.
Sent from my Nexus 4 using xda app-developers app
OP's use of udev inspired me to come up with this solution using ADB.
I'll assume you have ADB installed. There's plenty of indepth guides for that elsewhere.
This tutorial will have you playing around in system directories on your Linux install. I tried to make this guide user friendly but you should have at least SOME knowledge of Unix like OSes before you even try this.
Not for the faint of heart.
Get http://https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en from the play store. Enable USB debugging in the developer options on your phone.
Open SSHDroid on your phone and set your port to something other than 22. I use 2222.
Open a terminal window on your computer and elevate yourself to root (Preferably using su -. Otherwise use sudo su -.).
Now that we got that done, try logging into your phone to make sure everything works. It'll be something like
Code:
ssh -p2222 [email protected][yourPhone'sIP]
. If you get asked a password it probably works. Just hit ^C (Ctrl+C) to exit that password prompt since we don't need to go further yet.
Next you'll need to create a passwordless SSH login. Run
Code:
ssh-keygen -t rsa
. Just hit enter to use the defaults on all the questions, we don't need anything more.
Now run
Code:
scp -P2222 ~/.ssh/id_rsa.pub [email protected][yourPhone'sIP]:/emulated/storage/legacy/
. When it asks for the password just type "admin", though it should tell you that anyway.
If the file copied over successfully you should no be able to type
Code:
ssh -p2222 [email protected][yourPhone'sIP]
again and not be prompted with a password at all. Cool!
At this point it's recommended you go into the SSHDroid settings on your phone and untick the "Enable Password" box, though it's not required, especially if you want to ssh to your phone from other devices/computers.
Run lsusb and look for the line that says Google in it. You want to look out for something like
Code:
Bus 001 Device 070: ID 18d1:4ee2 Google Inc.
Copy the two alphanumeric codes before "Google Inc.". The first is your vendor ID and the second is your device ID. You might want to label them so you remember which is which.
Here's the scary part of the tutorial. Use your favorite text editor (preferably command line based) and create a new file at "/etc/udev/rules.d/85-android_mount.rules". Copy and paste this and edit to fit the IDs you got in the previous command.
Code:
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee2", RUN+="/usr/local/sbin/phone-mount -m" SYMLINK+="Nexus_4"
SUBSYSTEMS=="usb", ACTION=="remove", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee2", RUN+="/usr/local/sbin/phone-mount -u" SYMLINK+="Nexus_4"
It should be obvious where you need to put your Vendor and Device IDs now.
Save it and run these commands.
Code:
chmod +x /etc/udev/rules.d/85-android_mount.rules
chmod 775 /etc/udev/rules.d/85-android_mount.rules
chown root:root /etc/udev/rules.d/85-android_mount.rules
Now we need to create another file at "/usr/local/sbin/phone-mount" and paste this inside.
Code:
#!/bin/bash
export PATH=/opt/android-sdk-update-manager/platform-tools/:$PATH
case "$1" in
-m )
adb wait-for-device
adb forward tcp:2222 tcp:2222
# If you have SSHDroid Pro you just need to add "pro" to the "sshdroid".
adb shell am broadcast -a berserker.android.apps.sshdroid.command.START
sshfs -p2222 -o allow_other,idmap=user [email protected]:/storage/emulated/legacy/ /media/nexus4
exit 0
;;
-u )
umount /media/nexus4
exit 0
;;
esac
We need to modify the permissions for this file too.
Code:
chmod +x /usr/local/sbin/phone-mount
chmod 775 /usr/local/sbin/phone-mount
chown root:root /usr/local/sbin/phone-mount
Almost done. If you don't already have sshfs installed on your Linux install then do so now. You'll also need to enable the "allow_other" option. For my distro it's as simple as editing "/etc/fuse.conf" and uncommenting the "user_allow_other" line. Your results may vary.
Now finally we need to create the actual folder you'll be mounting your Nexus 4 at. If you blindly followed my guide that'll be /media/nexus4.
Code:
mkdir /media/nexus4
chown root:users /media/nexus4
chmod 775 /media/nexus4
Now all we need to do is restart udev. Right now you'll want to make sure the phone is unplugged, then restart your udev daemon. For Debian based distros like Mint, Ubuntu, Debian, Crunchbang, etc. you'd run.
Code:
service udev restart
After it's done restarting you can plug your phone in, wait a few seconds, and hopefully have your phone automount to /media/nexus4 .
You may have to improvise in a few spots because all distros are not the same, especially when you compare something like Gentoo to Debian. If you're having problems with sshfs chances are your answer is on Google. You'll honestly get better help there than having me trying to guess your system.
Also note this is a pretty hacky and dirty way to do things. Don't go yanking your phone's USB cord out without unmounting "/media/nexus4" first. You shouldn't have any problems if you're not reading or writing anything, but there is the potential for data loss and crashing udev.
i got this error at the last step
Code:
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
Android device detected, assigning default bug flags
Listing File Information on Device with name: (NULL)
fuse: bad mount point `/media/nexus4': Transport endpoint is not connected
i dont have a nexus 4 and im not on linux. but dermann made a script for this i think.
http://forum.xda-developers.com/showthread.php?p=33499930#post33499930
I've been using AirDroid. Works great for transferring files.