Monday, December 14, 2015

How to connect your Android device on Ubuntu Linux

https://www.howtoforge.com/tutorial/how-to-connect-your-android-device-on-linux

Buying a media device that needs a special driver and/or connectivity suite to navigate and update its contents is a common case nowadays, and has been ever since manufacturers decided that it would be a good idea to just limit the access that users can have on the products that they bought. This may not be a huge problem to Windows and Mac OS users who can simply download the manufacturer's suite and use it to connect to their device, but Linux is often (if not always) left unsupported in that part. The first time I encountered this problem was with the first generation of iPods and Creative Zen players that refused to show any contents on the File Manager when connected via the USB port, and then came the newest generations of Android devices which do the same. In this quick guide, we will see how we can overcome this problem, and connect our media device on our Linux system.

MTP - Basic File Transfer Options

First thing we need to do is to install “libmtp” which enables us to use an additional media transfer protocol for the USB ports. If you're using Ubuntu, you can do this by opening a terminal and typing:
sudo apt-get install libmtp
After this is done, you may connect your media device on the USB, and then type:
mtp-detect
On the terminal.
Installation of libmpt on Ubuntu.
This command will yield some basic information for the connected device. You may have to wait for a few moments for everything to be displayed and the command to finish running. If your device can't be detected, then you may have to find a newer version of libmtp in the hope that support for your device has been added.
Then insert the command “mtp-connect” followed by “mtp-folders” to see the contained folders and their IDs.
mtp-connect
mtp-folders
Note that you should not attempt to open the device from your file manager in the meantime, as this will interfere and make it “busy” so the “mtp-connect” command won't work.
The mtp-connect and mtp-folders commands.
Using the “mtp-files” command will display all files in your device, their IDs, their parent folders IDs, and their file sizes. Now if you want to copy a file from the media device to your computer, you simply use the “mtp-getfile” command followed by the file's ID and the filename that you want to be used for the newly created file. The exact opposite which is sending a file from your computer to your USB device can be done by using the “mtp-sendfile” command.
Here's an example where I want to send a file named fg.ods and I want it to be copied without a change in it's title.
Send a file with mtp-sendfile.

MTP – Mount Options and GUI Navigation

Working through the terminal can be cumbersome, especially when your media device contains a large number of files. If you give the “mtp-detect” command a go and you see that it is working with your device, then you have the option to mount it and navigate in its storage more conveniently through your file manager.
For this, we have to install mtpfs by giving “sudo apt-get install mtpfs” on a terminal, and then “sudo mtpfs -o allow_other ~/mnt”.
sudo apt-get install mtpfs
sudo mtpfs -o allow_other ~/mnt
This action should create a new mountpoint on /mnt which you can also access via the terminal if you prefer to. If this doesn't work, you can give Qlix a try which is a minimalistic GUI MTP devices manager.
How to use mtpfs.
mtpfs - part 2.
As we're dealing with Android devices on this tutorial, we should keep in mind that those are not just phones but also mp3 players and cameras. This means that you can access them in a smarter way as well, like through the Clementine music player for example. Open Clementine, go to “Devices” and double click on the Android icon. This should mount your device and display the contained audio files that should be perfectly accessible and playable.
Open Clementine and navigate to android icon.
If you right-click on the icon of the device and choose the “Properties” option, you will get information such as the device's mount point, formats supported, and the USB radio interface. The mount point in particular, can be used to access the storage of the device with your file manager.
open properties of the android device.

No comments:

Post a Comment