2

After upgrading from 12.10 to 13.04 I am having issues with connecting my Google Nexus to my Ubuntu machine.

I have found this script somewhere on the Internet but it does not seem to work now :

#!/bin/bash

if [ `lsusb |grep Google |wc -l` == 0 ]; then
    echo "plug in the device"
    exit 1
fi

if [ `dpkg -l mtpfs |wc -l` == "0" ]; then
    sudo apt-get update && sudo apt-get install mtpfs
fi

rules_file=/etc/udev/rules.d/60-android.rules
if [ ! -f $rules_file ]; then
    vp=`lsusb|grep Google|cut -d " " -f 6`
    vendor=`echo $vp | cut -d ':' -f 1`
    product=`echo $vp | cut -d ':' -f 2`
    rule="SUBSYSTEM==\"usb\", ATTR{idVendor}==\"$vendor\", ATTR{idProduct}==\"$product\", MODE=\"0600\", GROUP=\"plugdev\" OWNER=\"$USER\""
    sudo bash -c "echo $rule > $rules_file"
fi  

mount_point=/media/nexus
if [ ! -d $mount_point ]; then
    sudo mkdir $mount_point
    sudo chmod 775 $mount_point
fi  
sudo mtpfs -o allow_other $mount_point

After launching it I get :

Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
Device 0 (VID=xxxx and PID=yyyy) is a Google Inc (for LG Electronics/Samsung) Nexus 4/10 (MTP).
   Found 1 device(s):
   Google Inc (for LG Electronics/Samsung): Nexus 4/10 (MTP) (xxxx:yyyy) @ bus 2, dev 4
Attempting to connect device
ignoring libusb_claim_interface() = -6PTP_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
Error 1: Get Storage information failed.
Error 2: PTP Layer error 02fe: get_handles_recursively(): could not get object handles.
Error 2: Error 02fe: PTP: Protocol error, data expected
Listing File Information on Device with name: (NULL)
LIBMTP_Get_Storage() failed:-1
Patryk
  • 9,146

2 Answers2

1

Try updating mtp?

sudo add-apt-repository ppa:langdalepl/gvfs-mtp
sudo apt-get update

Then, launch Software Updater (previously known as Update Manager) and install the available updates

Mihai
  • 1,644
0

With 13.04, you should not need to use any external scripts, and mtpfs itself doesn't work with modern Android devices like the Nexus 4 anyway.

Assuming you're using the default Unity desktop with Nautilus, then it is sufficient to just plug your device in and it should appear in Nautilus and you can browse it and copy files to/from the device.

If you want to get full access to files, so that normal applications can directly open files on the device, you need a newer version of gvfs, as discussed here

langdalepl
  • 324
  • 2
  • 3