Thursday, February 25, 2010

Followup on Super Hybrid Engine (SuperHE) on 1005PE

The solution for enabling SuperHE is trivial, for my purposes at least.

A modern kernel should load the eeepc_laptop kernel module, and this has support for SuperHE out of the box. UNR and other distributions will not enable it however. That's up to you.

The eeepc_laptop module exposes an interface via the sys filesystem.

#echo 2 > /sys/devices/platform/eeepc/cpufv

Will turn it on. (Note it's done as root.)
In order to have this be the case after a resume from suspend or hibernate, you have to add a bash script to the power management tools, located in /etc/pm/sleep.d

All scripts in this directory are called when your system sleeps or hibernates, or wakes up or resumes. It is passed a parameter matching that action. Resuming from sleep is "resume", and waking up from hibernate is "thaw".

case "$1" in
echo 2 > /sys/devices/platform/eeepc/cpufv

I named this "10_superhe" as the other scripts were prefixed with a "10". My guess is it deals with ordering, much like the init system. It shouldn't really matter. Make sure it is executable "chmod a+x 10_superhe" and that should be it!

When my system resumes or thaws, there is an extra half second pause (this would always happen when enabling superhe), and so I could tell it was working. You can verify by "cat cpufv" within the eeepc directory.

Note that this won't run after a traditional boot. You can use rc.local or your .xinitrc for that. Note also that this makes SuperHE on maximum power save all the time. That is how I want it, as if I'm using this thing, I'm on battery. It charges near my desktop. I'm sure this script could hook in to laptop_mode or maybe even cpufreqd if you want superhe only on when on battery. It is possible that this would then only be enabled upon switching to battery, and wouldn't persist past a resume. In that case, you would have to use a more complex system that would track battery state.

Saturday, February 20, 2010

.name, what a shame...

I recently registered a second domain name and considered using a more esoteric tld, and in doing so came across ".name". It's pretty interesting, if you look at the Wikipedia entry. The idea was that every person could have their own domain, free and clear.

Unfortunately, ICANN messed things up and didn't regulate it well, let only certain people get second level domains which only others could register third-level. That kind of fell through and now .name is as open as .info and .com.

Kind of a shame. When you think of it, the entire concept of the domain name industry is a bit odd. All you're doing is paying for the right to use a DNS entry, really. How cool would it be if we could all register our own .name, and have it point to what we want. ISP service comes with email, and it used to come with some news and web space, shouldn't it come with some DNS entries too? The lack of a simple and universal system like this is one of the reasons for why social presence on the internet consists of a multitude of walled gardens. The web itself should have become our social network.

And if .name seems kind of crazy, take a look at ENUM. It's another system that has been proposed to be built on top of DNS, using a record to store a number of phone numbers, both PSTN and VOIP, to a single number. Never built, but things would have been different. As it stands, Google Voice is the closest thing we have to that.

Asus eeepc 1005PE and Ubuntu Netbook Remix 9.10

Six months ago, I decided to go from my Thinkpad S30 and Z60m to a Desktop + Netbook combination. One machine for portability and one for grunt seem to be the best way to do things, but my grunty Z60m was getting old, and my portable S30 was positively ancient.

With the incredible pricing of Netbooks, down in the $300 range, and fast capable Desktops being possible for $400, this seemed like the better option than a $700 laptop. Component pricing has come way down, and I built a lower wattage, near-silent desktop in a nice MicroATX form factor. I thought I was done with desktops, but they have their place.

I chose the 1005HA for my netbooking. There were a number of sub-versions that weren't very well documented. It came in 3, 4, and 6 cell versions, and I opted for the 3 cell. Rated for 4 hours, under my usage 3 hours was more typical. The problem with only 3 hours of battery life is that you generally won't get 3 hours of usage out of it. After 2 hours, you really feel "on the clock", you know you have to get to an outlet before your machine hibernates itself. If that's the case, what's the point of a netbook? I would just seat myself near a power outlet, and cross my fingers that someone wouldn't trip on the cord. You have a nice svelte 2.8lb. machine, and another half pound of charger. I regretted not getting the 6 cell version, but even 6 hours isn't enough. I want to go somewhere and program all day, without worry.

Enter Pine Trail and the 1005PE

This also has many versions, (1005P, PE, PE-P? I forget them all. The PE has an MU17 and PU17 subversion.) and there is also the accompanying 1001P. It seems like only certain versions are available in certain locations, and vary by battery type, bluetooth, chiclet keyboards, and glossy screens. I think some lack wireless N as well.

I upgraded to the 1005PE-PU17, which is the grand-daddy of them all. Only $370 or so with free shipping from newegg, it seemed like the better deal. For some reason it is rated for a 14 hour battery life, while other 6-cell versions are only rated for 11 hours. I don't quite know what differs, but I've learned the importance of time away from an outlet. After migrating my data over, the 1005HA is now going to go on eBay. I estimate that my total upgrade cost will be around $150. Not bad, I could do this every 6 months if I had to. (So long as the upgrade were compelling enough.) Other than the new CPU, battery life, chiclet keyboard, bluetooth, wireless-n, and glossy screen, this thing is nearly identical to the last one. The logo on the back is the more professional ASUS one, instead of the cursive "eeepc" one. I like it. I'm told that this may have support for 3G wireless too. I would remove the battery and look for the SIM holder but I'm on battery life right now. I don't have a need for that, but that could be useful down the line.

Most of the battery life enhancements are due to the new Pine Trail chip. When Intel made the Atom, they focused on the biggest power draw in a system, the CPU. While they managed to reduce the cpu power draw to 2.5W, the chipset and io controller would be an additional 9.3W, for a total draw of 11.8. For Pine Trail, these parts became the new target. Pine Trail CPUs integrate the CPU and "chipset" onto a single die, along with the GPU. The new package has a power draw of only 7W.

My guess is that this is while running at full power as my total system draw is down to 5.0 +/- 0.5 Watts. Fully charged, my system tells me that I have 13 hours remaining, but it quickly drops to 11 hours, and that seems most accurate. The quoted 14 is probably with less wifi, dimmer screen. I used to resort to setting the screen at 30% on my 1005HA, now I happily set it around 70%. Bluetooth is off, but it's nice to have it for when/if I need it.

New Operating System(s)

One other difference I didn't mention is that the button that used to disable the touchpad is now a second power button for the ASUS ExpressGate. The touchpad disable button is now fn-F3. By default there was a roughly 10GB partition at the end of the disk, which I think was a combined restore/quick OS partition. I'm mixed on these secondary operating systems. I like how they are pretty much all Linux based, and provide a new convenience to people. They illustrate the weakness of booting speeds to the normal Windows operating systems. But a second OS is not the answer, I think it's best to simply make the first OS better. A secondary operating system wont share your browser bookmarks and history and cookies, and is just another thing to configure. It uses up its own space. Plus, Windows 7 is supposedly much faster at booting now. You should also be suspending/hibernating. It takes 10 seconds to resume from a hibernate, so why boot into expressgate? As an emergency/restore option that sounds good, but I still think that the answer is to make your first OS good enough to where you should never need to restore.

It came with Windows 7 Starter, which is a horrible excuse for an operating system. Microsoft is practically begging people to install Linux on netbooks with that offering. After a rough start for the early early adopters, (those that tried UNR on the 1005PE within the first week) things work really well now, 3 weeks or so after this laptop has been made available.

On my desktops and servers, I usually use Debian and Arch, they seem to be the best fit for me. But as the number of computers I have scales up, the hassle of maintaining things escalates exponentially. While I love tiling window managers, I don't have the time to spend a day installing arch and awesomewm on this thing. Plus my netbook is very likely to be borrowed by a friend. It's handy to have a guest account that uses Qwerty (Instead of my usual Dvorak.), that will connect to WPA2 networks without editing wpa_supplicant to get online. My netbook is the "public face" of linux for me, and I want to show it in the best light while reducing my own frustration. A more comprehensive distribution like Ubuntu is the best fit for this purpose. But with the tiny screens and resolution, a maximizing window manager and simplified launcher is ideal. I am more impressed with UNR every time I use it. Fewer clicks and less touchpad usage to do what I need. I just wish Firefox came with screen real-estate minimizing plugins and themes by default.

The official UNR compatibility page lists the few small steps you need to take to make your 1005PE run just fine with Linux. You're basically installing the latest kernel modules to fully support wifi without dropping out. I actually had that problem on my 1005HA, I wish I had upgraded then. (It would work for 20 - 60 minutes before cutting out completely. Restarting network manager and reloading the kernel module was necessary to fix it. I would usually just restart.)

Two issues remain

The first is the screen brightness buttons. They work, but irregularly. This problem is known, but no easy fix seems here. I just keep hitting it until I get a brightness I like. It's not that bad. After closing and opening laptop lid, it restores to full brightness, as it does after a suspend. The power options in the settings tab lets it automatically dim the screen due to unuse, but I've unchecked these options. My screen would randomly go to 100% brightness every once in a while, there was no clear pattern to it. Unchecking these options lets the brightness stay where I put it, once I find a brightness I like by playing with buttons.

The next issue is Asus' Super Hybrid Engine. This allows for the frequency scaling of the bus speed and maybe other things. UNR doesn't seem to use it by default. You can install a script for laptop-mode to automatically set these SHE options, it piggybacks on the laptop-mode mechanism. Arch Linux has a good description here, but the basics of it is that the kernel module eeepc_laptop supports SHE, but most userland environments never enable it.

More Power!

To enable it, check that eeepc_laptop is installed with lsmod. Then as root (sudo doesn't seem to work), take a look at /sys/devices/platform/eeepc/. There's a virtual file called "cpufv". Take a look at what it says with "cat cpufv". You should get a hex number, probably "0x301". The three possibilities are "0x300, 0x301, 0x302", or 0, 1, and 2. 0 is performance mode, 1 is... normal portable mode, and 2 is power saving mode. Simply echoing 2 into the virtual file enables it. "echo 2 > cpufv". This pretty much cut a Watt or two off of my power usage. This setting will not save after a suspend, or a reboot. I don't really want to piggyback on laptop_mode, so I'm looking for the best way to hook this in to the power management tools. Other than SuperHE, the usual cpu frequency scaling appears to work. Unplug laptop from wall, it goes into power saving mode. But SuperHE is really important, it gives me another 2 or 3 hours.

One thing that I set up with my 1005HA was a daemon that would disable the touchpad while typing. "Syndaemon" is the tool. This was preferable to manually enabling and disabling the touchpad. As it stands, the fn-F3 button combination do nothing. After all, it just generates an ACPI event that you can bind to whatever you like. For that matter, fn-space, fn-F7, fn-F8, and fn-F9 don't do what they are labeled as. That's fine as their functions are free to do whatever I want them to do. I think in windows they only work after installing Asus software. I'm not to keen on the function key alternates in general. I prefer using the Gnome/Ubuntu shortcut keys anyways for most things.

Speaking of they keyboard, I really am liking the chiclet style. However, the right shift key is no longer full sized. It's now cut into three buttons - shift, uparrow, and a second fn key. The old 1005HA had the up/down buttons half sized. I preferred that as it let me have a real shift key. I may wind up rebinding up arrow to shift as well. That's trivial in Arch/Debian with xmodmap, but I have to find the "right" way to do it in Ubuntu.

Two other things I've done to extend battery life. One is to lower the tx-power for my wireless card. "iwconfig wlan0 tx-power 15". This sets the wireless card to 15db instead of 20db. It appears to have given me an extra hour. I want to play around further with this, and see how low I can set it and have it still work well. I suspect that this is what I need to do to get the full rated 14 hours under Linux.

One additional issue I saw was the SD card reader. If you have an SD card in your reader, your system will consume an additional Watt of power! Whether the card is mounted or not. My guess is that this is hardware-related, not OS. Probably why my 1005HA didn't do so well with power, I always left a handy SD-card in there. Don't do that.

I played around with PowerTop to see if it offered any additional advice. It did, but they didn't seem to extend my battery that much. Plus its a hassle to implement all of its advice in a way that will persist beyond restarts/suspends.


Overall, the 1005PE truly allows for all-day computing. With wifi/bluetooth off, screen fully dim, idling, this thing could probably sit there for 20 hours. That's impressive, if not useful. To get 11 hours of real usage out of a machine is incredible, and it has revolutionized the way I work. I feel as if I just got a laptop for the first time, my last machines were still very much tethered. Now I can go anywhere I want, all day, and I leave my charger at home.