无法在Ubuntu 13.04中连接Google Nexus

从12.10升级到13.04后,我遇到了将Google Nexus连接到我的Ubuntu机器的问题。

我在互联网上的某个地方找到了这个脚本,但它现在似乎不起作用:

#!/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 

启动后,我得到:

 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 

尝试更新mtp?

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

然后,启动Software Updater(以前称为Update Manager)并安装可用的更新

使用13.04,您不需要使用任何外部脚本,并且mtpfs本身无法与Nexus 4等现代Android设备一起使用。

假设您正在使用Nautilus的默认Unity桌面,那么只需插入您的设备就足够了,它应该出现在Nautilus中,您可以浏览它并将文件复制到设备或从设备复制文件。

如果您希望获得对文件的完全访问权限,以便普通应用程序可以直接打开设备上的文件,则需要更新版本的gvfs,如此处所述