2015. május 22.

Connection the Ubuntu Phone to the Ubuntu Desktop

Sadly, if you connect the Ubuntu Phone with an USB cable to the Ubuntu Desktop PC, it just might not show up in Files/Nautilus.

On Ubuntu 14.04 the problem can be solved by installing the latest libmtp on the Ubuntu Desktop.
As written in this askubuntu answer:
sudo add-apt-repository ppa:fossfreedom/libmtp
sudo apt-get update
sudo apt full-upgrade

On Ubuntu 12.04 it is not this easy.

To install the latest libmtp, use these commands instead of the above:
sudo add-apt-repository "deb http://ppa.launchpad.net/fossfreedom/libmtp/ubuntu trusty main" 
sudo add-apt-repository "deb-src http://ppa.launchpad.net/fossfreedom/libmtp/ubuntu trusty main"
sudo apt-get update
sudo apt-get dist-upgrade

However, the Ubuntu Phone still not shows up in Nautilus.
But it is definitely recognized in lsusb:
~$ lsusb
Bus 001 Device 004: ID 2a47:2008 

ADB: an alternate way

An alternate way to reach the phone in with the Android Debugging Bridge (adb).
Install adb, if you don't have it yet:
sudo apt-get install android-tools-adb 

To be able to use the adb with the Ubuntu Phone, turn on Developer Mode on your phone.
Go to 'Apps > System Settings > About this phone > Developer mode' and turn it on. You'll have to set a Lock security first if you use Swipe only to unlock your phone.

As written in this askubuntu post, you'll have to add the phone vendor manually to the list adb recognizes, and then restart the adb-server:
printf '0x2a47\n' > ~/.android/adb_usb.ini
sudo adb kill-server;  sudo adb start-server

Now the Ubuntu Phone is recognized by adb:
~$ adb devices
List of devices attached 
JU013288 device

Usage of adb:
As a regular user, you'll probably just want to move files around.
This can be done with the push and pull commands.
Push copies a specified file from your computer to the phone.
adb -d push <local> <remote>
For example:
adb -d push ~/Music/testfile.mp3 Music/
Pull copies a specified file from the phone to your computer.
adb -d pull <remote> [<local>]
For example:
adb -d push Music/testfile.mp3 ~/Music/
List files and directories of your phone:
~$ adb -d shell ls
Documents  Downloads  Music  Pictures  Videos

~$ adb -d shell ls Music/
testfile.mp3

Mass-copy files with adb:
With adb it is impossible to mass-copy files. There is a sync option, but it only updates files that already exist, and copies none.
Alternate ways are script and tools based on adb, for example:

Nincsenek megjegyzések: