Showing posts with label libmtp. Show all posts
Showing posts with label libmtp. Show all posts

Linux: how to connect Sony mobile phone via USB

Hi there,

Recently I was trying to connect my Sony Xperia S mobile phone (with Android OS) to my PC running on Linux (Ubuntu)....
... and guess what no success :(

So here are the steps TO DO in order to successfully connect your mobile phone:
1. Connect to the  USB port and run lsusb command to see the devices.
2. Note the vendor ID for you device.

3. Install additional packages:
sudo apt-get install libusb-dev
sudo apt-get install gmtp

4. Download libmtp-1.1.6 extract and build:
cd libmtp-1.1.6
./configure --prefix=/usr
sudo make install

5. Copy libmtp rules to rules.d:
sudo cp 69-libmtp.rules /etc/udev/rules.d/

6. Edit the rules:
Add something similar to below with correct product id specified earlier in lsusb
ATTR{idVendor}=="0fce", ATTR{idProduct}=="4169", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
ATTR{idVendor}=="0fce", ATTR{idProduct}=="0169", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

Save and close.

7. Reload the rules: sudo udevadm control --reload-rules

8. Connect device again to USB port and run GMTP to connect.

You should now be able to transfer files to and from your device.

Also if you are an Android developer you can now debug your application directly on your mobile phone :)

Hope that will be helpful for someone :)