将 Centos 7 连接到 Android phone

Connecting Centos 7 to Android phone

我正在尝试将 Centos 7 操作系统连接到 Moto3G Android phone(运行 Android v6 - marshmallow)

libmtp 已安装

Package libmtp-1.1.6-5.el7.x86_64 already installed and latest version
Nothing to do

互联网上的大多数搜索都建议使用 mtp-detect,但就我而言:

bash: mtp-detect: command not found

我可以使用 dmesg

看到 phone
[ 6446.771306] usb 1-1.2: Product: XT1039
[ 6446.771309] usb 1-1.2: Manufacturer: motorola

我安装了 jmtpfs(使用 yum),它给了我以下内容

jmtpfs
No mtp devices found.

我尝试使用 GO 安装 go-mtpfs 但得到以下结果

$ ./gopath/bin/go-mtpfs bob &
[1] 21633
$ 2017/05/03 13:06:18 detect failed: no MTP devices found

[1]+  Exit 1                  ./gopath/bin/go-mtpfs bob

如果有人对这方面的进展有任何意见或建议,我将不胜感激。

访问 Android MTP 或其他 MTP 设备,单位为 CentOS 7 Linux OS

Install mtp libs and utilities in CentOS

Login as root and install fuse, jmtpfs, libmtp as following:

$yum install fuse, jmtpfs, libmtp

Mount/Load MTP 格式设备的步骤(例如 android 7 牛轧糖)

Login as root Create a directory to mount MTP device:

$mkdir /media/mtp-device 

Connect android device to the USB cable, Unlock the android phone, Swipe down from the top of the phone screen. You should see a notification "USB ...", Tap that notification. You should see a menu titled "Use USB to...", select "Transfer files(MTP)" Option...

To list all the available mtp devices(eg. android 7 nougat), issue command jmtpfs in root session

$jmtpfs -l

each mtp device is listed with busnum, devnum information. Mount device as below:

$jmtpfs -device=<busnum>,<devnum> /media/mtp-device #If this option not specified, then the first device found isused. 

or

$jmtpfs /media/mtp-device #All files will be present in /media/mtp-device location,but it will be accessible to the root only.

2。 Access/Copy 来自 MTP 设备的数据

Now you can access files of android devices mounted on /media/mtp-device folder, but you cannot copy to other folder. To copy files, you need to allow other user as below:

$jmtpfs -o allow_other ~/my-android7 

Now you can copy the data from ~/my-android7 location to your folders.

3。从 Linux 系统

移除或卸载设备

First un-mount the allow_other location

$fusermount -u ~/my-android7

Finally un-mount the device at root folder.

$fusermount -u /media/mtp-device