Wednesday, December 19, 2007

Tuesday, November 13, 2007

E17 via

Enlightenment may have the most stable CVS (actually SVN) repository in the business, but their Debian packages (via just flat-out suck.

After upgrading from my initial, stable install, I experienced problems with E17 crashing when the network went up or down (which happens frequently on a laptop). I took the time to upgrade again and poof! No more E17.

Running it from the command line via xinit gives the following error:

/usr/bin/enlightenment: error while loading shared libraries: : cannot open shared object file: No such file or directory

Doing dpkg shows that libecore_evas1 is installed (as is libecore_evas0), but the specified shared library doesn't exist.

A dpkg -l of libecore_evas0 and libecore_evas1 shows the problem:

bash# dpkg -L libecore_evas0

bash# dpkg -L libecore_evas1

Someone forgot to include the .so in the package! Good going, guys.

Monday, October 22, 2007

Ubuntu and Avahi

More from the 'why Ubuntu sucks' front.

Wireless networking has been extremely questionable on this laptop. Sure, the driver works, and if the NIC ever gets around to being configured via DHCP, everything is fine. For awhile.

I first got the wifi up and running with knetworkmanager running under fluxbox. This seemed to work, even though you have to type in the network password every time (kwallet gets started, supposedly to save the password for you, but aside from prompting you for the wallet password I've yet to see this do anything useful).

The problem arose when I moved to e17. No system tray, so no knetworkmanager. Aside from demonstrating a design flaw in the NetworkManager package (only GNOME and KDE systray applets, no Gtk, Qt, or CLI applications), this didn't seem to be too much a problem; just write a shell script that does the ol' "ifdown; iwconfig; ifup" right?

Wrong. The interface can be configured this way, sure, but that has no effect on actually bringing the interface up. The DHCP times out with no response. I started a second Xsession running fluxbox and ran knetworkmanager, without connecting to the network, and went back to e17. At some point in the next half hour (I stopped checking after the first10 minutes), the interface got configured, and the wifi worked fine. I closed knetworkmanager and fluxbox and got some work done, went to sleep, woke up and found the wireless interface has unconfigured itself.

Got bit angry at that; it's a special case of a cardinal UNIX rule: choice of window manager and running applications should not effect the network connectivity of the machine. We're getting into Windows and OS X territory here; Ubuntu is no longer UNIX. Ubuntu is starting to stink of crap.

To wrap things up, I tracked the problem down to Avahi (specifically, avahi-autoipd) and removed it, as I don't have discoverable devices on my wireless network anyways (what fool does?):
bash > sudo apt-get remove avahi-autoipd avahi-daemon
The following packages will be REMOVED:
avahi-autoipd avahi-daemon kdenetwork kdnssd libnss-mdns
I restarted debus, hald, networking (after modifying /etc/defaults/avahi-daemon), and all that ... no dice. Against my better judgement, I rebooted.

After rebooting, my ifdown/iwconfig/ifup script worked just fine. Welcome to Windows, guys!

I'm really starting to wonder why I should stick with Ubuntu over plain Debian. I'm not using their version of KDE or GNOME, since I prefer e17. I had to build a custom kernel for my laptop hardware, and Ubuntu does not allow this (you cannot reconfigure their kernel source package and expect it to compile, something they stubbornly refuse to admit is a 'bug'). I guess the ability to install AVI-viewing software without any pain is useful, though that's really a fault of Debian than a feature of Ubuntu.

For the curious, here is the shell function I use for starting a second X session:

alt_wm () {
if [ -z "$1" ]
echo Usage: alt_wm path [screen]
return 1

[ -z "$SCREEN_NUM" ] && SCREEN_NUM="1"

xinit $1 -- :${SCREEN_NUM}

Wednesday, October 17, 2007

E17 profiles

I finally got around to playing with E17 profiles, which are located under the 'Advanced' section of the Configuration Panel. I kinda figured that, the E guys being who they are, I could use these to toggle between CPU-eating animated backgrounds/icons and normal static backgrounds when the laptop is running on battery or A/C power. I was right!

I put the following script in /usr/local/bin/ :
#!/usr/bin/env bash

# Switch e17 profile based on arg1

# 1. Check if E17 is running
if [ `ps ax | grep enlightenment | grep -v 'grep' | wc -l` -eq 0 ]
# no enlightenment running
exit 0

# 2. Make sure E_IPC_SOCKET is set
if [ -z "$E_IPC_SOCKET" ]
# we are called from outside of e17
E_IPC_SOCKET=`ls -a /tmp/enlightenment-*/disp-*`
if [ -z "$E_IPC_SOCKET" ]
# something wrong with enlightenment!
echo "Cannot set E_IPC_SOCKET!" >> /dev/stderr
exit 0

# 3. Get username to switch to
if [ $# -gt 0 ]
# switch to default

# 4. Switch enlightenment user!
E_IPC_SOCKET="$E_IPC_SOCKET" enlightenment_remote -default-profile-set $profile
This has the usage ` profile_name`, with 'default' being used when no profile name is provided.

I then modified /etc/acpi/ as follows:

function laptop_mode_enable {
# Local Changes ---------------------------
/usr/local/bin/ battery
telinit 4
# -----------------------------------------


function laptop_mode_disable {

# Local Changes ---------------------------
telinit 2
/usr/local/bin/ ac
# -----------------------------------------
There are three changes from the Ubuntu default:
  1. LAPTOP_MODE is enabled (see /etc/laptop_mode/laptop_mode.conf )
  2. The battery runlevel is 4, while the A/C runlevel is 2 (the default)
  3. The e17_profile_switch is called to set the profile to either 'battery' or 'ac'
Obviously the remaining step is to create those two profiles in E17, and set them up accordingly.

The runlevel trick is one I've been using for awhile: I modify one of the existing runlevels to kill off unnecessary daemons, and optionally to run shell scripts (placed in init.d of course) to do things like change the hard drive spin-down time or the CPU frequency governor. Note that laptop-mode-tools provides this latter capability, so my current battery runlevel just kills off services that aren't that important:
bash# ls -1 /etc/rc4.d
Some of these may seem strange choices, but I tend to not use the net when on battery (usually I'm holed up at a coffee shop coding), and likewise I avoid resource-intensive applications (Open Office, KDE, multimedia, etc). If I really want to stretch the battery life I'll kill X, but Acroread and Firefox are a bit useful for consulting documentation.

Monday, October 8, 2007

First Impressions

It's been a month or so, and I've been using the r500 on a daily basis for work (coding, browsing, email, documentation, etc). I've had a bit of time to get used to it; here are my thoughts.

Case/Form Factor
The r500 is just about the perfect size. After the Sharp Actius, I wanted my laptops to be the size of one of those Mead composition books. The size of the display and keyboard on the r500, however, are probably ideal; if this were as thin as the Actius MM20, it would be perfect.

The weight cannot be beat. A friend held it and said "it feels like paper!", another said "haha, very funny, now where is the actual laptop." Even after the Actius, and in direct comparison to the Vaio Tz and G2, this has to be seen (and hefted) to be believed. The slightly larger size is what does it; there is almost no mass to this.

Contrary to the impression of the pre-release reviews, I find the r500 to be quite durable. There is a small bit of flex in the seam at the front of the keyboard, and the case picks up smudges somewhat easily, but I've chucked this in my backpack and hauled it all around town without a problem.

The keyboard is great: decent size, nice and responsive. The touchpad is interesting: it feels the same as the surrounding case, which gives it a bit more traction for your finger. I'd still prefer one of the nipple/eraser/trackpoint mouse jobs, though. Be nice to have those as an option again.

There is a ton of light bleeding from the edge of this, which doesn't bother me, but the viewing angle is VERY bad. Only noticeable when viewing dark colors; the brights are all fine at most normal angles. Using a dark WM theme and sitting on a train seat or a couch, you certainly notice.

Suspend-to-RAM works fine out of the box; suspend-to-disk worked with a fresh kernel compile, though I had to resume via single user mode for some reason. Suspend-to-disk is probably ideal for this machine, given the SD drive. Suspend-to-ram takes 10 seconds or more, and is as stable as every other Linux laptop that suspends to RAM (i.e. one time out of 10 it will resume incorrectly). One downside of suspend-to-ram is that it is a battery hog; I've had the
machine lose 30% of its battery when suspended for 6 hours or so.

The 3-cell battery that comes with this lasts about 3 hours; I haven't tried the 6-cell. I've made some changes to get a bit more life out of this, and may have it at 4 hours for normal usage soon (more for no net/browsing/X). Charging time is horrible, almost as long as it takes to drain the battery. Also been noticing some funny stuff when trying to run down the battery recently: when idle, the laptop will stay at 3-4% (via the 'acpi' command) with 4 or so minutes left for 10 or more minutes.

SD Drive awesome. Fast, fast, fast. For those on the fence, it is well worth the price. Suspend/resume suddenly becomes less important, since booting takes only a few seconds. And suspend-to-disk is suddenly viable.

The wifi works great, no fuss. Ditto for audio, display, lan, usb, etc. The SD reader is one of those "known problems" that should be fixed in the kernel soon (my guess is 2.6.24). The fingerprint reader may actually work, as it is recognized by SANE. I've had no luck with bluetooth, though I've only spent a few minutes on it. And the toshiba ACPI kernel support as used by toshset seems worse with the latest patches; none of the LCD controls work any more, and there doesn't seem to be a way to turn the backlight off (which toshset should perform)
-- so no fun transreflective display.

Wednesday, October 3, 2007

ProActive Record

Been reading Pro ActiveRecord by Kevin Marshall, et. al., in preparation for moving our PHP webapp to Ruby. It's a small book, and arguably one could just read the ActiveRecord source, but let's face it: no-one's going to print that stuff out and read it on the subway.

For anyone doing anything serious with ActiveRecord, such as welding it to an existing, properly-defined (as opposed to rails-auto-created) database, this book is highly recommended. Clear, concise, and thorough coverage with good examples.

I haven't read the chapter on legacy databases yet, but I know from the first 5 chapters that I can make ActiveRecord do what I need it to without too much trouble, which helps a lot in planning this project.

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:

First, the command
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. it should be possible to use.

Second, the bluetooth patch at 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. Bookmarks : Yeh, 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

Applying this patch to 2.6.22 from works, but causes suspend to no longer work. Turns out Ubuntu provided the patch from 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:

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 :
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.