debugging plymouth scripts
Andre "Osku" Schmidt
andre.osku.schmidt at osku.de
Thu Jul 22 12:58:13 PDT 2010
On Thu, 2010-07-22 at 10:44 -0400, wayne smith wrote:
> Thanks for the reply. Great tutorials by the way. Currently I'm using
> the --debug flag with plymouthd. I would like to display the current
> value of a counter (progress), I think Image.Text will do it. I'll
> give it a try.
attached is a little "test" script theme i made a while back, could be
useful in "debugging" too.
heres a video of it in test environment:
http://osku.de/post/plymouth_values.ogv
cheers
.andre
-------------- next part --------------
c1 = 1;
c2 = 0.5;
c3 = 0.25;
offX = 20;
offY = 20;
height = 0;
y = offY;
mode.name_i = Image.Text ("Plymouth.GetMode ", c2, c2, c2);
mode.val_i = Image.Text (Plymouth.GetMode(), c1, c1, c1);
mode.name_s = Sprite (mode.name_i);
mode.val_s = Sprite (mode.val_i);
mode.name_s.SetX (offX);
mode.val_s.SetX (offX + mode.name_i.GetWidth());
mode.name_s.SetY (y);
mode.val_s.SetY (y);
height = mode.name_i.GetHeight();
y += height * 2;
winw.name_i = Image.Text ("Window.GetWidth ", c2, c2, c2);
winw.val_i = Image.Text (Window.GetWidth(), c1, c1, c1);
winw.name_s = Sprite (winw.name_i);
winw.val_s = Sprite (winw.val_i);
winw.name_s.SetX (offX);
winw.val_s.SetX (offX + winw.name_i.GetWidth());
winw.name_s.SetY (y);
winw.val_s.SetY (y);
y += height;
winh.name_i = Image.Text ("Window.GetHeight ", c2, c2, c2);
winh.val_i = Image.Text (Window.GetHeight(), c1, c1, c1);
winh.name_s = Sprite (winh.name_i);
winh.val_s = Sprite (winh.val_i);
winh.name_s.SetX (offX);
winh.val_s.SetX (offX + winh.name_i.GetWidth());
winh.name_s.SetY (y);
winh.val_s.SetY (y);
y += height * 2;
cb1.name_i = Image.Text ("Plymouth.SetRefreshFunction", c2, c2, c2);
cb1.name_s = Sprite (cb1.name_i);
cb1.name_s.SetX (offX);
cb1.name_s.SetY (y);
cb1.height = cb1.name_i.GetHeight ();
y += height;
cb1.val1_s = Sprite ();
cb1.val1_s.SetX (offX);
cb1.val1_s.SetY (y);
y += height * 2;
cb2.name_i = Image.Text ("Plymouth.SetBootprogFunction", c2, c2, c2);
cb2.name_s = Sprite (cb2.name_i);
cb2.name_s.SetX (offX);
cb2.name_s.SetY (y);
cb2.width = cb2.name_i.GetWidth ();
y += height;
cb2.val1_s = Sprite ();
cb2.val1_s.SetX (offX);
cb2.val1_s.SetY (y);
cb2.val2_s = Sprite ();
cb2.val2_s.SetX (offX + (cb2.width / 2));
cb2.val2_s.SetY (y);
y += height;
cb2.txt1_i = Image.Text ("progress", c3, c3, c3);
cb2.txt1_s = Sprite (cb2.txt1_i);
cb2.txt1_s.SetX (offX);
cb2.txt1_s.SetY (y);
cb2.txt2_i = Image.Text ("seconds", c3, c3, c3);
cb2.txt2_s = Sprite (cb2.txt2_i);
cb2.txt2_s.SetX (offX + (cb2.width / 2));
cb2.txt2_s.SetY (y);
y += height * 2;
cb3.name_i = Image.Text ("Plymouth.SetBootProgressFunction", c2, c2, c2);
cb3.name_s = Sprite (cb2.name_i);
cb3.name_s.SetX (offX);
cb3.name_s.SetY (y);
y += height;
cb3.val1_s = Sprite ();
cb3.val1_s.SetX (offX);
cb3.val1_s.SetY (y);
y += height * 2;
cb4.name_i = Image.Text ("Plymouth.SetKeyboardInputFunction", c2, c2, c2);
cb4.name_s = Sprite (cb4.name_i);
cb4.name_s.SetX (offX);
cb4.name_s.SetY (y);
y += height;
cb4.val_s = Sprite ();
cb4.val_s.SetX (offX);
cb4.val_s.SetY (y);
cb4.y = y;
y += height * 2;
refresh = 0;
d_i = Image.Text ();
l = 0;
c = 0;
chrlinewidth = 0;
chrwidth = 0;
foolog[0] = Sprite ();
barlog[0] = Sprite ();
chrlog[0] = Sprite ();
fun refresh_callback () {
foo = Image.Text (refresh, c1, c1, c1);
cb1.val1_s.SetImage (foo);
refresh++;
}
fun progress_callback (d, p) {
foo = Image.Text (p, 1, 1, 1);
d_i = Image.Text (d, 1, 1, 1);
cb2.val1_s.SetImage (foo);
cb2.val2_s.SetImage (d_i);
}
fun status_callback (text) {
foo = Image.Text (text, c1, c1, c1);
cb3.val1_s.SetImage (foo);
foolog[l] = Sprite (d_i);
barlog[l] = Sprite (foo);
foolog[l].SetX (Window.GetWidth() / 2);
foolog[l].SetY (offY + (height * l));
barlog[l].SetX ((Window.GetWidth() / 2) + 80);
barlog[l].SetY (offY + (height * l));
l++;
}
fun input_callback (chr) {
key = Image.Text (chr, c1, c1, c1);
chrlog[c] = Sprite (key);
chrlog[c].SetY (cb4.y);
chrlog[c].SetX (offX + chrlinewidth);
chrw = key.GetWidth();
chrlinewidth += chrw;
c++;
}
Plymouth.SetRefreshFunction (refresh_callback);
Plymouth.SetBootProgressFunction(progress_callback);
Plymouth.SetUpdateStatusFunction(status_callback);
Plymouth.SetKeyboardInputFunction(input_callback);
More information about the plymouth
mailing list