Tips on laptop’s built-in microphone for KDE

July 28th, 2007

Tags:

I supposed that my T40’s built-in microphone was ruined(for this is a two-hand thinkpad). But accidentally, I found it works well…
And here are some tips for laptop’s built-in microphone on KDE(KMix):
1. You can test if you microphone works by click the green point below the mic icon(Input tab) to make it light and connect the input of microphone to speaker, then flap your Mic. But be careful, if you use built-in speaker, the treble voice would be generated if you adjust the volume to more than level 3. So, in the normal use, please close the microphone output to speaker(except you use headphone).
2. You can enhanced the microphone output. Click Switches tab in KMix, and select Mic Boost +20dE. But don’t make microphone connect to built-in speaker with this.
3. If you still not content with the result, you can set the Capture of Input tab to maximum.
4. You can also use vumeter -r to see the recode volume level.

I got very perfect result with disable Mic to output, using Mic Boost and using built-in speaker.
Good luck!

Get screen blank (Fn-F3) work on debian

July 26th, 2007

Tags:

It’s should be simple to get special key of thinkpad like Fn-F3 work on debian, and if you don’t know, you can see here.

I am using ibm-acpi, and everything goes well, except Fn+F3. I found there is a bug on debian package result in Fn+F3(close lcd) failed. The /etc/acpi/screenblank.sh which was called by ibm-acpi called getXuser from /usr/share/acpi-support/powerfunc, and this script assumed that you boot with gdm/kdm/xdm, so it using something like:

user=`finger| grep -m1 “:$displaynum “ | awk ‘{print $1}’`

to find your current user name. But if you boot from init 2 as me, that’s failed. Finger won’t show “:0″ or some other thing on your line, so getXuser will fail.

I fix this issue with add these lines in getXuser function:

if [ x“$user” = x“” ]; then
user=`finger| grep -m1 “*tty” | awk ‘{print $1}’`
fi

Though it not very precise, it works.

Specifying the kernel booting modules loading order

March 20th, 2007

Tags:

After upgrading to madwifi svn (now released 0.9.3), I found I encountered maybe a seldom problem: the linux kernel module loading order.

In the latest madwifi, it provides three different rate control algorithms, ONOE, AMRR and SAMPLE, instead of only SAMPLE in the previous version. Though SAMPLE is the most advanced one and is used by default, the other two must have ability to take over it’s job. So modules dependency relationship can’t be hardcode into source. But when you insert these modules to /etc/modules for kernel loading when booting, the kernel will take ath_pci first, which depends on ath_rate_sample or other rate control modules. So, the ath_pci can’t be loaded completely success but was still loaded, and reports:

Unable to load needed module: ath_rate_sample; no support for automatic module loading<3>Error loading module “ath_rate_sample”

Then, if you still want to use it, you must reload ath_pci manually, for ath_rate_sample is loaded after ath_pci, but the former didn’t know it, and it can’t specify ath_rate_sample as its depend modules for this can be specify when it was loading.

UPDATE: Thank Matt tell me the real reason: The “automatic module loading” wasn’t open when we compiling the kernel (and in fact error message tell me of that clearly…).
So, please recompile your kernel with “automatic modules loading”(CONFIG_KMOD=y), and recompile your madwifi modules with your new kernel. Then try to load it normally. It’s more useful…
It seems silly to try to load these modules manually… I’m sorry…

SO PLEASE FORGET THE THING BELOW EXCEPT YOU REALLY ENCOUNTER SOME UGLY MODULES…

The only method to solve this is to specify the kernel modules loading order, but the loading order seems can’t be specify simply by /etc/modules (I checked module-init-tools, but don’t understand why it don’t load the modules by order — it meant to do it…). So I add a script in /etc/init.d/ to do this, and link it to /etc/rcS.d/S21load-madwifi.sh(just after module-init-tools)

1 #!/bin/bash
2 #load-madwifi.sh
3
4 modprobe -r ath_pci
5 modprobe -r wlan_tkip
6 modprobe -r wlan_scan_sta
7 modprobe -r ath_rate_sample
8
9 modprobe ath_rate_sample
10 modprobe wlan_scan_sta
11 modprobe wlan_tkip
12 modprobe ath_pci

If you are a debian user, you can simply use:

sudo modconf –load-before ath_rate_sample –load-before \
wlan_scan_sta –load-before wlan_tkip –load-only ath_pci

That’s it.

Xen without pae on Debian Testing/Unstable

March 15th, 2007

Tags:

I am trying to install xen on my debian a week ago, but failed because of that damn PAE build-in debian kernel for xen and my poor Pentium-M without PAE. Today I retried to install xen(now the version is 3.0.4) from source. Follow the README in the package, everything goes well except extremely long time waiting for kernel compiling - it filled kernel with all kinds of driver modules…

I went with option KERNELS=”linux-2.6-xen0 linux-2.6-xenU” first, everything goes well. But when I try to customize kernel and build a linux-2.6-xen kernel(not only a dom0, but also a an unprivileged guest kernel), and reboot it, I found I encountered this:

VFS: Cannot open root device “hda7″ or unknown-block(0,0)
Please append a correct “root=” boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0) (XEN) Domain 0 crashed: rebooting machine in 5
seconds. (XEN) Domain 0 crashed: rebooting machine in 5 seconds.

I double checked my /boot/grub/menu.lst, and it was written correctly. So I looked it for google, and mailing list of xen-users told me that:

The -xen kernel is built with almost all drivers configured as modules; hence you’ll need an initrd including the driver[s] for your scsi or ide controller so you can mount the root filesystem.

So what I have to do is add a initrd for my xen kernel. But later I found that mkinitrd which mentioned in README is out of date. According to the Debian Wiki, debian have switched from initrd to initramfs. So another tool Yaird is introduced. Offical debian kernel package needs initramfs to preload modules that the kernel didn’t build in but as a module(e.g. ext3, ide, input device), just like the case linux-2.6-xen.

It’s easy to get a initramfs with yaird(and also mkinitramfs can be used too, which appears to be more widely used). Yaird’s configure file located at /etc/yarid, but almost nothing need modified in my case. So I only run following command as a sudoer:

yaird –verbose –output=/boot/initrd.img-xen 2.6.16.33-xen

And appended the following line to the xen’s section in /boot/grub/menu.lst:

title Xen 3.0.4 / XenLinux 2.6.16.33
root (hd0,6)
kernel /boot/xen-3.0.gz
module /boot/vmlinuz-2.6.16-xen root=/dev/hda7 ro console=tty0
module /boot/initrd.img-xen

Take care of “module”. It isn’t “initrd”, for xen take over the kernel while booting.

And reboot, everything goes well with your customize kernel.

A vim script for pasting syntax code to webpage

March 9th, 2007

Tags:

Many times when I using my old blog system, I fell in bad mood when I have to mix my source code with content, or no support for source code like syntax highlighted. And when I use vim’s script TOhtml to deal with these thing, I feel that it’s handy, but still not enough convenient. I have to choose and copy the html code by my hand, then add a something like <quoteblock class=”vimblock”>(”vimblock” is a user-defined CSS element, will be mention later) tag to differentiate these code from common <quoteblock>. It’s too inconvenient, also seems easy to be done with a script. So I wrote this.

The script based on TOhtml written by Bram Moolenarr. It convert the current selection to html using TOhtml, then get the body of html and wrap it with <blockquote class=”vimblock”>. In the end, it send the wrapped section of syntax code to clipboard for the further use.
Usage: You need specify CSS for using the code generate by this script.
The default CSS of your schema can be generated by TOhtml, though it will only generate the elements that used by current file, you can find a file with most kinds of elements to generate the basis and modify it when you need more elements.
After generation, just copy the section between <!– –> just below the <style type=”text/css”>, replace element name “body” with “.vimblock” and append it to your CSS file( usually style.css).
After have well defined your CSS, you can use the V and :Yankcode and paste to use this script.

Thanks for the support from Yuxuan ‘fishy’ Wang.

The script can be found at here. And my relate style.css selection is shown below:

1 /* for vim :TOhtml */
2 .vimblock { margin-left: 1.5em;
3 padding-left: 5px;
4 border: 1px dotted #ccc;
5 border-left: 5px solid #ccc;
6 color: #ffffff;
7 background-color: #000000;}
8 .lnr { color: #ffff00; font-weight: bold; }
9 .Underlined { color: #80a0ff; text-decoration: underline; }
10 .Special { color: #ffa500; }
11 .Comment { color: #80a0ff; }
12 .Identifier { color: #40ffff; }
13 .Statement { color: #ffff60; font-weight: bold; }
14 .Constant { color: #ffa0a0; }
15 .Type { color: #60ff60; font-weight: bold; }
16 .PreProc { color: #ff80ff; }
17 .Title { color: #ff00ff; font-weight: bold; }
18 .Error { color: #ff0000; background-color: #000000; }

It drive me mad…

March 3rd, 2007

Tags:

Recently I bought a two-hand T41 with Pentium-M 1.6G. Today I am trying to install xen on my debian (etch). But I am failed by following the regular step on debianwiki, for the reason that pentium-m didn’t support PAE which used to manage >4G memories. I think I don’t have so many memories, so I want to install a xen without pae (and I noticed that it’s curious apt installed package with pae by default), which is package “xen-hypervisor-3.0.3-1-i386″. And kernel package is “linux-image-2.6.18-4-xen-686 “. But I still failed after reboot. It reports that “PAE mode mismatch between Xen and DOM0 (xen=no, dom0=yes)” and reboot in 5 seconds. I tried to find out another kernel package with xen patched and non-PAE support, but found there is no such kind of thing…

Finally I found a bug report for Debian Kernel Team: another Pentium-M user complain about can’t install kernel package with xen. But the bug was tagged “won’t fix”… And the developer said that the xen patch was unstable when using with a non-pae support machine, and it was only appear in some of Pentium-M cores.

God….

UPDATE: I have installed xen from source successful, and everything goes well.

I am disappointed…

August 29th, 2006

Tags:Sebastian Trüg told me there will be no support for me to go Dublin for aKademy 2006. And I surely can’t afford the cost… Tell the truth, I am very sad about this, and I am very disappointed…

Problem on implement category choosing

August 25th, 2006

Tags: I want to build a convenient ui for user to choose categories. Probably, one note has more than one category. At first, I try to put something like checkbox in the KMenu, so the menu shouldn’t close after being clicked. The standard way is put a KToggleAction or set KAction::setCheckable(). But they all would close the QMenu after being clicked.

Then I tried QCheckBox. It appeared in the up-left of menu, but only one is putted. QCheckBox requires a QWidget in constructor, so I can set it to QMenu. The QCheckBox can keep menu open after it was clicked, but I think there will be difficult to implement it well like this.

The qt-4.2 add a QWidgetAction. At first, I think using QWidgetAction can slove this. But later I realized the QWidgetACtion is still a action, and menu may still close after it send clicked signal to QWidgetAction.

Brade told me check QMenu’s code to find reason. I found the source of closing menu after a action was click, and trying to override the mouse event now. If I success, I may commit a update to KMenu. :-)

When I look into QMenu’s source code, I am feeling the power of Open Source….

If I failed, I will choose a traditional way : a category dialog.

The development of KNotes goes too well…

August 24th, 2006

Tags: It’s amazing…

Just two days ago, I was anxious about if I can complete it on time. But after two days work, the process far beyond my imagine.

Now I completed the classified note menu. The categories information was stored in journal object, as it was. So I only set the categories and classified it.

Now click the icon in systray will show sub menus, with different categories name. There is a “Default” categories, which was provided for note with no category. The next step was adding setting function of category. I supposed to implement it as a sub menu with can be checked and unchecked. Also a function provide adding.

In fact, I didn’t store category information. If there is no note with this category, the one will be deleted automaticlly. This design may be changed later. But I think it is proper for no delete function.

Set up schedule for KNote

August 22nd, 2006

Tags: Maybe it is too late for this.

I am very sorry about the delay of KNote development. I am trying to find a balance between my intern job and KNote development. But it seems I am failed in the last serveral weeks. Intern job makes me very tired.

I set a schedule now in order to catch up with process:

8.31 Complete function experiment 9.10 Complete categories first version in KNote 10.10 Complete categories function in KNote 11.10 Complete update in Kontact

The time before Sep 10th is few. I even a little doubt about if I can complete first version on time. But on the other side, I don’t think it is difficult if I am more familiar with KDE development.

I will have a try.