Archive for April 2006

How to protect your voice

2006-04-20

This livescience.com article provides some tips on how to protect your voice cord, reducing damage after prolonged talks — very useful for teachers.

Links about Logitech MX1000 mice support under Linux

2006-04-18

When Logitech MX1000 mice was just out, its Linux support is mediocre at best, I’d say. During early days (when there is no good evdev support both on kernel side and on Xorg/XFree86), the best reference on how to make it work was in linux-gamers.net (the old page documenting Gentoo hack was gone; and don’t be disappointed, it gets a face lift. This new shiny page details the most recent situation).

Logitech MX1000 mouse

Kernel: The necessary evdev support is only getting its shape in recent 2.6.x versions. 1-2 years ago it was still in embryo form, and not very usable. Right now it’s much better; but still, I got strange result from evdev. More on that later.

Xorg: During 6.8.x days, the Gentoo hack was the best attempt to make it work; right now the generic evdev input driver works better in Xorg 6.9/7.0. But getting the correct xorg.conf setting isn’t easy. So far all of the xorg.conf snipplets suggest using a hard-coded device, but I liked the old Gentoo hack that supports using device name instead, like:


Section "InputDevice"
  ......
  Option "Dev Name" "Logitech USB Receiver"
  ......
EndSection

In that way there is no need to attempt finding the correct device name, which may change from time to time (this is especially the case for me, since I’m only using MX1000 at home as CorePointer). Hope the XInput hotplug support, after implemented, makes mice really “plug and play”, without restarting and restarting and restarting X…

Besides, there is apparently no evdev document, at least both in my Ubuntu Dapper system and in wiki.x.org. Luckily, there is at least one manpage in freedesktop bug report, but that goes to debian only so far.

Configuration tool:: I really can’t understand why people were so happy using logitech_applet. I did try it (and in fact tried to tweak its Mandriva package as well). Yes, it found my mouse, but determined the mouse is a 2-button mouse without wheel! Feeling disgruntled, the next one I tried was lmctl, which was much, much better. At least it detects my mouse correctly, so I keep tweaking lmctl package, including borrowing patch from logitech_applet, and make it execute through udev. Later I give up because of change in udev and incompatibility between udev and my older kernel.

However, today I just rechecked the facts, and found that there is new effort called lomoco, which is a fork of lmctl. Not really sure if I can see it merged into Ubuntu universe, since version freeze has been in effect for long time already. Anyway, it has support for some newer mice like MX518, so probably it’s beneficial to go in despite the freeze.

OK, back to the docs. Indeed, some of the best references are still from www.linux-gamers.net (Mice and Keyboard section); the one from floam.sh.nu is also quite good though a bit aging. OTOH, there is another blog entry I really like, as it gives more detail about customizing buttons and browser (firefox) settings. And yet another blog entry suggests adding -no-jump-pointer -no-repeat -xsendevent options to xvkbd.

Anyway, all documents point to 2 critical tools: xvkbd and xbindkeys. Without them all the buttons beyond 7th one can’t be used, except for some particular window manager like openbox which can define custom mouse binding. And of course you might need xmodmap. However, for some unknown reason xvkbd and xbindkeys don’t provide robust performace for me during the old days (using Mandriva); they worked for a while, then completely stopped working as if they were stale, and refuse to work again unless I kill X window and relogin. Haven’t tried them again since I install Ubuntu; let’s see.

And it behaves quite strangely now when turning on/off cruise control. With the help of evtest, a little piece of code for evdev testing, I’m able to look up what happened during mouse clicks and wheel scrolls:

Cruise Control On Cruise Control Off
Cruise Control upper button 0×116[BTN_BACK] pressed
Wheel up…
0×116[BTN_BACK] released
0×116[BTN_BACK] pressed
 
0×116[BTN_BACK] released
Cruise Control lower button 0×117[BTN_TASK] pressed
Wheel down…
0×117[BTN_TASK] released
0×117[BTN_TASK] pressed
 
0×117[BTN_TASK] released
Wheel tilt left 0×118[?] pressed
Horiz Wheel left…
0×118[?] released
0×118[?] pressed
 
0×118[?] released
Wheel tilt right 0×119[?] pressed
Horiz Wheel right…
0×119[?] released
0×119[?] pressed
 
0×119[?] released

(These buttons are defined in linux/input.h.)

My point is not to question the bogus events before and after cruise control buttons, which are well known; the problem is, without cruise control, horizontal scrolling simply won’t work! Even xev remains quiet when the wheel is tilt — no event at all.

Yet with cruise control the bogus key events can’t be eliminated; there has been some hacky C code that remaps these button 11/12 events to wheel scroll, but I don’t like it.

For me at least both vertical and horizontal scrolling works fine in GNOME desktop (haven’t tested KDE), and in Firefox. That meets my basic need, and I’ll take some time to make the other buttons work later.

2008-01-26 Edit: The content above is outdated. Currently all such mice are intended to be supported via evdev. However, evdev makes this model of mouse even less functional than previous hacks, thus I already gave up using any extra buttons. Right now I always only use this mouse under Windows.

Teaching Minesweeper

2006-04-12

Sounds an interesting subject, huh? :-) After OSFarm course yesterday, I have spent a few minutes teaching expert techniques for minesweeper, since some of the students are quite interested in it (and almost played minesweeper during the whole course, sigh). Though I explored all of the skills myself, the occasion inspiring me to discover all these was still memorable — the joint school science exhibition during F.6.

During that exhibition (I don’t want to mention my crappy “formula” about how to design an energy-saving tunnel again), one of the most excited occasion was when one of the students from another school was playing minesweeper on computer. He teached me how to analyze patterns and mine locations, which inspired me to formulate it later.

Another occasion was when Rachel and me saw another school using line printer as the axis of rotation for a circular piece of paper — this was the first (and last) time I clapped my hands involuntarily.

最後一站——加拿大

2006-04-02

3 月 28/29 日

  1. 睡覺。
  2. 吃晚餐。
  3. 睡覺。
  4. 吃早餐。(還要是 McDonald,哼)
  5. 睡覺。
  6. 睡覺。
  7. 睡覺。

3 月 30 日

不再睡覺。

如果連最後一天都是睡覺,那真是要羞愧自盡了,所以怎樣累也爬起來走走。只是我一直以來都未坐過温哥華的巴士,連要到甚麼站也不知道,心目中也沒有目的地,這樣就上了車,嘿,我真是大膽。幸好旁邊的婆婆很好人,替我和司機說,待我看到 chinatown 時下車。

窮奢極侈的下午茶

整天的主旨是:發癲。在 chinatown 下車後,徒步 4 小時,横越了 chinatown 和 downtown 到某個大公園(Stanley Park),叫了一個二十幾加元的下午茶(!),再徒步到火車站,坐火車回酒店。吃完這麼一個「豐富」的下午茶,最後的晚餐卻是杯麵了事。

3 月 31 日

氣死我,在加拿大消費本可以退稅的(銷售稅重得不得了,雙重銷售稅加起來是 15%),但是我還欠一元才有資格退稅。但即使能夠退稅也沒用,那些甚麼「幫」人處理退稅的公司,最低手續費已經要了我所有退稅的款項,到頭來我還是會一毛錢也得不到。

出了酒店門口,在的士和巴士之間掙扎,到最後還是選了的士,一到機場就知道這是正確的選擇。我看錯了上機時間,如果乘巴士的話(不用說,我完全不知道要在哪個站下車),就保證回不了香港。

在飛機上倒是一點也不覺得悶,因為坐在旁邊的人很健談,她也到過香港(聽說是回馬尼拉探親),雖然是萍水相逢,但交談起來很開心。只不過那 15 小時的飛機不是說笑的,坐得很辛苦,睡得頭也痛了。

不過即使回到香港,噩夢還未完。不知發甚麼瘟,一上車就睡,醒來已經發覺自己身在天水圍。可能是我坐錯了隔鄰站的巴士。無論如何,這時再坐的士就太那個了(現在聽到的士這個字就會發噩夢),所以轉了三程巴士,回到大埔已經是深夜……

來來回回來來回回來來回回……

2006-04-02

3 月 25 日(毛毛雨)

昨天探完路後,今天終於出發,由渡假村旁的旅館回到 central London。昨晚樓下的小姐還說可以行李可以暫時留下的,今天的肥婆竟說不可以,又被騙了。沒辦法,本來還想到對面的渡假村上網,唯有取消,立刻就走。雖然沒有高估了由旅館到車站所需的時間,不過我真的不知道走這趟路是否值得了,這 40 分鐘辛苦得很,或許應該和同班的人一樣乘的士離開還好。到了火車站,剛巧「送車尾」,等了大半小時才有第二架出發到倫敦市中心。

King’s Cross 差不多可說是全倫敦交通樞紐,地鐵的幾條線和兩條火車線都在那裏有站,我是想選那裏的酒店,不過 book 了酒店房才發覺酒店根本不是在 King’s Cross,而是整整隔了一個站。但旁邊就是大英博物館了,所以就放過它。

到了酒店才知道,之前那間旅館原來比這間還好。這裏甚麼都是錢,在房內上網貴得很,而且連登出後也要計錢,所以打算最後一晚才申請戶口。不只房間小很多,最不滿意的是很多東西都鋪了塵,好像完全沒人打理似的,洗手盆像是半淤塞狀態,浴缸又殘舊,總之覺得是黑店一間。

到達後倒頭就睡,醒來已是半夜。好好的一天就這樣過了。

3 月 26 日(毛毛雨)

早上到樓下的餐廳吃完早餐後,就出發到大英博物館拍照,想不到是那麼大的,遊了三四小時,買了些紀念品,連兩粒相機電池都用盡了,竟還未看完整個博物館的一半;不過也沒辦法,既然無法拍照了,就唯有回酒店(步行五分鐘 :-))再充電。

本來打了如意算盤,下午在博物館映多些相,就立刻到圖書館申請圖書證的,不過自己該打,因為之前一晚沒睡,捱不住稍為歇息一下,就這樣過了幾個鐘,醒來急急到圖書館,果然關門了,唯有回酒店放下些東西,再圖後計。

之後決定了到 Covent Garden。那是個很多人到的市集,有些江湖賣藝的,還有很多像香港商場內一些木架搭成的小攤檔,食肆總類齊全。但我一到就發覺自己傻了:1) 沒足夠現金;2) 沒帶相機。最麻煩是要提款的話必須找滙豐,在圖書館附近才有一個能用的櫃員機(別的地方的滙豐櫃員機全壞了),又要回酒店拿相機,最終的確是再到 Covert Garden,但大部份店舖都關門大吉了(星期天,沒辦法)。

唯有在那裏找個地方坐下,叫了個燒雞胸吃,味道不錯的,只是有點淡(可能因為我沒加鹽)。Cappuchino 也不差,只是最後承着杯的鐵環掉下來,弄得咖啡一桌都是。好像那間特別收費了一點,不是加一而是加一點五,但兩天來只有這餐比較吃得好一點,就算它吧。

晚上以為還有時間,就回酒店歇一下,再計劃下一站目的地。由於所有旅遊景點都應該已經關了門,所以唯有到公園之類的地方。盲沖沖地到了其中一個公園,不過碰壁了,因為公園是沒街燈的,伸手不見五指,唯有回頭。

今天就這樣乘地鐵來回酒店不下十次,有點討厭自己為甚麼那麼渴睡又善忘。幸好乘 100 次地鐵的價錢和一次差不多,否則我就玩完了。

不知是昨天還是今天開始了日光節約時間,本來還奇怪為甚麼我的時間和地鐵站差了整個小時,後來一想記得 Michael Vogt 好像說過是這兩天內轉時間的。

3 月 27 日(毛毛雨)

London Eye

開始討厭這裏的天氣,竟然是等到我有時間消閒的時候才天天下雨。但無論如何,這是最後一天在倫敦,不到處逛逛實在對不起自己,所以狠下心來走了很多處地方,最記得是到 Waterloo 的大摩天輪(稱為 London Eye)。那裏花了不少時間(排隊)和金錢,但整個景觀無與倫比,是拍泰晤士河和國會大樓最好的地方。

到摩天輪之前,還花了不少氣力找皇家音樂學院所在地,看看有沒有甚麼值得看的,到最後找是找到了,不過沒東西看,浪費不少時間,不然整天可以參觀更多地方。旁邊好像也是旅遊景點(後來才知是 Madame Tussaud’s,是間蠟像館),不過不理那麼多了。

Big Ben

然後是過河到大笨鐘國會大樓。後來覺得奇怪,自己為甚麼當時完全沒有想到入西敏寺走一走,雖然那時很可能已經關門。沿路一直上,那區集中了大部份政府中樞部門,就這樣行到 Trafalgar Square 才停下。入了旁邊的 National Gallery,因為差不多要關門,而且裏面好像不能拍照,所以走馬看花地遊了幾分鐘就走。

隨後就是亂來的時間,簡潔一些說,就是為了想坐船遊泰晤士河,而連續跑了幾處到過甚至未到過的地方都不得要領(觀光船要預約的),最後漫無目的地徒步由 London Bridge 走到 Tower Bridge,過橋到 Tower of London,再遊魂一會才離開。