pavelmachek's Journal

Recent Entries

You are viewing the most recent 25 entries.

31st July 2006

1:39pm: hdaps documentation
IBM has an article at their developerworks website, describing how to use hdaps sensors in their thinkpads to enter "knock codes". (Pretty useless and potentially harddisk damaging feature, but hey, it looks like nice toy).

Unfortunately, the same IBM did not provide documentation to the sensors, and drivers had to be reverse-engineered from some IBM person describing code in plain english. We have half-working driver (does not work for my x60) that can't be properly supported because we have not seen the docs.

And now IBM uses the same (undocumented, reverse-engineered) driver to show how cool they are. Am I the only one to find it insulting?
1:54am: USB sucks
First I thought it is Linux that sucks. We did some quick measurements
with AC ampermeter; Windows ate 10W at minimum backlight and Linux ate
-- wait for it -- 15W during installation, 17W during runtime. Ouch.

(To put it into perspective, that means 7.5 hours with extended
battery on Windows, versus 4.4 hours with Linux/GNOME).

I promptly deleted both Windows and GNOME, but still, on console, with
self-compiled kernel, I was getting power consumption in range of
14.6W (5.1 hours). I started to investigate WTF is going on... then
realized I have this small fingerprint reader on USB.. and that
probably forces USB to stay on and wastes power.

And yes I was right. USB removed, and we are down to 11W (6.8
hours). So what does USB suck? 2 hours of my battery life...

30th July 2006

11:42am: x41 fingerprint scanner testers wanted
Fingerprint scanner now works for me on thinkpad x60, but according to the records it is broken on x41. If someone could install it / try to debug it, that would be great. Debugging is quite easy: just dump sequences -- kernel has support for dumping everything to syslog, and compare what closed driver does with open source version... then fix the open version to match :-).

Another nice test would be: create .bir file with closed driver, remove len-=2 hack from open driver, and try if it recognizes your finger.

25th July 2006

12:12am: thinkpad X60 fingerprint scanner works (should work on x41, too)
Thanks to vsu_alt, that crc really was udf-crc. So now fingerprint scanner works for me. Download thinkfinger.c and follow instructions in comments.

Some good place to host this would be nice (I guess that it is too small to be worth of project).

Ugh.. and some amusing email reached my inbox. Apparently IRS wants to give me $64, or something. Someone is phishing at ... that redirects you to nicely-done phishing formular at . How do you shut such bastards down? Or are they only victims of some worm? (Probably should be shat-down anyway). (Be very careful when visiting above urls with anything other than telnet XXXX 80).

24th July 2006

7:05pm: thinkpad fingerprint scanner -- sources and help wanted
So... fingerprint scanner seems to work, with one -- hopefully last --
glitch. Protocol seems to include 16-bit checksum, and I do not know,
how to compute it. Without that, I can only replay packets I seen
before. (Still, that allows me to check my own fingerprint, and enroll

Checksum seems to be in the last two bytes, and here are some
sequences that otherwise differ only in 1 nibble. Any ideas? (You can
also see it begins with "Ciao" :-).

43 69 61 6f 00 00 08 28 05 00 00 00 00 30 01 5e 20
43 69 61 6f 00 10 08 28 05 00 00 00 00 30 01 c8 b4
43 69 61 6f 00 20 08 28 05 00 00 00 00 30 01 53 19
43 69 61 6f 00 30 08 28 05 00 00 00 00 30 01 c5 8d
43 69 61 6f 00 40 08 28 05 00 00 00 00 30 01 44 52
43 69 61 6f 00 50 08 28 05 00 00 00 00 30 01 d2 c6
43 69 61 6f 00 60 08 28 05 00 00 00 00 30 01 49 6b
43 69 61 6f 00 70 08 28 05 00 00 00 00 30 01 df ff
43 69 61 6f 00 80 08 28 05 00 00 00 00 30 01 6a c4
43 69 61 6f 00 90 08 28 05 00 00 00 00 30 01 fc 50
43 69 61 6f 00 a0 08 28 05 00 00 00 00 30 01 67 fd
43 69 61 6f 00 b0 08 28 05 00 00 00 00 30 01 f1 69
43 69 61 6f 00 c0 08 28 05 00 00 00 00 30 01 70 b6
43 69 61 6f 00 d0 08 28 05 00 00 00 00 30 01 e6 22
43 69 61 6f 00 e0 08 28 05 00 00 00 00 30 01 7d 8f
43 69 61 6f 00 f0 08 28 05 00 00 00 00 30 01 eb 1b
43 69 61 6f 00 00 08 28 05 00 00 00 00 30 01 5e 20

I did some experiments with crc16, and it does not seem to be
this.. or maybe I just need to use some strange initialization value,
or not checksum over whole packet, or something?

Any ideas?

(Oh, and if you want to play with the software, see my outgoing
. Interesting files are thinkfinger.c, little.bir,
little.log and sequences.clog).

22nd July 2006

3:57pm: thinkpad fingerprint scanner... a pretty clever hardware device, that does all the processing itself. That explains why fingerprint can be used instead of power-on password, and means that device is reasonably easy to handle.

After few surprises (every packet starts with "Ciao"), I'm able to verify my own fingerprints (replaying traces of binary-only blob). Enrolling fingerprints works, somehow, too, but I'll still need figure out packet format so I can use newly-enrolled fingerprints, too.

Now, question is "is there suitable software repository somewhere"?

21st July 2006

4:45am: Kernel summit, OLS and fingerprints
Kernel summit was nice, as expected, there was some flamewar about
swsusp. I also expected huge flamewar about AppArmor, and yes it
happened, but I could not participate -- Linus and Christoph did all
the flaming.

At the beggining of the OLS, I realized why I was flamed for swsusp
not working: it works in Fedora -- in about 50% of cases :-(. We
debugged it a bit with Peter Jones (LVM really makes debugging swsusp
"interesting"), tried to do experiments with SuSE10.1 (known to work
more than 50% times :-), ended up physically swapping harddrives, and
yes, kernel compiled by me did work as expected (but it does not use
LVM and many other goodies). Hopefully Peter can debug it now.

I got a new x60 to play with, here are first results: Suspend to RAM
and to disk seems to work, provided you apply AHCI fixes (see
lkml). It is fairly nice machine, unfortunately it still uses the CPU
fan even when idle. Unlike x32, weight on this machine is on the back,
so when you attempt to open the lid single-handed, you lift the front
of the machine, instead. It also makes machine seem heavy when lifting
at the front area (as I was used to).

Oh and you need to disable checksum code on e1000 if you want your
ethernet to work.

x60 has nice fingerprint scanner. I could get binary-only modules to
run that one, but... I would prefer not to do that. Does anyone did
any work at reverse-engineering that beast? I did a little googling
but could not find much.

13th July 2006

12:46am: Canada: visa and what to do in Ottawa
I hate Canadian embassy. They do annoying personal search at entry, so they obviously care about _their_ security... and completely ignore yours. How hard is it to get someone else's passport? Very simple. You only have to know his name.

Anyway, does someone have any ideas what to do in Ottawa? I'm not sure if I'll be able to move outside area serviced by public transport... Some horses would be nice, but I guess that would require a car :-(.

And... I actually managed to get battery sensing code into quite usable state on collie. I even measured internal battery resistance (~1Ohm, unfortunately it changes with battery charge :-(); that should enable better measurements with different backlight levels. It would be nice if someone calibrated temperature sensors. (Changes should get into linux-z git tree overnight).

12th July 2006

2:28pm: Why-chroot-on-spitz
First... I'd like to say big "thank you" to openzaurus team... it is really great piece of software, making zaurus machines usable.

OTOH I like Debian/arm and am comfortable with it; apt-get works nicely, and I know that it is possible to update such distro easily. Also it contains software I use -- like gpsdrive. I do not think openzaurus should try to replace Debian/arm.

Also, by using two-installations setup with chroot, it means I can easily update openzaurus part while keeping my data intact.
1:05pm: Collie charging
I searched web a bit to find what li-ion thresholds are. I ended up with

{ 420, 100 },
{ 417, 95 }, means it will report 100% between 418 and 420

/* It looks like these values are in deciVolts */
struct battery_thresh collie_battery_levels_acin[] = {
{ 420, 75}, /* 75% full and 100% full li-ion battery can not be told by voltage, but by amps... */
{ 417, 70},
{ 415, 65},
{ 410, 60},
{ 405, 55},
{ 400, 50},
{ 390, 35},
{ 385, 20},
{ 375, 7},
{ 360, 3},
{ 340, 1},
{ 0, 0},

/* See for example for
* voltage/capacity characteristic. I assume it is going to be
* reasonably similar to li-ion used in collie.
* Collie with frontlight level 2 will last ~2.5 hours, so we are at
* ~0.5C. */
struct battery_thresh collie_battery_levels[] = {
{ 395, 100},
{ 390, 90},
{ 385, 85},
{ 380, 80},
{ 375, 70},
{ 370, 60},
{ 365, 50}, /* From sharp code: battery high with frontlight: 368 */
{ 362, 40},
{ 360, 30},
{ 358, 20}, /* From sharp code: battery low with frontlight: 358 */
{ 356, 10}, /* From sharp code: battery verylow with frontlight: 356 */
{ 0, 0},

If any has any ideas where to get better numbers... please let me know. Also it would be interesting to know how much different parts of collie take; all I know is this pretty old list; not sure about its accuracy.

132mA base system
+103mA for 25% backlight
+155mA for 50% backlight
+270mA for 75% backlight
+450mA for 100% backlight
+284mA for audio + cpu (mp3 playback)


4th July 2006

3:14pm: Battery status now works on collie
Thanks to Dirk for mcp fix, then I added some delays/repeats, and now battery reading seems to work. Now I'll have to figure out some percentages.

Congratulations to your new machine, Harald (zaurus sl-3200, if you do not read his blog). I hope you like it... If you install gpe on it, you can run full debian/arm distribution in chroot, with X still working. It is very convenient, but I guess it is quite far of what you are likely to get on cellphone...

11th June 2006

8:56pm: Zaurus zImage
I got some requests for 2.6 zaurus zImage... it should be in . Now... does anybody know how to compile 2.6-compatible gpe-based initrd for collie? (Yes, I should really learn bitbake).

10th June 2006

12:16am: Collie touchscreen is now usable in 2.6...
...with very dirty hacks. Look at linux-z tree.

8th June 2006

10:52am: oz funnynes
.../dev/hda2 has been mounted 260 times without being checked...

Okay, so I have oz on spitz here. Few rants:

Kernel messages may be ugly, but splashing them with blank screen is very bad idea. Outdoors, you get no feedback that power button worked until init boots. No, staring at blank screen is not nice. (Indoors, you can tell that machine is doing something because backlight turns on).

It would be nice to include fsck in initscripts. I know that fscking PDA is "interesting", but it is polite thing to do. Besides, my /dev/hda1 tells me:

.../dev/hda1 contains a file system with errors, check forced.
Inodes that were part of corrupted orphan linked list found. Fix

not including periodic checks is one thing, but ignoring "needs check" flag is positively bad.

7th June 2006

12:05am: Sharp Zaurus SL-A300
My new coworker, Erik Hamera, found old A300 in second-hand-shop somewhere, and after long fight, even managed to make it working (some soldering iron was involved).

Unfortunately, that beast is not supported by openzaurus and very little useful information could be found on the web. It is small compared to collie (sl-5500), and so it lacks keyboard and compactflash slot, but it looks positively sweet.

Now, openzaurus support was planned at some point.. I assume it is known how to flash this beast? Any test-kernels available somewhere?

22nd May 2006

10:18pm: Olympus c-765 user interface... horrible. I thought my camera had broken flash. Not so, I just selected "hispeed multi" mode (which makes camera react at useful speed), unfortunately which disables flash in pretty un-obvious way.

Olympus, could you do some user testing perhaps?
12:11pm: "Fan failure is critical" nonsense
People seem to be scared when their fan fails and/or when their CPU temperature reaches 80C. Don't be, it is okay:

a) ACPI specifies that hardware should protect itself from damage. If CPU temperature reaches 95C or so, machine is shut down _by hardware_. If operating system is able to interfere with that (it should not be), your hardware was trash in the first place. This failsafe actually tends to work on most machines. I tested it multiple times by sticking piece of paper into the fan, then loading CPU with kernel compilations while machine was covered in bad. And machines actually tend to survive that.

a1) okay... CPUs survive that, but watch your harddrive temperature. If it happens once in a while, it is probably okay, but running machine in this state for 8 hours is a bad idea. I did it few times and harddrive did develop some bad sectors (old HP omnibook).

b) CPUs are specified up-to 95/100C in common cases. Look at the datasheet. It does shorten the life of the CPU... but your CPU is still specified to run at 95C for three years in a row. So you can safely ignore that.

Now... I had some problems with overheats... but I actually used machine with failed fan for a year+. And then I had a funny failure where two notebooks were sitting on one another, and the top one overheated (compaq evo), deforming the case of hp 5000nx below it. Fortunately the case returned to normal after cooldown.

So... don't be scared. Ouch, you can sometimes get to a state where machine will not boot after bad overheat. BIOS actually sees too high temperature and refuses to let it power up. Let it cool for 15 minutes then try again. (I've seen this too few times.)

13th May 2006

10:24pm: Horse stepped on my little toe...
...and the toe is now broken. I'll have to find some way of moving myself. I already know horseback is okay, but it is little hard to move through city on horseback these days. Car is pretty "interesting" to operate: manual transmission really needs both legs. Not sure, maybe bike will work okay?

(My "horse" blog, in czech, I'll get picture of offender there</a>)

11th May 2006

2:41pm: How to charge nokia 6230
Heh, by accident I found out that Logitech's laser mice charger is acceptable voltage (8V, 550mA) to charge nokia, and connector is compatible, too. Plus laser mouse charger is 100V compatible (unlike nokia charger) and much smaller/lighter, too. Good.

9th May 2006

11:52am: How not to write an operating system
Andrew S. Tanenbaum is at it, again, with next part of "how not to write an operating system" series.

Its true that most bugs are in the drivers, fortunately driver bugs usually bring the system down quickly, and so are easy to debug. Also he conviently misses to mention that each user runs less than 2.5 million lines of code -- because he only has very small part of all possible hardware. He proposes few solutions, and first of them might actually be useful for debugging: protect kernel memory at the driver entry point... I'd like to see the patch on linux-kernel list, and preferably also list of bugs it discovered.

Other ideas are basically "add virtualization to separate drivers"... oops, and debug all the hard bugs in virtualization layer, too?

Clasical microkernel approach... and then goes to say it performs reasonably because it can compile itself in 6 seconds. Very wrong benchmark... how long does it take to compile linux on that machine would be reasonable benchmark. But I guess his "super reliable" operating system would probably die before finishing that. (Or perhaps his make process would die because of bugs in emulation; end result is the same).

Next idea is to rewrite os into java. Oops.

...all these approaches conviently forget that most devices (sound card, disk, video card, USB) do DMA these days, and machines do not contain IOMMU, so bad driver can still overwrite anything, and if you poke the buggy hardware the machine dies, anyway.

Oh, and that article actually mentions that "Protecting the kernel against malicious drivers is not a goal. The initial implementation was on Linux, but the ideas apply equally well to other legacy kernels.", yet trumpets security advantages in all that.

So, Andrew, please don't make my machine as reliable as my cellphone is. You know, my Linux machine actually works much better than my cellphone.
11:44am: Practical wearable computer, try #4
Try #4 -- Zaurus sl-3000c + Nokia 6230 over bluetooth + Fortuna GPS over bluetooth

Works nicely. Zaurus is great for email and GPS handling with
GPSdrive. 6230 can handle email, too (mujmail) and can handle GPS, too
(javaphone, see
). Nice combination; I'm only worried that sl-3000c zaurus
contains 4GB microdrive, and that sounds fragile.

Now... it would be nice to figure out how to do track saving
without zaurus, and to improve map displaying capabilities of navlet
-- I don't dare to take zaurus to horseback.

There are some updates on collie side, too:


It boots, display and keyboard works, internal flash works with
extremely ugly hack, pcmcia works, backlight & leds work. Touchscreen
works somehow, but userspace filtering needs to be developed. Have not
played with MMC, IrDA or USB device, yet; I'd assume they don't
work. Battery charging is half-done and broken, so is battery status.

Collie will very slowly charge even without software support,
however, so all is not lost.

10:32am: How not to charge nokia 6230, part III
After some hints from vojtech, I found out that 6230 will actually charge from 5x NiMH. From some docs, it should resist up-to 15V, so of course my next idea was "lets try with 12V/500mA power supply". No luck. Then I found out that it will also charge from 6x NiMH, 7x NiMH and 8x NiMH... and found suitable 9.3V, 550mA power supply from old Dancall phone. I connected it directly.

It worked okay.. when battery was nearly full. When battery was empty, Dancall charger started putting out *really* ugly sound, and charge stopped at 3/7 :-(, with nokia getting warm. Too bad, time for more experiments.

To comment on p910... it is not really _that_ bad smartphone. But it is not a good _phone_, not in basic config. Lots of issues could probably be fixed by add-on applications, but a) they are non-free and b) stability would probably suffer. And I have an PDA already; so... my current plan is to get sharp zaurus sl-5500 into usable state, connect it with 6230 over bluetooth, and get some phone features running on Zaurus.

6th May 2006

12:02pm: How not to charge nokia 6230, part II
I thought I found a way to charge 6230 from the usb after _long_ google session... according to diode is needed. Unfortunately, my 6230 disagrees: if I add the led to original charger, it still works, but if I try it from USB port, I get "not charging" message.

Nokia seems to have some notices about "pirate charges" :-(. Hey, nokia, this is _my_ cellphone, not yours. Seems like pulsing voltage is needed and 6230 actually checks for that :-(.

And a small message for Pete: swap partitions are still useful these days if you want to use suspend-to-disk.

4th May 2006

11:24pm: How not to charge nokia 6230
There are few different chargers for 6230; and I probably have the wrong one:

ACP-7X 3.7V 355mA (and pretty old)

(there are few others that should work:)
ACP-8X 5.3V 500mA (Travel Charger that came with 6310i)
ACP-8X 5.8V 450mA (Travel Charger that came with 3310)
ACP-12X 5.7V 800mA (Fast Travel Charger that came with 7250i)

... but I'd prefer Nokia to charge from usb, like my Zauruses already do (handy cable came with dlink wireless router, IIRC :-), and my Ericsson cell phones do (had to make cable, but it was easy -- two pieces of wire + two connectors).

After some pondering of numbers above... it looks to me like Nokia behaves like 10Ohm resistor in most cases. I kind of remembered that Nokia would prefer current source (not voltage source), and figured out that 2Ohm resistor in paralel is probably okay to simulate that...

Well, it is not :-(.

I tried connecting USB with old nokia (3310, IIRC)... and it seemed to work in all cases (but I did not check that too thoroughly, and did see some "Not charging" messages after a while when it pretended to be charging but probably was not); directly connected, connected through 2Ohm resistor, connected through 3Ohm resistor. Unfortunately, 6230 just displayed "not charging" message, and was done with it :-(.

I tried taking ACP-7X charger (that obviously works with 3310, and works badly with 6230), and yes it still worked with 3310 and 6230, and it even worked when it was connected through 2Ohm (more precisely 2.2Ohm) resistor.

I also tried with el-cheapo power brick (that is not properly regulated, so gives ~10V when unloaded, as does original nokia charger).

I wonder what is going on, what magic is needed so that 6230 actually gets some energy from USB?

2nd May 2006

2:09pm: nokia 6230 to-fix list
As promissed, here are few places where 6230 could be improved. Don't take me wrong, it is better phone than k700i, and certainly better than p910i "brick".

8 hours in charger is not enough to charge a battery -- if you keep phone loaded with GPRS/EDGE connection. (Actually, I'm probably using wrong charger; it is rated for 3.7V, so it probably is "old" nokia charger. Will try to feed nokia over 3Ohm resistor from USB port).

There's no easy way to get back from dialog like enter address -- red button puts you
directly into standby. Ouch and hiding "Go to address" in "other
options" with no history was not great idea, either. It does not even
put "old" address in there, so you can't use it as "Edit address" :-(.
Plus of course internal web browser does not display most pages
properly; still it is better than web browser in k700i. But OperaMini is still a neccessity for complex pages.

Menus suck. You can do quick movement with number keys, but there are timeouts there, and it only works if you use number keys all the way from standby. Bad. Sending/receiving SMSes sucks. Nokia does not understand delivery reports, and just puts them into your inbox. Ericsson solution (remember what you sent and show different icon for delivered messages) was batter than that. And siemens solution (just display delivery reports on the screen, only) is IMHO superior to both nokia and ericsson. And then there's poorly done selection of number to send to... ericsson actually offered list of last numbers, along with "enter number" and "search name" options. Nokia just lets you enter number, with no history. Then you send a message and it puts you back to message composing window, as if nothing happened. "Did I send that message or not?".

Oh, and of course, Nokia 6230 has no email client. They have some java thing that can't do even basic stuff :-(. No attachments, no deleting messages on server, for example. Unusable. ( is better mail client than _that_, and mujmail still needs _lots_ of work).

On positive side, 6230 can do bluetooth from java, so you can actually communicate with bluetooth gps. Navlet looks prommising...

I wish nokia used normal 3.5mm headphone jack and charged from USB... unfortuantely they have proprietary connectors for both :-(. On possitive side, radio is actually usable on 6230; mp3 player looks nice on paper, but it is so quiet that it is unusable.
Powered by