събота, 28 април 2012 г.

How to mount Motorola Xoom under Sabayon or Gentoo

I never had any problems with my Sabayon recognizing whatever I decided to plug in the usb port. Including my Android Sony Xperia. Obviously, things changed with Android, because yesterday, when I connected my Motorola Xoom, surprise, surprise, Sabayon wouldn't recognize it. After some research, it turned out that the nice people in Android decided to make our lives little bit happier by changing the protocols which Android uses so that now, it is not recognized as mass-storage device, but as media something. Anyway, here's what I discovered as a way to deal with the problem.

The whole thing is that you need mtpfs installed in order to be able to mount the Xoom. On Ubunto, that seems to happen without a problem as this link suggests. On Gentoo, that's not the case. So, here's what I found.

First, here's this site where the process of emerging mftps is described. It didn't work for me, but I suppose it's Sabayon related .

What worked for me was the description from this site, so I'll post here what I did. I did everything as root, though maybe sudo will do the job in most cases.

1. Put Xoom in debugging mode.  (it's done from Android's settings).

2. Connect your Xoom to the computer. You can test whether everything is ok by typing:

$mtp-detect

After some time (like a minute), this will print a lot of information, which might be eventually useful.

3. How to install mtpfs (following this site)

3.1. $mkdir -p /usr/local/portage/myoverlay (if you don't have it already)

3.2. Edit /etc/make.conf (with nano for example)

Add in the end of the file:

PORTDIR_OVERLAY="/usr/local/portage/myoverlay $PORTDIR_OVERLAY"

(the source site says something else, but this worked for me)

Save and exit.

4. The Ebuild (again from http://klaig.blogspot.com/2011/05/mount-xoomandroid-filesystem-while-in.html)
4.1. $cd /usr/local/portage/myoverlay  
       $mkdir -p sys-fs/mtpfs
       $cd sys-fs/mtpfs

4.4. $nano mtpfs-0.9.ebuild
And paste the following ebuild in the file:

# Copyright 1999-2009 Gentoo Foundation
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

DESCRIPTION="MTPFS is a Fuse filesystem based on libmtp"
HOMEPAGE="http://adebenham.com/mtpfs"
SRC_URI="http://adebenham.com/debian/mtpfs_${PV}.orig.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="debug"

DEPEND="sys-fs/fuse
      >=dev-libs/glib-2.18.4-r1
      media-libs/libmtp"
RDEPEND="${DEPEND}"

src_configure() {
   econf $(use_enable debug) || die 'econf failed'
}

src_compile() {
   emake || die 'emake failed'
}

src_unpack() {
    unpack ${A}
    mv ${P}.orig ${P}
}


src_install() {
   emake DESTDIR="${D}" install || die 'installation failed'
   dodoc AUTHORS INSTALL NEWS README ChangeLog
}

pkg_postinst() {
   einfo "To mount your MTP device, issue:"
   einfo " /usr/bin/mtpfs <mountpoint>"
   einfo
   einfo "To unmount your MTP device, issue:"
   einfo " /usr/bin/fusermount -u <mountpoint>"
}



5. Now you have to install it:

$ebuild mtpfs-0.9.ebuild digest
$emerge mtpfs


6. Now, you're ready to mount your Xoom:

$mkdir /mnt/xoom
$mtpfs -o allow_other /mnt/xoom


The Xoom can be found in /mnt/xoom (obviously) and that will allow you to transfer files via the USB. It didn't work completely flawlessly for me, but it managed to copy 6GB of movies, which were readable afterwards, so obviously it worked. To unmount, you should use:

$/usr/bin/fusermount -u /mnt/xoom

Now, if you'd like to automate the process, you can use the directions which are for Ubunto (i.e. this link), but I'm not so sure how this will work so I'll leave it for someone feeling more adventurous. I'm quite happy that the USB file transfer is finally working.

EDIT:
Another and easier way to mount Xoom in Gentoo is trough gMTP (http://gmtp.sourceforge.net/). It has nice interface and you can do everything trough GUI (though mtpfs allows you to use Dolphin on everything but then, it has the problem with copying attributes- see the comment). To install gMTP on my Sabayon, I had to install both pkgconfig and extutils-pkgconfig along with the requirements found on the site. Then you just follow the readme and it installs fine. The only thing I noted so far is that it connected to my Xoom after I did mtp-detect from the konsole. Don't know whether this is isolated case, but anyway. It works fine! YAY!!!

2 коментара:

  1. If you, like me, had problems with very slow copying to the Xoom, you may wanna try "cp --no-preserve=all"
    It seems that there is a problem with setting attributes to the copied file which is why it takes forever to copy.

    ОтговорИзтриване