Reading Android mobile content in CentOS

Source: Internet
Author: User
Reference: Workshop

Reference: http://www.zavedil.com/software-mtp-support-rhel-6/

To read Android mobile content, we need to install go-mtpfs. Before that, we need to install some basic accessories:

1. yum install bison gcc mercurial libusb-devel

2. if your computer does not have a libusb-1.0, there will be errors during the installation process, the following is the installation link:

Http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2

Download to a folder such as/tmp, decompress tar xjvf libu **, enter the folder, and execute it in sequence. /configure; make install (of course, this must be under the root identity)

After installation, you also need to configure the environment:

Export PKG_CONFIG_PATH =/usr/lib/pkgconfig: $ PKG_CONFIG_PATH where/usr/lib/does not necessarily have pkgconfig. specify the location where pkgconfig exists.

3. install the go language pack. for details, see my blog "install golang under CentOS6.5"

4. download go-mtpfs

    mkdir /tmp/go     export GOPATH=/tmp/go    go get github.com/hanwen/go-mtpfs
    cp /tmp/go/bin/go-mtpfs /usr/bin
Chmod 4755/usr/bin/go-mtpfs
5. configure mounting:

 

Chmod 4755/bin/fusermount

Mkdir/mnt/phone

Chmod 777/mnt/phone

Create two files in/usr/bin.Phone-mount.sh and phone-unmount.shAnd modify their permissions to 777.

Edit the content of two files:

Phone-mount.sh:

 

#/bin/bash# Export a suitable path - it is requred by the module, # but will not be supplied by the udev:export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin# Run the mounter as the user who will access the phone - # replace USER with your usernamesu USER -c "/usr/bin/go-mtpfs /mnt/phone &"# Exiting is important, else udev may hang here foreverexit

 

Phone-unmount.sh:

#/bin/bash# Export a suitable pathexport PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin# Run the FUSE unmounter/bin/fusermount -u /mnt/phone

Save and modify the permission to 755.

Finally to/etc/udev/rules. d folder, create a new rules File. of course, if you have already created or the folder contains files such as 51-android.rules, you do not need to create a new one:

Go to the new folder and edit:

 

SUBSYSTEM=="usb", ATTRS{idVendor}=="AAAA", ATTRS{idProduct}=="BBBB", ACTION=="add", RUN+="/usr/bin/phone-mount.sh"ENV{ID_VENDOR_ID}=="AAAA", ENV{ID_MODEL_ID}=="BBBB", ACTION=="remove", RUN+="/usr/bin/phone-unmount.sh"
Is AAAA recognized by your mobile phone supplier, while BBBB is your mobile phone product identification code. You can use the lsusb command to view the mobile phone's specific ID.

 

 

6. write it later. at this point, the plug-and-play should be available theoretically after the restart, but I made a small mistake and did not respond.

Dizzy, so I can only use instructions,

su USER -c "/usr/bin/go-mtpfs /mnt/phone &"
Here, the USER remembers to replace it with your own name and finally shows what I want in/mnt/phone. Well, at least the goal is achieved. the reason why plug-and-play cannot be implemented remains to be investigated.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.