[powerdebug 02/17] make use of the mainloop code