Archive for Free software and related beasts

Temperature and fan speed control on the Asus Eee PC

I noticed that after my second eeebuntu install (see a previous post for a why to this reinstall), my Eee PC was a wee bit more noisy. Most probably it has always been like that, but I just noticed after the reinstall.

I put some sensor output in my [[Xfce]] panel, and noticed that the CPU temperature hovered around 55 degrees C, and the fan would continuously spin at around 1200 rpm. I searched the web about it, and found out that usually fans are stopped at computer boot, then start spinning when temperature goes up. This is logic. The small catch is that when the temperature in the Eee PC goes down, the fan does not stop automatically. This means that the fans are almost always spinning in the long run.

I searched for methods to fix that, and I read this post at hartvig.de. From there I took the idea of taking over the control of the fans, and making them spin according to the current temperature. For that, I wrote the following script:

#!/bin/bash

TEMFILE=/proc/eee/temperature
FANFILE=/proc/eee/fan_speed
MANFILE=/proc/eee/fan_manual

# Get temperature:
TEMP=`cat $TEMFILE`

# Choose fan speed:
if [ $TEMP -gt 65 ]
then
  SPEED=90
elif [ $TEMP -gt 60 ]
then
  SPEED=60
elif [ $TEMP -gt 55 ]
then
  SPEED=30
else
  SPEED=0
fi

# Impose fan speed:
echo 1 > $MANFILE
echo $SPEED > $FANFILE

The file /proc/eee/fan_manual controls whether fans are under manual (file contains a “1”) or automatic (file contains a “0”) control. File /proc/eee/fan_speed must contain an integer number from 0 to 100 (a percent of max fan speed).

I am running this script every minute with cron, and thus far it works OK.

Comments (5)

LWD – March 2009

Did I say “bimonthly” in my last report? Mmm, that was 3 months ago… You can read an intro for my Linux World Domination project in this May 2008 post.

As usual D2D means “days to domination” (the expected time for Windows/Linux shares to cross, counting from the present date), and DD2D means difference (increase/decrease) in D2D, with respect to last report. CLP means “current Linux Percent”, as given by last logged data, and DD means domination day (in YYYY-MM-DD format).

Project D2D DD2D DD CLP Confidence %
Einstein 107 -144 2009-06-26 42.09 (+4.61) 17.3
MalariaControl >10k 12.55 (+0.10)
POEM 5345 +325 2023-10-30 10.47 (+0.42) 2.5
Rosetta >10k 8.09 (+0.10)
QMC >10k 7.87 (-0.04)
SETI >10k 7.94 (+0.06)
Spinhenge >10k 3.59 (+0.24)

As promised, today I’m showing the plots for POEM@home, in next issue Prime@home.

Number of hosts percent evolution for POEM@home (click to enlarge)

Accumulated credit percent evolution for POEM@home (click to enlarge)

Comments

Free software woes

Yes, [[FLOSS]] also has its quirks and problems, and I am going to rant about some of them, that I run into the last week.

Problem 1: fsck on laptops

The reader might know that Linux comes with a collection of file system checkers/fixers, under the name fsck.* (where * = ext2/3, reiserfs, jfs, xfs…). When one formats a new partition (or tunes an existing one), some parameters are set, as for example in what circumstances fsck should be run automatically (you can always run it by hand). The typical setting is to run the command on each partition (just before mounting it) every N times it is mounted, or every M days.

It is also set that if a filesystem is not shut down cleanly (e.g., by crashing the computer or directly unplugging it), fsck will be run automatically on next boot (hey, that’s so nice!).

However, here’s the catch: on laptops, and with the aim of saving power, fsck will (tipically) not run automatically when on batteries. This seems a great idea, but you can imagine an scenario where it fails: shut down the laptop uncleanly, then power it up on batteries, and… voilà, you are presented with a system that seems to boot, but gives a lot of problems, the X don’t work… because the disk was corrupt, and wasn’t fixed on boot.

When this happened to me, I fixed it by booting while plugged. In principle you could also boot on single user mode, then chose “Check the filesystem” in the menu you will be presented (I’m talking about Ubuntu here), and fix the problem, even on batteries. But still, it’s annoying. IMHO fsck should run after unclean shutdowns, no matter being plugged or on batteries.

Problem 2: failed hibernate can seriously screw your system

I tried [[Hibernate (OS feature)|hibernating]] my laptop (a feature I keep finding problems with), but it was taking too long, and I was forced to shut it down using the power button. This, in itself, is a serious issue, but I could live with it.

But what I can’t live with is that after the event, I had no way of booting back! I tried all I could, and finally had to reinstall the OS. I am the one whom it happened to, and I still find it hard to believe: Linux so fucked up that you have to reinstall. I thought reinstalling belonged to the Windows Dark Ages!

Problem 3: faulty SD card

Since the problems tend to come together, it’s no surprise that I came across this error when trying to reinstall the machine borked with previous problem. The thing is that I was using a SD card as installation media, burning the ISO into it with [[UNetbootin]]. The burning didn’t burp any error, but the installation failed, usually (but not always) on the same point.

After minutes (hours?) of going crazy, I burned the ISO into another SD card, and it worked like a charm.

My complain is not that the SD was faulty, which I can understand (hardware fails). What I am angry at is the fact that I checked (with the aforementioned fsck command) the FS in the card many times, and I reformatted it (with mkfs) many more times, and Linux would always say that the formatting had been correct, and that all checks where fine. I understand that things are sometimes OK, sometimes KO. I just want to know when is which!

Comments (5)

Proprietary software woes

I am attending the EGEE User Forum congress I have mentioned before, and we just had a talk delayed 5 minutes because of some stupid software problem.

The speaker had his talk in [[PDF]] format, really standard and portable. The organizers provided him with a Windows machine, with Acrobat Pro installed (apparently). He tried to open the file with it, but it turns out the license for Acrobat had expired, so the computer refused to open the file. How horribly full of shit is that? There are thousands of free (and/or freeware) programs out there to read PDFs, so why was the poor speaker forced to use another computer just for the task? This would have never happened, obviously, had the organizers been using free software.

Comments

My eeePC at the EGEE UF4

I just posted about the abundance of laptops in the conference I am attending this week. Now I feel like comenting about my experience with the Asus eeePC 901 I acquired some weeks ago.

I have seen a couple other eeePCs, a black 9xx one, and a 7xx one. Apart from these, most other computers are laptops, not [[netbooks]]. I actually expected to find more, and for a plethora or reasons. There are some pretty small Vaios around, but only they compete in terms of size and weight with the eeePC. Not even the Macs. Not even the MacBook Airs that I have seen. Yes, the screen of the eeePC is tiny, but I would hate carrying around those monsters just to have a big screen on the road.

Secondly, my battery can last for 6h of work. Since I only use it during the breaks, and intermittently during the talks (closing the lid to suspend it when not in use), I can easily use it the whole day without plugging it at all. Other people can’t live w/o plugs. In 3.5h this morning, I spent less than 30% of the battery.

Thirdly, there is the price. I would expect that the Vaios I mention above cost easily 5-6 times more than my sub-300-euro jewel. The other laptops are probably cheaper, but still in the range 2-3x the price of my laptop. This is not negligible! I have no functionality missing, I can do everything the others do, but at a fraction of the price, a fraction of the space in my bag, and at a fraction of the weight on my back when transporting, and knees on using.

Comments

Miniblogging from Catania

Right now I’m in the 4th EGEE User Forum/OGF25 conference being held in Catania, Sicily.

I have some random thought to write down, and my lately little-attended blog seems the right place to do so.

Random thought of the moment: everyone, I mean every boy and girl and their pets, has a laptop. Everyone listens to talks with a laptop in their knees. Also, an amazing fraction of these (from 1 in 4 to 1 in 3, maybe) are Macs. The Linux machines are also relatively abundant, although a sad majority of laptops seems to run Windows.

Might this mean that techies favor Apple? Maybe it just means that geeks can also be posh, as shown by the equally high amount of iPhones I’ve seen around.

Comments

Save HD space by using compressed files directly

Maybe the constant increases in hard disk capacity provide us with more space we can waste with our files, but there is always a situation in which we would like to squeeze as much data in as little space as possible. Besides, it is always a good practice to keep disk usage as low as possible, just for tidiness.

The first and most important advice for saving space: for $GOD’s sake, delete the stuff you don’t need!

Now, assuming you want to keep all you presently have, the second tool is [[data compression]]. Linux users have long time friends in the [[gzip]] and [[bzip2]] commands. One would use the former for fast (and reasonably good) compression, and the latter for when saving space is really vital (although bzip2 is really slow). A more recent entry in the “perfect compression tool” contest would be [[Lempel-Ziv-Markov chain algorithm]] (LZMA). This one can compress even more than bzip2, being usually faster (although never as fast as gzip).

One problem with compression is that it is a good way of storing files, but they usually have to be uncompressed to modify, and then re-compressed, and this is very slow. However, we have some tools to interact with the compressed files directly (internally decompressing “on the fly” only the part that we need to edit). I would like to just mention them here:

Shell commands

We can use zcat, zgrep and zdiff as replacements for cat, grep and diff, but for gzipped files. These account for a huge fraction of all the interaction I do with text files from the command line. If you are like me, they can save you tons of time.

Vim

[[Vim (text editor)|Vim]] can be instructed to open some files making use of some decompression tool, to show the contents of the file and work on them transparently. Once we :wq out of the file, we will get the original compressed file. The speed to do this cycle is incredibly fast: almost as fast as opening the uncompressed file, and nowhere near as slow as gunzipping, viming and gzipping sequentially.

You can add the following to your .vimrc config file for the above:

" Only do this part when compiled with support for autocommands.
if has("autocmd")

 augroup gzip
  " Remove all gzip autocommands
  au!

  " Enable editing of gzipped files
  " set binary mode before reading the file
  autocmd BufReadPre,FileReadPre	*.gz,*.bz2,*.lz set bin

  autocmd BufReadPost,FileReadPost	*.gz call GZIP_read("gunzip")
  autocmd BufReadPost,FileReadPost	*.bz2 call GZIP_read("bunzip2")
  autocmd BufReadPost,FileReadPost	*.lz call GZIP_read("unlzma -S .lz")

  autocmd BufWritePost,FileWritePost	*.gz call GZIP_write("gzip")
  autocmd BufWritePost,FileWritePost	*.bz2 call GZIP_write("bzip2")
  autocmd BufWritePost,FileWritePost	*.lz call GZIP_write("lzma -S .lz")

  autocmd FileAppendPre			*.gz call GZIP_appre("gunzip")
  autocmd FileAppendPre			*.bz2 call GZIP_appre("bunzip2")
  autocmd FileAppendPre			*.lz call GZIP_appre("unlzma -S .lz")

  autocmd FileAppendPost		*.gz call GZIP_write("gzip")
  autocmd FileAppendPost		*.bz2 call GZIP_write("bzip2")
  autocmd FileAppendPost		*.lz call GZIP_write("lzma -S .lz")

  " After reading compressed file: Uncompress text in buffer with "cmd"
  fun! GZIP_read(cmd)
    let ch_save = &ch
    set ch=2
    execute "'[,']!" . a:cmd
    set nobin
    let &ch = ch_save
    execute ":doautocmd BufReadPost " . expand("%:r")
  endfun

  " After writing compressed file: Compress written file with "cmd"
  fun! GZIP_write(cmd)
    if rename(expand(""), expand(":r")) == 0
      execute "!" . a:cmd . " :r"
    endif
  endfun

  " Before appending to compressed file: Uncompress file with "cmd"
  fun! GZIP_appre(cmd)
    execute "!" . a:cmd . " "
    call rename(expand(":r"), expand(""))
  endfun

 augroup END
endif " has("autocmd")

I first found the above in my (default) .vimrc file, allowing gzipped and bzipped files to be edited. I added the “support” for LZMAed files quite trivially, as can be seen in the lines containign “lz” in the code above (I use .lz as termination for LZMAed files, instead of the default .lzma. See man lzma for more info).

Non-plaintext files

Other files that I have been able to successfully use in compressed form are [[PostScript]] and [[Portable Document Format|PDF]]. Granted, PDFs are already quite compact, but sometimes gzipping them saves space. In general, PS and EPS files save a lot of space by gzipping.

As far as I have tried, the [[Evince]] document viewer can read gzipped PS, EPS and PDF files with no problem (probably [[Device_independent_file_format|DVI]] files as well).

Comments (3)

First impressions on a Neo FreeRunner

Yes, as the title implies, I am the fortunate owner of a [[Neo FreeRunner]]. For those not on the know, the NFR is a kind of mobile phone/[[Personal digital assistant|PDA]] running [[free software]], and aimed at being open, both from software and hardware perspective.

I bought it last week, and I already have things that I love, and others that I don’t love that much. First thing that sucks: my 128kB [[Movistar]] [[Subscriber Identity Module|SIM card]] is not supported, so I can’t use the NFR to make calls! Apparently older versions of the SIM card are supported, so I will try to get hold of one (by the way, the [[simyo]] card I posted about some time ago works perfectly).

Another thing that is not so good is the stability of the software. However, I expected that, and I have no problem with it. Being open source, the software will evolve day by day, and I will love to see the evolution.

On the bright side: it is really great to be able to install different [[Linux distribution|distros]] in your phone! I tried OpenMoko, FDOM, QtExtended (formerly Qtopia) and SHR, and all of them have good and bad things. It is like going back to when I tried different distros for my computers (now I mostly stick to [[Ubuntu]] or [[Debian]]). By the way, you can install Debian in the NFR (haven’t tried it yet, because you have to install it in the [[Secure Digital card|microSD card]], not in the main memory (it’s too big for it). You can even try Google’s [[Android (operating system)|Android]], if you so wish.

But the really nice thing about it is that you can create your own apps for it. You can install [[Perl]] or [[Python (programming language)|Python]] interpreters, and then use the [[Command-line interface]] (yes, it does have command line) to run scripts. Or create icons on the desktop and link them to an action. For example, I created an icon that switches from portrait to landscape orientation when pressing it, and then back when pressing it again. I created another icon that launches mplayer when pressed, so I can watch a video in it by just pressing the icon.

I expect to blog more about the gadget, so stay tuned.

Comments (4)

4 GB SD cards properly read under Linux

Remember how MacOS X ate my pics? In that post I explained that Linux had problems with >1 GB [[Secure Digital card|Secure Digital cards]].

Well, apparently the problem was in the card reader, not in Linux (or the card itself). I recently acquired a SD card reader on [[eBay]] (actually, one like this one), and with it I can mount and read 2 and 4 GB SD cards without problem.

Comments (1)

¿Dónde cagarán ahora las palomas?

Parece ser que hoy retiran una estatua de un tal Claudio (al que sus amigos llamaban cariñosamente “Claudillo”), que servía en la plaza del ayuntamiento de Santander de cagadero de palomas. Seguro que los animalitos echarán de menos la calva de este señor, por tener la curiosa propiedad de que era el único lugar de Santander donde podían cagar sin temor a que la gente de bien las odiara por ello (sino más bien al contrario).

Fuentes: El País | El Mundo

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »