Rockbox and Battery bench.

As cool as it is that I can get my iPod to play Doom and stuff, all that comes with a price; battery life. Noticing that it seems to go through batteries pretty quickly I thought I would take a look at the battery usage of my iPod with a cool little utility included with Rockbox called Battery Bench.

What I did was turn off the backlight and set the player to shuffle play a massive playlist until the battery dies. Battery Bench logs the voltage and whatnot into a textfile in the root directory of the iPod so you can figure out what your player is doing. The result? 5 hours 40 minutes and 42 seconds of playback.

Battery bench results

I am not sure how that compares with other iPod video players but it seems kind of short to me. I have seen people posting results of 10+ hours for other players. Even that time is cut pretty dramatically if I start doing a stuff that involves backlight (i.e. Doom or Arknoid). Ultimately the longevity of the battery is not that big a deal for me. If it gets me to work they I am happy but I am hoping that future versions can improve that a bit (or alot). As Rockbox evolves I will run more of these bench tests and post the results.

Advertisements

Netstat

Netstat is one of those programs that most computer people use but very few understand. Because I am one of those people, I decided to write this to change that. Netstat displays a listing of network connections that and their status which can be very useful for anyone concerned with the security of their machine. Not only does it tell you who your machine is talking to currently but it also tells you if there are programs listening to accept connections from foreign computers. Typically the output of the command is pretty alarming because of the startling number of connections and pretty arcane descriptions that go with them:

C:\>netstat -ano

Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1104
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING 1336
TCP 0.0.0.0:2996 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:3172 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:3173 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:5000 0.0.0.0:0 LISTENING 1672
TCP 74.104.77.xxx:139 0.0.0.0:0 LISTENING 4
TCP 74.104.77.xxx:3071 12.120.5.14:80 TIME_WAIT 0
TCP 74.104.77.xxx:3172 72.14.207.99:443 CLOSE_WAIT 2912
TCP 74.104.77.xxx:3173 72.14.205.83:443 CLOSE_WAIT 2912
TCP 127.0.0.1:2995 0.0.0.0:0 LISTENING 2912
TCP 127.0.0.1:2995 127.0.0.1:2996 ESTABLISHED 2912
TCP 127.0.0.1:2996 127.0.0.1:2995 ESTABLISHED 2912

Probably the most confusing column is the local address column. Your computer always has at least two (and sometimes more) IP addresses that it will answer to. The above example shows that the computer will answer to 74.104.77.xxx and 127.0.0.1 (the computers equivalent of “me”). The three addresses shown have different and special meanings.

127.0.0.1:port#programs listening on this address will accept connections originating from only the local computer.

74.104.77.xxx:port#programs listening on this address will accept connections originating from computers on the network/internet.

0.0.0.0:port#programs listening on this address will accept connections from anywhere, local or remote, sent to any of the addresses the computer will answer to (in this case 127.0.0.1 and 74.104.77.xxx).

The State column refers to the state of the TCP connection. You won’t see this for UDP connections because the don’t have state like TCP does. Here is the list of options (plagiarised from some site I don’t remember):

LISTEN – represents waiting for a connection request from any remote TCP and port.

SYN-SENT – represents waiting for a matching connection request after having sent a connection request.

SYN-RECEIVED – represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request.

ESTABLISHED – represents an open connection, data received can be delivered to the user. The normal state for the data transfer phase of the connection.

FIN-WAIT-1 – represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent.

FIN-WAIT-2 – represents waiting for a connection termination request from the remote TCP.

CLOSE-WAIT represents waiting for a connection termination request from the local user.

CLOSING – represents waiting for a connection termination request acknowledgment from the remote TCP.

LAST-ACK – represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).

TIME-WAIT – represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request.

CLOSED – represents no connection state at all.

Hopefully that will help make sense of the output netstat gives. It helped me at least :)

The man behind the mess.

While working for General Motors in 1921, Tomas Midgley Jr (then 32) discovered that adding tetra-ethyl lead to gasoline would stop “engine knock”, and leaded gasoline was born. On February 1, 1923, Dupont, Standard Oil and GM started selling tetra-ethyl lead (TEL) through a Corporation called the Ethyl Gasoline Corporation. It still exists today under the name “Ethyl Corporation“.

Of course lead is highly toxic and working with it is very dangerous. Ethyl Gasoline Corporation employees suffered a rash of deaths and dementia which the company, and Midgley himself (in spite of having a lead poisoning incident of his own), tried their darnedest to cover up. Thanks to the atmospheric lead produced by burning Midgley’s leaded gasoline, you and I have 625 times more lead in our blood than people before 1923[1].

Tomas Midgley Jr.

In 1930 Midgley then turned is unique talents to finding a safer gas that could be used in cooling systems such as refrigerators. What he came up with was Chlorofluorocarbons (CFCs) which were promptly added to everything from hairspray to air conditioners. We now know that a single kilogram of CFC’s can destroy 70,000 kilograms of ozone[1].

In 1940 Tomas Midgley was stricken with polio and, bedridden, invented a system of ropes and pulleys to help him move around. In a karmic twist Midgley became entangled in the ropes and was found strangled to death in 1944, long before he could learn that his second invention was doing to the world what his third invention did to him.

[1] Bryson, Bill. A Short History of Nearly Everything. (2003) Broadway Books, USA. ISBN 0385660049

Rockbox lives up to its name!

As cool looking as it is, the iPod is just a screen and a thumb wheel mounted on a laptop hard drive. With that in mind why can’t I use it as a hard drive? I could just drag and drop my music on my iPod without ever needing to install iTunes. If my computer died I could copy the music from my iPod back to my new computer without batting an eye.

While we are at it how about the ability to play music formats I want (Ogg Vorbis, Flac etc) to use rather than the 4 Apple approves of and the restrictions that come with them? Don’t get me wrong, Apple is a first rate industrial design company, but it feels a little like the RIAA has been talking to their development team.

The real problem is that in spite of all that, the iPod hardware is so much nicer than anything else and I still want one. Fortunately there is a resolution to this cognitive dissonance: Rockbox. Installing it on your iPod instantly gives you gapless playback, UMS (Making your device operate like a USB harddrive), support for replaygain and lossless audio formats as well as Ogg Vorbis and just about every other format I can think of.

rockbox

I stumbled upon the Rockbox project about a year ago and have been watching with interest as it steadily added support for more players. When it finally added support for the iPod, I began seriously looking at getting one. Finally, Last time we were at Costco, Jenn suggested that since the price was good and there was a nice return policy in case the Rockbox thing did not work out, that I might want to take my birthday present a little early. As it happens she and my Mum and Dad had decided to split on one for me! YAY!

The first part of the installation involves finding the iPod backing up the Apple firmware and installing a boot loader that will allow you load rockbox instead of the Apple firmware. Once the bootloader is in you just need to drop the files from the appropriate build into the root directory of your iPod and then reboot it.

I have been playing with Rockbox for a few days now and am thrilled with it. It still has some rough edges in the interface and the video playback is not there yet but when the speakers are shoved directly into your ear as they are with headphones you really appreciate the quality of the Ogg Vorbis and lossless Flac files. It can even play Doom! Needless to say, it does not appear that I will be needing that return policy. To all the developers working on the Rockbox project, great job, rock on!

rockdoom

Thanks to Jenn and Mum and Dad for the awesome, and somewhat early, gift!

X11 forwarding over SSH

I recently got my old computer up and running with Gentoo Linux with extensive help from one of my coworkers, who is an avid Gentoo fan. Now that it is back in my basement I am starting to play with it remotely.

One of the cool things about the windowing system on Linux (called X11 or just X) is that it is a server and considers the program windows you have opened as clients. There is nothing saying that the server your client program window is getting its information from has to be the local computer you are sitting in front of.

Of course, no proper Linux aficionado would send this kind of thing across the internet without encryption, so the X windows are sent through an SSH tunnel. The settings (on Gentoo at least) were pretty simple. In the /etc/ssh/ssh_config file change this:

# Host *

# ForwardAgent no

# ForwardX11 no

To this:

Host *

# ForwardAgent no

ForwardX11 yes

And then in the /etc/ssh/sshd_config file change:

# X11Forwarding no

to

X11Forwarding yes

Once you have done that restart the sshd service with the command:

sleepycat ~ # /etc/init.d/sshd restart

* Stopping sshd … [ ok ]

* Starting sshd … [ ok ]

Now you are ready to ssh to the box. Use the –X flag to enable X11 forwarding and the –l option to specify the username you are connecting with:

sleepycat ~ # ssh –X –l mike 192.168.1.1

When you are connected you can issue a command like “firefox &” and marvel as firefox opens with your search history and bookmarks from the remote computer.

When I showed this off at work I was asked “cool, but what are you going to use it for?”

I guess if I ever wanted an undetectable way to surf porn at the office I could use it for that…