Tuesday, February 24, 2009

Auto Disable Synaptic Touch in Ubuntu Hardy

In windows, my pentium M platform will automatically disable synaptic touchpad when I connect an external mouse. It prevent me from unintentionally sliding my touchpad while typing. It's very annoying when a mouse cursor moves from current typing position to other places. I found some solutions in the internet.

First, you can completely disable notebook's touchpad if you always use a mouse. Click at menu System-> Preference -> Mouse go to Touchpad tab and you will see the checkbox.

Second, which I prefer. Turn on SHMConfig in xorg.conf

gksudo gedit /etc/X11/xorg.conf

Then make the code look like this
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
Option "SHMConfig" "on"

After enable SHMConfig, we need to add rules to udev.

gksudo gedit /etc/udev/rules.d/10-local.rules

This will open an empty file. Add the following code
ACTION=="add", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient touchpadoff=1"
ACTION=="remove", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient touchpadoff=0"

However, it doesn't work when Ubuntu start up. Udev's rules will be activated only when mouse is plugged in or removed. I search for solutions and think that I need to write my own script by checking if an external mouse is connected to disable touchpad through synclient. At first, I think about using python. Luckily, after searching for a while how python checks devices, I found this solution[2]. Instead of using python, you can easily create use unix script by using the following code
#!/bin/bash

/usr/bin/synclient TouchpadOff=`lsusb | grep Mouse | wc -l`

Where Mouse is your output from lsusb that matchs your external mouse. For me, it is Logitech.
then put it to System -> Preference -> Sessions
or init.d[3]
my disable touchpad script in System -> Preference -> Sessions

Lastly, you can disable touchpad while typing by using the following command.

syndaemon -i 1 -d

Resources:
[1] - http://ubuntuforums.org/showthread.php?t=724465
[2] - http://digitalgraphy.wordpress.com/2007/11/17/how-to-disable-touchpad-on-linux/
[3] - https://help.ubuntu.com/community/UbuntuBootupHowto

Thursday, February 12, 2009

Slow boot with Clocksource unstable in Hardy Heron

I encountered this problem long time ago, about September 2008. When I chose to boot into Ubuntu, it stuck at splash screen about 2 minutes. In order to view the elaborate boot information, you must remove splash and quiet from the grub menu which come by default.
sudo gedit /boot/grub/menu.lst

find a line that look like this
kernel        /boot/vmlinuz-2.6.24-23-generic root=UUID=84884ca6-fbea-41dc-962d-98577270be8b ro quiet splash

then remove quiet and splash. This will make Ubuntu spit a detail on boot time.

On my Asus M9V (Pentium M), Ubuntu 8.04 freeze at this line.
ACPI: Processor [CPU1] (supports 8 throttling states)
clocksourse tsc unstable (delta=183220173ns)

I found that this was a known bug on Ubuntu Hardy Heron[1]. Workaround from the launchpad is adding clocksource boot option to grub menu either hpet or acpi_pm (I use hpet). So, your grub menu will look like this.
title        Ubuntu 8.04.2, kernel 2.6.24-23-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.24-23-generic root=UUID=84884ca6-fbea-41dc-962d-98577270be8b ro clocksource=hpet quiet splash
initrd /boot/initrd.img-2.6.24-23-generic
quiet


Resources:
[1] - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/190414

Wednesday, February 4, 2009

Microphone in Ubuntu Hardy Heron

Unfortunately, I found a show stopper from Ubuntu Intrepid. It's the audio input function. I couldn't get my microphone (built-in and external) working. Actually, it does partly work, but not usable. It can record at an extremely low voice level. Some people say it is a PulseAudio's problem. So, I tried to uninstall PulseAudio and use ALSA instead, but I still couldn't make it work. One point, I noticed is that I cannot unmute Capture under Recording tab in Volume Control. Another point is that Volume Control is different between Intrepid and Hardy. In Hardy, there is Digital and Intermal Mic slide to control volume, but there isn't in Intrepid. I searched the solution and tried it for many hours. Finally, I gave up. I don't know what is exactly the course of the problem, it maybe Pulse Audio, ALSA, Kernel, Gnome Volume Control (some say kmix solve their problem), or other reasons. I hope it will be fixed in Jaunty Jackalope (Ubuntu 9.04).

Despite how much I like appearance and speed of Ubuntu Intrepid, I uninstall it. Since I need to use skype, I go back to Hardy Heron (Ubuntu 8.04) which my Asus M9V microphone works perfectly. After install and update Ubuntu, you need a little setup to make it work.

First, you need to make sure that System uses correct device by checking at System -> Preference -> Sound.


Next, you must unmute Capture in Volume Control. If you cannot see it, try to enable it via Menu -> Edit -> Preference.


Lastly, testing! You may use Sound Recorder which come with Ubuntu or add medibuntu then
sudo apt-get install skype

Sunday, February 1, 2009

Media player for Ubuntu Intrepid

Playing media files in Linux is quite troublesome. In windows, you can download all-in-one player like KMPlayer or codec-packs like K-Lite Mega Codec Pack. This will enable you to play all media types from internet such as WMV, XVID, MP4, etc. However, in Ubuntu, you need to install correct codecs to enable this feature. Normally, Ubuntu comes with totem movie player and it will ask you to download codecs (Gstreamer) when it encounters files that cannot be played. This default behavior is quite good for new user. But, I, personally, like VLC and MPlayer to be my default player. This post will tell you how to do that.

smplayer - gui for mplayer playing Firefly with Thai subtitle.

First, you need to setup Medibuntu as one of your repositories because you can get most update from it. Installation and setup note[1] should be available in their website. After, add it to sources.list file, do the following command in Terminal. (you can use other GUI players instead of smplayer)
sudo apt-get install vlc mplayer mozilla-mplayer smplayer w32codecs

I, also, recommend uninstalling totem.
sudo apt-get remove totem totem-common
totem-gstreamer totem-mozilla totem-plugin

After finishing install, Smplayer can play a movie mediately, but it requires a little configuration for Firefox. Finding some video test page, I google and use this page[2]. In my computer video doesn't show up, I have to change video output to x11 by right click on grey background -> configure -> x11 from Video Output drop down list. Done, you have nearly perfect movie player with Ubuntu Intrepid.

mplayer playing in firefox with video output setup to x11.


Resources:
[1] - https://help.ubuntu.com/community/Medibuntu
[2] - http://home.att.net/~cherokee68/wmvtest.html