OpenMoko Rotate 0.2.0

Woke up 2h earlier because of a problem, solved quickly, took the extra time to greatly improve the heuristics.

If you haven’t tried it before, now it’s the time to try. If you did, NOW is the time to try again 🙂

Fetch it now: rotate-0.2.0.tar.gz (signature)

$ head -3 ChangeLog 
2008-09-22 - 0.2.0
	* greatly improves heuristics
	* fixed heuristics when laying around, and turned up

First brown paperbag release of new Rotate

Oops, heuristics were bad, very bad. Still has quirks, but at least now they’re not so shameful.

There’s a new release: 0.1.1 (signature)

$ head -2 ChangeLog 
2008-09-21 - 0.1.1 - First brown paper bag release
	* improves heuristics
Known Issues:
	* reading from the accelerometer hangs after X time/reads
	* some heuristic values may need finetunning (specially when
	  laying around, turned up)

New Rotate for OpenMoko

As said before, since I’m not entirely happy with the previous version of Rotate for OpenMoko, also using it as a way to learn how to write programs for it, I’m writing a new version of Rotate for OpenMoko.

I’m now announcing the first results: release 0.1.0 is out (signature)! The tar.gz file contains both source and a binary suited to run on Om200x.y (at least 2008.9 should work).

Be careful, it bytes.. 🙂

$ cat ChangeLog
2008-09-21 - 0.1.0 - First release.
	Current Features:
	* makes some rotations

	Known Issues:
	* reading from the accelerometer hangs after X time/reads
	* some heuristic values may need finetunning (specially when
	  laying around, turned up)

	Near Future:
	* don't rotate when screen is locked
	* change profile to silent/meeting when phone is turned down
	  and revert when it is turned back up

Getting ready for Rotate rewrite

So… following up on my patch for a better xrandr rotation on Rotate, I’ve been learning how to read the accelerometers, and it’s a lot of fun, actually. I’m so thrilled… I really missed programming 🙂

Now, the good news is that in a couple of days (hopefully) I’ll be posting a completely new Rotate. I’m collecting some positioning data from the second accelerometer, and right now I already know a few positions, at least my little test program is guessing some positions quite right…

s/guess position/libxrandr rotate/ and you get the new Rotate 🙂

All this without running the risk of seeing this software banned (like the iDictatorPhone), where it seems some programmer got his application banned on the iDictatorPhone because it competed with Mail.App. Nice one, Apple, you’re only proving us, Free Software activists, right. Again. 🙂

The following is the current output as I pick it up from the table and place it from turned up into turned down.

Postion (90,90,1026):  horizontal turnedUp
Postion (90,72,990):  horizontal turnedUp
Postion (36,54,990):  horizontal turnedUp
Postion (-36,36,990):  horizontal turnedUp
Postion (18,18,972):  horizontal turnedUp
Postion (18,936,0):  upsideDown
Postion (18,36,882):  horizontal turnedUp
Postion (36,36,900):  horizontal turnedUp
Postion (18,18,1008):  horizontal turnedUp
Postion (-36,1080,0):  upsideDown
Postion (-36,-36,1080):  horizontal turnedUp
Postion (72,1134,0):
Postion (54,18,1314):  horizontal
Postion (54,54,1386):  horizontal
Postion (18,144,1404):  horizontal
Postion (-36,198,1386):  horizontal
Postion (-72,234,1296):
Postion (-54,108,1152):  horizontal
Postion (-396,-72,936):  horizontal turnedUp
Postion (-864,-198,1080):  horizontal left turnedUp
Postion (-504,-36,918):  horizontal turnedUp
Postion (-504,54,1026):  horizontal turnedUp
Postion (-414,54,1098):  horizontal turnedUp
Postion (18,-54,774):  horizontal
Postion (234,-288,378):
Postion (180,-666,18):
Postion (414,-720,216):
Postion (-36,-1080,0):  vertical
Postion (90,-774,-72):
Postion (126,-270,-216):
Postion (234,702,360):
Postion (-360,378,-2304):
Postion (864,1170,-918):  right turnedDown
Postion (126,702,-1800):
Postion (288,558,-1494):
Postion (270,288,-1314):
Postion (54,108,-1206):  horizontal
Postion (108,162,-1098):  horizontal turnedDown
Postion (288,108,-882):  horizontal turnedDown
Postion (342,162,-792):  horizontal
Postion (270,72,-828):  horizontal turnedDown
Postion (306,36,-972):  horizontal turnedDown
Postion (306,90,-1188):  horizontal
Postion (270,324,-1332):
Postion (180,396,-1278):
Postion (126,450,-1386):
Postion (-36,522,-1674):
Postion (36,270,-1404):
Postion (180,90,-1080):  horizontal turnedDown
Postion (72,72,-1044):  horizontal turnedDown
Postion (54,90,-1044):  horizontal turnedDown
Postion (-18,72,-1080):  horizontal turnedDown
Postion (18,72,-1026):  horizontal turnedDown
Postion (18,36,-1080):  horizontal turnedDown
Postion (18,36,-1134):  horizontal
Postion (36,36,-1098):  horizontal turnedDown
Postion (54,36,-1098):  horizontal turnedDown
Postion (90,54,-1080):  horizontal turnedDown

OpenMoko Rotate now using libxrandr

As I peeked into the code of OpenMoko’s Rotate (a program that rotates the screen acording to the current tilt), I noticed it made use of system to launch the xrandr program with appropriate arguments.

Well, system costs a lot in terms of processing power, not to mention launching another program, and that means even less battery time. I didn’t like that, so I wrote a patch that alters the current rotate.c into a new rotate.c in order to use librandr and get it to rotate the screen without the costly system+xrandr duo from hell.

I also built a binary of rotate, which you can download from this link and place on your OpenMoko Neo Freerunner with 2008.8 or 2008.9 (I haven’t the foggiest idea if it works on other versions).

Hopefully, you might want to verify the sha1sums:

Hash: SHA1

afc833b7cd2c874c1c815a0cb9f7c38a65998ff5  rotate
efcc6277080b2aadc3306a000a97ab202ca2bece  rotate.c
c1eb847d05cd36e0e9f31b5e5f6eb9337f730d0f  rotate_libxrandr.patch
Version: GnuPG v1.4.6 (GNU/Linux)


I realise the way I wrote didn’t make it very obvious, so here’s a listing of the files:

O ataque à Red Hat/Fedora em Links

  1. Os sistemas deixam de estar disponíveis. Um posterior (alguns consideram tardio) aviso na Fedora Announce denúncia um problema de segurança com pacotes «as a precaution, we recommend you not download or update any additional packages on your Fedora systems»
  2. Enquanto a investigação prossegue à porta fechada, possivelmente por motivos legais, os sistemas vão lentamente voltando a funcionar
  3. Finalmente (8 dias depois do anúncio oficial) revelam o que aconteceu: alguém conseguiu penetrar no sistema de compilação automática de software.
  4. Conseguiram submeter pacotes de OpenSSH assinados com a chave da Red Hat, mas em princípio não chegaram a ser distribuídos. Publicaram novos pacotes de OpenSSH e um script para verificar se por azar algum um cliente de Red Hat Enterprise Linux chegou a descarregar esses pacotes.

É mau? Sim, é mau. Mas o pior que aconteceu foi um beliscão na imagem da Red Hat. Já passo.

Sem dúvida seguir-se-ão as piadas do costume na Internet (Debian passou por isso recentemente, embora no seu caso tivesse sido bem mais grave), até que a moda canse ou seja substituída por outro evento.

Felizmente foi detectado atempadamente e, mais importante ainda, não conseguiram acesso às chaves da Red Hat. Estão preservadas num HSM (High Security Module), apenas conseguiram submeter pacotes corrompidos para o sistema de assinatura automática.

Move along…

Maintainer do TSClient

Erick Woods, anterior maintainer do TSClient, passou-me o manto deste projecto.

Na minha TODO list prioritária está a integração dos vários patches existentes e a migração da residência do projecto da Sourceforge para o

Obrigado, Erick!

Erick Woods, previous TSClient maintainer, handled me the project’s maintenance flag..

My priority TODO list includes the integration of several existing patches and migrating the project from Sourceforge into

Thank you, Erick!

FreeDOS usb bootdisk HOWTO

I wanted to upgrade my BIOS, but I only want to use Free Software. Right now, the only exception I have to do is the BIOS for which I don’t have much choice there. But I want to avoid MS-DOS if I can, so I investigated how to get FreeDOS to boot on an USB disk. Success! It worked. Here’s what I did.

Partitioning the usb stick

In my case, the USB disk was /dev/sdb, so I launched parted in order to prepare the boot disk. Since I have a 64MB usb drive lying around, I’ll use it. You may need to replace fat16 by fat32 if you want to use way bigger partitions:

[root@roque ~]# parted /dev/sdb mklabel msdos
Warning: The existing disk label on /dev/sdb will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes
New disk label type?  [msdos]?
Information: Don't forget to update /etc/fstab, if necessary.

[root@roque ~]# parted /dev/sdb print
Model: FlashDis Flash Disk (scsi)
Disk /dev/sdb: 65.5MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End  Size  Type  File system  Flags

Information: Don't forget to update /etc/fstab, if necessary.

[root@roque ~]# parted /dev/sdb mkpart primary fat16 0 64MB
[root@roque ~]# parted /dev/sdb toggle 1 boot

Pay attention that if you see Partition Table: loop then beware, since it doesn’t support bootable flag, so you really need to run the mklabel part in order to change it to msdos. After that, you’ll need to make a partition as well.

Installing a boot loader

While a friend was trying at the same time to use syslinux, I tried grub, but it still needed some help from a syslinux file, memdisk :). Here’s how I did it:

mount /dev/sdb1 /mnt
cp -r /boot/grub /mnt
cp /usr/lib/syslinux/memdisk /mnt
cd /mnt/grub
echo '(hd0)     /dev/sda' >
cat <  grub.conf
title FreeDOS
        kernel /memdisk
        initrd /fdodin06.144

cd ..
wget -c
unzip fdodin06.144 
  inflating: fdodin06.144            

Now we need to put grub into the MBR (master boot record), this is how I did it:

grub> find /grub/stage1
find /grub/stage1

There’s two of them. That’s not good, is it? No, it’s in fact quite normal. The first one is from /dev/sda, my main hard disk. You’ll have to go to the correct partition though:

grub> root (hd1,0)
root (hd1,0)
 Filesystem type is fat, partition type 0xe
grub> setup (hd1)
setup (hd1)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/fat_stage1_5" exists... yes
 Running "embed /grub/fat_stage1_5 (hd1)"... failed (this is not fatal)
 Running "embed /grub/fat_stage1_5 (hd1,0)"... failed (this is not fatal)
 Running "install /grub/stage1 (hd1) /grub/stage2 p /grub/grub.conf "... succeeded

Now it will boot from the usb drive, and launch grub.

boot and test

So I guess this is your final stage… place what you need to run in the usb stick, unmount it and there you go!

Now you can use that pesty BIOS upgrade proprietary crap.


Dell D531

Este artigo segue em inglês para o propor para inclusão no TuxMobile, e refere-se à instalação de um GNU/Linux, neste caso o Fedora 7, num Dell D531.

UPDATE: sound works now, graphics card too is for really Real Soon Now!

Article listed at TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones
So I got this Dell D531, it’s got a dual core AMD Turion™ 64 X2 Mobile Technology TL-60 CPU, an ATI X1200, bluetooth support, a wifi card, etc. Since I chose to only use Software Livre, I had to figure out how to make it work best without using proprietary drivers. The other option was an HP virtually fully supported laptop, but since HP had some problems to give my employer over 20 laptops, suddenly Dell won, and I got one that has so-so support. AMD has bought ATI, though, and promised to help make things better, but if it isn’t releasing the ATI drivers… then it’s a worthless promise. and after a bit more than one year, the specs have been published. Here’s to a fully working card with the RadeonHD driver, real soon now! 🙂

Anyways, I had some trouble finding a popular distribution optimized for AMD64 which could be installed, I firstly tried Ubuntu, but for some reason only Gutsy Tribe 2 installed. It was in a too early development period, and I really need a working, reasonably stable laptop. Also, the native wifi card isn’t well supported with the bcm43xx drivers and seems to need some voodoo firmware, so I decided to turn it off in the BIOS.

Fedora 7 for AMD64 did install properly, although it had some quircks… and so starts the technical part of this story.

Obtaining install media

This was an adventure in itselft. It appears Fedora 7 Live for AMD64 doesn’t fit on 800MB CDs. Fortunately it can be loaded onto a pen-drive, and then boot and install from it. It’s actually much faster than from CD, so I definitely recommend pen-drives for install media.


Fedora 7’s install process is quite simple, as most modern GNU/Linux distrubutions, and you will have a reasonably straightforward and pain-free installation if you merely clear the whole disk and install (which is what I did since I don’t want closed Windows around).

One big advantage over Gutsy Tribe 2 is that it did detect the graphics card. Although, ATI X1200 is not fully supported, but the VESA driver was adequately loaded and I had a 1024×768 desktop. Yeah, it sucks, the display is for 1280×800 so things are a bit streched out, but hey, complain to ATI. They’re the culprits. Here’s to hoping the aforementioned promise isn’t worthless!

What Works

  • Suspend to memory sometimes works
  • Suspend to disk has always worked for me, so far
  • Bluetooth is supported
  • Ethernet wired card is supported
  • My older ralink PCMCIA wifi-card is supported
  • Virtualization support in CPU works
  • Burning CDs (alas, no DVD writing support in the optical drive *sigh*)
  • Sound works since alsa-driver 1.0.15rc1. It doesn’t work on most distributions yet since they have the latest stable version (1.0.14), but end of the 2007 onwards distributions should work out of the box
  • Most 2D support (full resolution, RandR 1.2, etc… but no acceleration)

What DOESN’T work

  • Suspend to memory in a reliable form (but maybe that’s Linux’s fault)
  • The natife wifi-card
  • Full 2D and 3D graphics card support (I’d be happy with full 2D support)
  • Battery life is shorter, my colleagues at work claim almost 8 hours when idle, I got a little more than 6 hours when idle. Still, a huge improvement, since the previous laptop only lasted about 2 hours on the first 6 months 🙂


AMD has promised to help solving the ATI issue. I hear there’s a huge internal war, but the loss of big contracts (hundreds of thousands of computers) that has already happened because AMD laptops with ATI aren’t fully supported with Software Livre is probably a significant incentive for things to change in the near future.

The hda-intel Azalia sound card has had many patches recently so, hopefully, when Fedora rebases to 2.6.23 Linux I might have sound.

It seems some successful work is going on with the bcm43xx driver, so maybe in the future I won’t need the ralink PCMCIA card (one major problem is less battery life as PCMCIA cards drain more power).

There’s a lot of recent work on power efficiency. Even though it’s focused on Intel computers, I’m sure a lot of it will also benefit AMD based computers.


All in all it’s a good (and nice looking) laptop, but has some major problems if you only want to use Software Livre like I do. Things may improve, though, and I may revise this article in the future.

Sapo Vídeos: Usa MPlayer

É possível ver e gravar conteúdos do Sapo Vídeos e do YouTube, na janela do Firefox, sem utilizar o Flash proprietário, na realidade sem utilizar qualquer Flash 🙂

Diria mesmo mais, o pequeno pormenor de poder gravar já dá uma vantagem significativa do mplayerplug-in face ao Flash.

A receita:

  1. instalar o mplayerplug-in (ou mozilla-mplayer)
  2. instalar a extensão greasemonkey para o Firefox, e depois de reiniciar o browser, carregar…
  3. aqui para o Sapo Videos
  4. aqui para o YouTube

Tendo por base o YouTubeUseMplayer foi fácil criar o SapoVideosUsaMplayer.
Viva o GreaseMonkey!

Pelo menos no Ubuntu ambos os programas acima indicados já-se encontram nos repositórios, bastando então executar…

sudo aptitude install mplayerplugin-in firefox-greasemonkey

Continue reading “Sapo Vídeos: Usa MPlayer”