понеделник, 6 август 2012 г.

How to disable automatic fsck checks

First, to see the parameters of the checks, you can use:
tune2fs -l /dev/sda1
Then, if you would like to change them:
tune2fs -c 0 /dev/sda1
would disable the checks on maximum count number (for example, on my computer, fsck makes automatic check after 5 reboots).
You can increase the number to say 25 reboots:
tune2fs -c 25 /dev/sda1
Or you can alternatively, set a time limits for reboots using the -i option instead. For example, typing
tune2fs -c 0 -i 0 /dev/sda1
would turn off the checks completely.
For more info, check man tune2fs. 

сряда, 1 август 2012 г.

How to decrease brightness trough konsole

After the last update, it turned out that I cannot control the brightness of my laptop trough the keys. I was quite desperate, but after a day or two of searching, I found the problem. It turned out that in /sys/class/backlight/ I have two folders /sys/class/backlight/acpi_video0 and /sys/class/backlight/toshiba
Trying with echo 0 > /sys/class/backlight/toshiba/brightness turned out not to do the trick, while echo 0 > /sys/class/backlight/acpi_video0/brightness decreased the brightness on my screen. So obviously, my system looks for the screen controls in the toshiba folder.
I noticed this command in the kernel boot screen acpi_backlight=vendor, so I suppose I'll try it on the next restart. But at least, now I can control the brightness. YAY!
While digging the net, I found those two quite cool sites:
http://blog.fejes.ca/?p=510 It offers a script for controlling the brightness (And it works, I tested it).
https://bugs.archlinux.org/task/29543 This is actually a bug report, but you can see some useful kernel options.

събота, 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!!!