The Shoes of the Fisherman's Wife Are Some Jive-Ass Slippers

tpot (at) frungy . org

rss

2005
Months
Apr

Fri, 29 Apr 2005

twisted.internet.gtk2reactor

Here's a short example script that gets Twisted Python, PyGTK and glade together in the same room. I'm getting a bit sick of the single threaded GUI programming. It seems that sooner or later when you're writing a GUI that you will need to address the problem of refreshing when performing a blocking operation, usually accessing the network in some way.

#!/usr/bin/python

from twisted.internet import gtk2reactor
gtk2reactor.install()

import gtk.glade

xml = gtk.glade.XML('foo.glade')

win = xml.get_widget('window')
win.connect('destroy', gtk.main_quit)
win.show()

from twisted.internet import reactor
reactor.run()

Google doesn't know of many people using the gtk2reactor. Hopefully it will work well as I get the impression that the twisted reactor for wxWindows/wxPython doesn't work well and may never do so.

posted at: 11:53 | path: /software | permanent link to this entry

Tue, 26 Apr 2005

Fooling around with valgrind

The new version of valgrind is supposed to have a spiffy new internal representation (IR) format that makes life easier for 64-bit architectures, among other things. It's based on a library, LibVEX, whose purpose in life is to translate from native machine code to IR. The various *grind tools then operate on the generated IR.

Here's a sample of IR courtesy of the --trace-flags option to valgrind:

$ /usr/local/bin/valgrind --tool=memcheck --trace-flags=10000000 /bin/ls

        0x1B8E4C20:  movl %esp,%eax

              ------ IMark(0x1B8E4C20, 2) ------
              PUT(0) = GET:I32(16)

        0x1B8E4C22:  call 0x1B8E4C70

              ------ IMark(0x1B8E4C22, 5) ------
              PUT(56) = 0x1B8E4C22:I32
              t0 = Sub32(GET:I32(16),0x4:I32)
              PUT(16) = t0
              STle(t0) = 0x1B8E4C27:I32
              goto {Call} 0x1B8E4C70:I32

. 0 1B8E4C20 7
. 89 E0 E8 49 00 00 00
This basic block (BB) consists of two x86 machine code instructions which are translated to two IR statements. The valgrind/VEX CPU state model is based on loads and stores to a chunk of memory which represents the various kinds of registers the CPU being valground is. The %esp reigster is at offset 16 and %eax at offset 0, as defined by libvex_guest_x86.h, so the instruction movl %esp,%eax is translated into "store the 32-bit integer at offset 16 to offset 0" in the IR.

The second statement is a bit more complicated. A 32-bit constant address is loaded into the instruction pointer (offset 56 is %eip) and a temporary variable is used to create a stack pointer or maybe a return address that is made when the function call completes. I don't really know that much about x86 assembly language.

posted at: 14:35 | path: /software | permanent link to this entry

Sat, 23 Apr 2005

Finished linux.conf.au

Well it's all over and it was totally rocking. The only major disappointments were that I had a bad case of the flu the entire time (and possibly infected the other delegates) and that I had seen every one of the Best Of talks.

Highlights were Eben Moglen, tridge "reverse engineering" bitkeeper on stage in a few lines of shell, and seeing a bunch of HP people from around Australia and Ft Collins. Eben's talk was almost like a political rally (which I guess in some sense it was) with most of the audience caught in his spell and breaking in to spontaneous applause often.

Muchos thanks to the organisers and volunteers! Congratulations on a very successful conference. Next year's LCA is in Dunedin, New Zealand which looks like a very beautiful location.

posted at: 19:33 | path: /conferences | permanent link to this entry

Tue, 19 Apr 2005

At linux.conf.au

There's muchos geeking going on and stacks of people sitting around with laptops ignoring each other. Pure bliss!

posted at: 13:23 | path: /conferences | permanent link to this entry

Sun, 03 Apr 2005

ACPI Startup and Shutdown

One feature I would like to have for my PVR is the ability to shut itself down when there is nothing to do and restart itself when there is something interesting to record. The TiVo is designed to stay on all the time and apparently it does things like dial in to TiVo HQ, reindex its database and other cleanup stuff.

There are quite a few ways I can think of making a server start and restart itself without direct human intervention, but using the ACPI support in the 2.6 kernel looks like the best so far. After some mucking around with BIOS settings, I can suspend my machine with:

# echo 3 > /proc/acpi/sleep

and wake it up at a given time with:

# echo 2005-04-03 20:10:10 > /proc/acpi/alarm

Unbelievably, this works as advertised (2.6.11 kernel) except for the fact that the hardware clock is stored in UTC, not local time. Not bad for an old 800MHz Athlon with a BIOS dated sometime in the year 2000. There were only a few hiccups. The crappy-ass closed source nvidia kernel module refuses to suspend itself, and for some reason mysql can't be shut down by the software suspend code. If I try and unsuspend the machine by hitting the power button, it comes up OK but then decides to immediatly shutdown as the kernel doesn't clear the power button state after resuming. (-:

I recorded some quality British drama by hand last night. It ended up being 2.3GB which is a little under 1MB/sec. This is a widescreen MPEG2 stream as it is broadcast so it's compressed already, but is still quite big. MythTV has various settings for running XviD on received streams in the background. I might implement something like this for archiving recorded shows. I did experience a small amount of filesystem corruption during the recording process. My primary ext3 partition changed to read-only and a reboot+fsck fixed a bunch of stuff. It sounds like there is something dodgy going on with the DVB drivers.

posted at: 11:57 | path: /pvr | permanent link to this entry