mtp 使用:如何安装和传输文件到三星:Galaxy 型号 Android 手机

mtp 使用:如何安装和传输文件到三星:Galaxy 型号 Android 手机

如何使用 mtpfs 读取/写入通过 USB 连接的 Android 手机(作为大容量存储设备连接):

thufir@dur:~$ 
thufir@dur:~$ mkdir phone
thufir@dur:~$ 
thufir@dur:~$ sudo mtpfs -o allow_other phone
[sudo] password for thufir: 
Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
   Found 1 device(s):
   Samsung: Galaxy models (MTP) (04e8:6860) @ bus 1, dev 6
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
LIBMTP PANIC: Could not open session! (Return code 8195)
  Try to reset the device.
Unable to open raw device 0
thufir@dur:~$ 

和:

thufir@dur:~$ 
thufir@dur:~$ mount
/dev/mapper/ubuntu--vg-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda1 on /boot type ext2 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=thufir)
thufir@dur:~$ 

lsusb 显示:

thufir@dur:~$ lsusb
Bus 001 Device 006: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-I9300 Phone [Galaxy S III], GT-P7500 [Galaxy Tab 10.1]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0
Bus 004 Device 002: ID 0461:0010 Primax Electronics, Ltd HP Keyboard
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
thufir@dur:~$ 

在 MTP 和 PTP 之间切换手机可以实现以下功能:

thufir@dur:~$ 
thufir@dur:~$ sudo mtpfs -o allow_other phone
[sudo] password for thufir: 
Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
   No raw devices found.
thufir@dur:~$ sudo mtpfs -o allow_other phone
Unable to open ~/.mtpz-data for reading, MTPZ disabled.Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
   Found 1 device(s):
   Samsung: Galaxy models (MTP) (04e8:6860) @ bus 1, dev 8
Attempting to connect device
Listing File Information on Device with name: GT-S7560M
thufir@dur:~$ 
thufir@dur:~$ ls phone 
ls: cannot access phone: Transport endpoint is not connected
thufir@dur:~$ 

尽管我不知道这能起到什么作用。

也可以看看:

https://askubuntu.com/a/57306/45156

答案1

我使用的是 Debian 衍生的 Bunsen Labs Linux 8.6 bunsen-hydrogen
因此,你可以尝试这个:

$ sudo apt-get install mtp-tools
$ man mtp-tools

这有点笨重,但我曾用它从我的超低端阿尔卡特(KitKat)手机中获取文件。
一定有更好的方法……

#!/bin/bash
# copies all the pictures out of my Android phone

echo "Creating list of .jpg files..."
mtp-files | \
egrep '^File ID|Filename' | \
perl -pe 'm/^File/ && s/\n//' | \
perl -lane 'print "$F[2] $F[4]" if m/\.jpg/' > camera_files.lst

while read field1 field2; do
  echo "Copying $field2..."
  mtp-getfile $field1 $field2
done < camera_files.lst

答案2

我无法让 mtp-tools 工作。我安装了 jmtpfs,它可以正常工作,尽管目录操作非常慢,尤其是对于照片等大型目录。

(对于单个文件,使用蓝牙或电子邮件更快;对于许多文件,我将 SD 卡从手机中弹出并将其安装在计算机上。)

如何使用 USB 将 Android 7.1 连接到 Ubuntu Linux?

答案3

安装gmtp并使用其连接手机或平板电脑:

sudo apt-get install gmtp

答案4

神奇的是,现在可以工作了:

安卓

装好了没?

thufir@tleilax:~$ 
thufir@tleilax:~$ mount
/dev/sda5 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,nodev,noexec,nosuid)
sysfs on /sys type sysfs (rw,nodev,noexec,nosuid)
none on /sys/fs/cgroup type tmpfs (rw,uid=0,gid=0,mode=0755,size=1024)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,nodev,noexec,nosuid,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,nodev,noexec,nosuid,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,noexec,nodev,none,name=systemd)
/home/.ecryptfs/thufir/.Private on /home/thufir type ecryptfs (ecryptfs_check_dev_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs,ecryptfs_sig=c36b5937afc3da6c,ecryptfs_fnek_sig=bd3e015ffef0ebaf)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=thufir)
/dev/sr0 on /media/thufir/Ubuntu 14.10 amd64 type iso9660 (ro,nodev,nosuid,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
thufir@tleilax:~$

相关内容