Wednesday, September 26, 2007

R500 Fingerprint sensor, Bluetooth, and Volume Control

Coming across this page on an R500 gentoo install gave me some things to try:

http://www.pervasive-network.org/SPIP/Toshiba-Portege-R500-10N-sous

First, the command
sane-find-scanner
produces the output
found USB scanner (vendor=0x08ff, product=0x1600 [Fingerprint Sensor]) at libusb:002:003 # Your USB scanner was (probably) detected. It may or may not be supported by # SANE. Try scanimage -L and read the backend's manpage.
...so it should be possible to use.

Second, the bluetooth patch at http://www.sfires.net/toshiba/ is required. It was written for 2.6.14 and of course fails on 2.6.22. Manually applying the patch succeeds, but no HCI finds no bluetooth devices..

Third, the xmodmap entries are provided, making the Volume Control fix a no-brainer.

Changes to /.xmodmaprc:
keycode 160 = XF86AudioMute keycode 174 = XF86AudioLowerVolume keycode 176 = XF86AudioRaiseVolume
Changes to ~/.xbindkeysrc :
"amixer -c 0 set PCM 2dB+" XF86AudioRaiseVolume "amixer -c 0 set PCM 2dB-" XF86AudioLowerVolume "amixer -c 0 set PCM 0" XF86AudioMute

Firefox Addons

You think you only run a handful of extensions until you stop and check:

Adblock Plus : Absolutely required; should be built-in.

Aging Tabs : Colors tabs according to age. Might remove this one.

All-in-One Sidebar : For the Opera enthusiast. It's a bit much, and might be removed, but it does look pretty useful.

Anonymization Toolbar : Goodies for the paranoid.

Clipmarks : Select portions of a web page to print, save, or stash online. Sounds great, but it's surprising how rarely one uses this.

Console^2 : Advanced Javascript debugging console.

Controle de Scripts : Fine-grained control over Javascript permissions.

CustomizeGoogle : Control all sorts of stuff that "do no evil" Google does behind your back.

del.icio.us Bookmarks : Yeh, del.icio.us is annoyingly web 2.0 and lifehackery-smug, but it's still useful for sharing bookmarks across multiple machines.

Dictionary Search : Select text and look it up in a dictionary (opens in a new tab). Up two four dictionaries can be configured: very nice.

Distrust : A paranoid mode for Firefox; when exiting Distrust Mode, all history, cache, and cookies collected since turning on Distrust Mode are deleted.

DownThemAll : Download manager for repetitious tasks like saving all the images or videos in a page.

Extended Cookie Manager : Status bar icon for allowing/preventing cookies from a site.

Extended Statusbar : Status bar text that shows why a page is taking so long to load.

Fasterfox : Modifies ffox to make it behave more aggressively and load pages faster.

Firebug : Turns ffox into a debugger for web development.

Flashblock : Another required add-on: replaces Flash applets with a play button, so they do not start automatically.

Flat Bookmark Editing : More from the "why didn't Mozilla think of this" dept: this modified the Bookmark Manager so you can edit bookmark properties without having to open a separate dialog.

Grab and Drag : Replaces the cursor with an Acrobat Reader-style hand so web pages can be "grabbed" and scrolled like PDFs.

iDND : Required anti-spoofing add-on that shows an icon on the statusbar which is either green (traditional domain name) or blue (international and potentially-spoofed domain name).

iMacros : Automate web tasks with macros. Haven't played with this enough yet to recommend it whole-heartedly.

Image Zoom : Straightforward; allows you to zoom images.

JSView : View the source of all Javascript being executed by the page, even when the Javascript is in external files.

Load Time Analyzer : A simple toolbar for measuring the performance of your web pages.

Map+ : Context menu item that looks up selected text (presumably an address) on Yahoo Maps.

NoScript : Absolutely required! Allows you to control the Javascript permissions on a per-page basis. Disable JS for all sites by default, then use the NoScript statusbar icon to enable JS for specific domains (either temporarily or permanently) as you go.

PopupMaster : Statusbar icon for managing popup windows. Who really likes popups, anyways?

ShowIP : Shows the IP address of the current page on the statusbar, with options for doing a whois lookup and so forth.

TabScope : Shows a mini-preview of tabs on mouseover, with navigation (forward, back, refresh, close) buttons. Can slow down navigation if you have many old (i.e. cached to disk) tabs open.

TamperData : Very useful Sidebar window for viewing and modifying CGI parametersand HTTP headers.

Torbutton : Statusbar icon to toggle Tor for the paranoid. Requires tor and iproxy to be installed.

Torrent Finder Toolbar : If you like torrents (of course no-one does), you'll love this.

TrackMeNot : A curious tool for the paranoid that attempts to fight search engine profiling by generating random search requests from your browser. Incorrect settings will slow down your browsing.

URL Link : Context menu item that opens selected text (presumably a URL) in a new tab. Good for plaintext files and websites who forgot to wrap their links in A tags.

UrlParams : Similar to TamperData. This shows the CGI parameters (GET and POST) for the current page in the sidebar, while TamperData is used to set parameters for pages you are about to surf to. Run them side-by-side to see the difference.

View Source Chart : Displays the HTML source of a web page in easy-to-read 'chart' form. Has to be seen to be believed.

Web Developer : The most useful add-on for dealing with annoying sites or developing web pages. Provides a toolbar with menus for manipulating web page images, stylesheets, cookies and forms, as well as for viewing details of the underlying HTML. Highly recommended.

Zotero : Tool for academics, though it is useful for anyone doing online research. Provides a catalogue for saving and annotating (instead of just bookmarking) web pages, emails, files, etc.

Obviously this selection will be overkill for most people (how many paranoid developers with a research background are out there, anyways?). If for nothing else, install all of these to really test how poorly ffox can be made to run on your system.

Tuesday, September 25, 2007

R500 Wifi and ACPI

The wireless card is an Intel 4965AGN and needs drivers from http://intellinuxwireless.org

Applying this patch to 2.6.22 from kernel.org works, but causes suspend to no longer work. Turns out Ubuntu provided the patch from http://memebeam.org in their kernel.

Initially, though, I discounted this patch because the version number did not match the one in the Ubuntu code. Attempting to build the Ubuntu kernel with the Intel wireless patch proved to be quite a challenge, which is chronicled below for the amusement of others.

In the end, I have decided to use my own build of the 2.6.22 kernel with patches for ACPI and Wifi. I just can't trust the Ubuntu kernel source after my experiences with it.

Patching Ubuntu

First, get the kernel source, unpack it, and make sure it compiles:

apt-get install linux-source-2.6.20 cd /usr/src tar -jxf linux-source-2.6.20.tar.bz2 cd linux-source-2.6.20 make menuconfig make-kpkg --initrd --append-to-version=-mkfs kernel_image

The first thing you will notice (assuming you modified the kernel config) is that Ubuntu does not ship working kernel source. I ran into the following two bugs:

https://lists.ubuntu.com/archives/ubuntu-bugs/2007-March/456610.html
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/86725

Note that Ubuntu has fixed neither of them, trivial as they are, and gives the following excuses:

We don't use this because it is marked experimental. We do not guarantee that our source compiles for users with alternate configurations from what we use to build our own kernels.

It fails because you enabled an option that is broken. We don't guarantee alternate builds of our source. (Note: the config option is not marked as broken or experimental, and is in fact in the Ubuntu Additional Drivers section.)


This is without a doubt the most mind-numbingly inane response to a bug that I have ever heard. Why ship the kernel source at all if changing a single option in the config file (to optimize for a specific process, for example) can cause the build to fail? Talk about following the letter of the law, not the spirit!

In any event, fixing those bugs as documented (one by adding a #define in C, the other my simply not using the driver) lets the kernel compile successfully. Now to for the wireless driver.

ln -s /usr/src/linux-source-2.6.20 /lib/modules/`uname -r`/source cd /usr/src/mac80211-10.0.0 make SHELL=/bin/bash patch_kernel

That went well, let's rebuild kernel...
net/built-in.o: In function `__crc_iw_handler_get_thrspy': (*ABS*+0x8f9b701d): multiple definition of `__crc_iw_handler_get_thrspy' net/built-in.o: In function `iw_handler_set_spy': (.text+0x6d810): multiple definition of `iw_handler_set_spy' ubuntu/built-in.o:(.text+0x1090): first defined here net/built-in.o: In function `__crc_wireless_send_event': (*ABS*+0xeb8cff4e): multiple definition of `__crc_wireless_send_event' net/built-in.o: In function `iw_handler_get_thrspy': ...

Oh, bitter defeat!
It looks like Ubuntu's added in MAC80211 code is conflicting with the Intel MAC80211 patch. Disabling either in the config has no effect.

Let's trust the Ubuntu MAC80211 to be the same and hope everything just works. Using an unpatched version of the kernel, apply the IWL-Wifi patch

cd iwlwifi-1.1.0 make SHELL=/bin/bash patch_kernel

Turns out this doesn't work, because the Ubuntu MAC80211 code is not where the IWL-Wifi patch expects it to be. After a bit of poking around in the IWL-Wifi scripts and Makefile, it looks like the following changes will work:

  1. In the Makefile, change the line 'export KSRC ?= /lib/modules/$(shell uname -r)/source' to 'export KSRC ?= /lib/modules/$(shell uname -r)/source/ubuntu'
  2. ln -s /lib/modules/2.6.20-16-generic/source/drivers /lib/modules/2.6.20-16-generic/source/ubuntu/
The first change causes the patch to look in the ubuntu directory for the MAC80211 code, the second causes the driver code to be installed in the correct location.

This builds successfully. Suspend-to-RAM and Wifi now work correctly. No good news on the suspend-to-disk front, which is unusual as that should be the easiest suspend option to make work (it's just a file on the swap partition fer chrissake!).

Update: The main problem with suspend-to-disk is reported here : https://bugs.launchpad.net/ubuntu/+source/udev/+bug/105490
Unfortunately, even after fixing the swap partition in /etc/fstab, the system locks up on resume unless using 'Recovery Mode'.

Some background

An interminable period of time ago (two months), I ordered one of the new Toshiba ultralights to replace my aging Sharp Actius MM20 (a fine machine).

Toshiba Protege R500
Toshiba RX1 (Dynamism)
Another owner's R500 review.

64 GB SSD, extended battery, RAM upgrade, no DVD drive. Almost no moving parts (only that pesky CPU fan, which the Actius managed to do without). Pricey.

A few weeks ago it arrived the day I left for vacation (argh!). One week ago I returned and installed Kubuntu on it. The immediate results: suspend-to-ram worked (suspend-to-disk, not so much), X worked, sounds worked, ethernet worked, touchpad worked, USB worked. Not working: SD reader, volume control, brightness button, 'i' button, fingerprint sensor, wifi.

The past few days have been spent getting e17 installed and my standard working environment set up. Time to tackle those device issues.