{"id":659707,"date":"2013-01-12T18:17:22","date_gmt":"2013-01-12T10:17:22","guid":{"rendered":"http:\/\/www.sunjw.us\/blog\/?p=659707"},"modified":"2013-01-12T18:28:56","modified_gmt":"2013-01-12T10:28:56","slug":"mount-nexus-4-on-fedora-17","status":"publish","type":"post","link":"https:\/\/www.sunjw.us\/blog\/mount-nexus-4-on-fedora-17\/","title":{"rendered":"[\u8f6c] Mount Nexus 4 on Fedora 17"},"content":{"rendered":"<p>\u539f\u8d34\u5730\u5740\uff1a<br \/>\n<a href=\"http:\/\/forums.fedoraforum.org\/showthread.php?t=286547\" target=\"_blank\">http:\/\/forums.fedoraforum.org\/showthread.php?t=286547<\/a><\/p>\n<blockquote><p>Shiny new toy! I wrote a quick howto blog post for getting something working until a better solution comes along. <img decoding=\"async\" title=\"Smilie\" src=\"http:\/\/forums.fedoraforum.org\/\/forum\/images\/smilies\/smile.gif\" alt=\"\" border=\"0\" \/><\/p>\n<p><em>Link to blog edited out as per sub-forum rules &#8212; DBelton<\/em><\/p>\n<p>======================<\/p>\n<p><!--more-->&#8230;<\/p>\n<p>First, install <strong>libmtp<\/strong> and <strong>simple-mtpfs<\/strong>. There are other projects like <a href=\"http:\/\/code.google.com\/p\/mtpfs\/\" target=\"_blank\">mtpfs<\/a> (seems unmaintained) and <a href=\"https:\/\/github.com\/hanwen\/go-mtpfs\" target=\"_blank\">go-mtpfs<\/a> (uses some oddball compiler) so I stuck with <a href=\"https:\/\/github.com\/phatina\/simple-mtpfs\" target=\"_blank\">simple-mtpfs<\/a> because it\u2019s already in the Fedora repos and seems to work.<\/p>\n<div>\n<div>Code:<\/div>\n<pre dir=\"ltr\">$ sudo yum -y install fuse fuse-libs libmtp simple-mtpfs<\/pre>\n<\/div>\n<p>NOTE: you probably already have fuse\/fuse-libs and gvfs-fuse installed. Googling around I see there\u2019s work on a <a href=\"http:\/\/intr.overt.org\/blog\/?p=153\" target=\"_blank\">MTP interface to GVFS<\/a> but it\u2019s not ready yet.<\/p>\n<p>Next, write some quick udev rules to see your Nexus 4 \u2014 as of this writing (libmtp-1.1.5-1.fc17) they\u2019re not in the stock \/usr\/lib\/udev\/rules.d\/69-libmtp.rules file. I\u2019m sure this will get updated, so we\u2019ll put them in our own file and not edit the stock one. Create <strong>\/etc\/udev\/rules.d\/99-nexus4.rules<\/strong> with:<\/p>\n<div>\n<div>Code:<\/div>\n<pre dir=\"ltr\">ACTION!=\"add\", GOTO=\"nexus4_rules_end\"\r\nENV{MAJOR}!=\"?*\", GOTO=\"nexus4_rules_end\"\r\nSUBSYSTEM==\"usb\", GOTO=\"nexus4_usb_rules\"\r\nGOTO=\"nexus4_rules_end\"\r\n\r\nLABEL=\"nexus4_usb_rules\"\r\n\r\n# LGE Nexus 4 MTP\r\nATTR{idVendor}==\"18d1\", ATTR{idProduct}==\"4ee1\", SYMLINK+=\"libmtp-%k\", ENV{ID_MTP_DEVICE}=\"1\", ENV{ID_MEDIA_PLAYER}=\"1\"\r\n\r\nLABEL=\"nexus4_rules_end\"<\/pre>\n<\/div>\n<p>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 <strong>~\/.bashrc<\/strong> file:<\/p>\n<div>\n<div>Code:<\/div>\n<pre dir=\"ltr\">alias n4mount=\"simple-mtpfs ~\/Misc\/Nexus4\"\r\nalias n4umount=\"fusermount -u ~\/Misc\/Nexus4\"<\/pre>\n<\/div>\n<p>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:<\/p>\n<div>\n<div>Code:<\/div>\n<pre dir=\"ltr\">$ sudo udevadm control --reload-rules<\/pre>\n<\/div>\n<p>You\u2019re ready to rock &amp; roll \u2013 I seem to be having a spurious problem where the first time I run the mounting alias it \u201cdoesn\u2019t work\u201d but the second time I run it it works fine, so \u201cn4mount;n4umount;n4mount\u201d and then my device shows up. Your mileage may vary here \u2013 when you plug in your Nexus 4 there should be a new device symlink being created that something like:<\/p>\n<div>\n<div>Code:<\/div>\n<pre dir=\"ltr\">$ ls -l \/dev\/libmtp*\r\nlrwxrwxrwx   1 root root   15 Dec  8 08:41 libmtp-2-1.1 -&gt; bus\/usb\/002\/007<\/pre>\n<\/div>\n<p>If you\u2019re not seeing that after plugging in your device, something\u2019s not right \u2013 go back and check your rules and such again. Using the above I\u2019ve been able to copy over all my backups, MP3s, etc. to the device seemingly without any errors or causing any device harm.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u8d34\u5730\u5740\uff1a http:\/\/forums.fedoraforum.org\/showthread.php?t=28 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[30,75,134,351,350],"class_list":["post-659707","post","type-post","status-publish","format-standard","hentry","category-13","tag-android","tag-fedora","tag-linux","tag-mtp","tag-nexus4"],"_links":{"self":[{"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/posts\/659707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/comments?post=659707"}],"version-history":[{"count":5,"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/posts\/659707\/revisions"}],"predecessor-version":[{"id":659711,"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/posts\/659707\/revisions\/659711"}],"wp:attachment":[{"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/media?parent=659707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/categories?post=659707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sunjw.us\/blog\/wp-json\/wp\/v2\/tags?post=659707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}