[转] Mount Nexus 4 on Fedora 17

原贴地址:
http://forums.fedoraforum.org/showthread.php?t=286547

Shiny new toy! I wrote a quick howto blog post for getting something working until a better solution comes along.

Link to blog edited out as per sub-forum rules — DBelton

======================

First, install libmtp and simple-mtpfs. There are other projects like mtpfs (seems unmaintained) and go-mtpfs (uses some oddball compiler) so I stuck with simple-mtpfs because it’s already in the Fedora repos and seems to work.

Code:
$ sudo yum -y install fuse fuse-libs libmtp simple-mtpfs

NOTE: you probably already have fuse/fuse-libs and gvfs-fuse installed. Googling around I see there’s work on a MTP interface to GVFS but it’s not ready yet.

Next, write some quick udev rules to see your Nexus 4 — as of this writing (libmtp-1.1.5-1.fc17) they’re not in the stock /usr/lib/udev/rules.d/69-libmtp.rules file. I’m sure this will get updated, so we’ll put them in our own file and not edit the stock one. Create /etc/udev/rules.d/99-nexus4.rules with:

Code:
ACTION!="add", GOTO="nexus4_rules_end"
ENV{MAJOR}!="?*", GOTO="nexus4_rules_end"
SUBSYSTEM=="usb", GOTO="nexus4_usb_rules"
GOTO="nexus4_rules_end"

LABEL="nexus4_usb_rules"

# LGE Nexus 4 MTP
ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee1", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

LABEL="nexus4_rules_end"

Last, make your life a bit easier and add two aliases to mount/unmount your device. Make a directory (I used ~/Misc/Nexus4) and add something like the below to your ~/.bashrc file:

Code:
alias n4mount="simple-mtpfs ~/Misc/Nexus4"
alias n4umount="fusermount -u ~/Misc/Nexus4"

At this point you can either reboot (admit it, you needed to apply that new kernel update anyways) or reload your udev rules and log out/log in:

Code:
$ sudo udevadm control --reload-rules

You’re ready to rock & roll – I seem to be having a spurious problem where the first time I run the mounting alias it “doesn’t work” but the second time I run it it works fine, so “n4mount;n4umount;n4mount” and then my device shows up. Your mileage may vary here – when you plug in your Nexus 4 there should be a new device symlink being created that something like:

Code:
$ ls -l /dev/libmtp*
lrwxrwxrwx   1 root root   15 Dec  8 08:41 libmtp-2-1.1 -> bus/usb/002/007

If you’re not seeing that after plugging in your device, something’s not right – go back and check your rules and such again. Using the above I’ve been able to copy over all my backups, MP3s, etc. to the device seemingly without any errors or causing any device harm.

留下评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据