web-dev-qa-db-ja.com

mtpの使用法:Samsungにファイルをマウントおよび転送する方法: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
Thufir

Mtp-toolsを動作させることができませんでした。 jmtpfsをインストールしましたが、機能しますが、特に写真のような巨大なディレクトリの場合、ディレクトリ操作は非常に遅くなります。

(単一のファイルの場合はbluetoothまたは電子メールを使用する方が高速です。多くのファイルの場合は、電話からsdcardを取り出してコンピューターにマウントします。)

SBでAndroid 7.1をUbuntu Linuxに接続する方法? を参照してください。

0
maharvey67

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
0
AAAfarmclub