Keyboard input / init + questions

Jerome Martin jxm at risingtidesystems.com
Mon Sep 27 15:33:23 PDT 2010


Hi Charlie,

On Mon, Sep 27, 2010 at 8:01 PM, Charlie Brej <plymouth at brej.org> wrote:

> Sorry about the delay. I'll try and answer as many questions aimed for me
> as I find, but I will probably have missed some.


No problem.


>
> On 09/25/2010 11:50 AM, Jerome Martin wrote:
>
>> - Is there a way to call up an external binary from plymouth, like a
>> system() function ? If not, I guess this would not be much to add, I can
>> do it if you give me a proper pointer in your code (hints on the proper
>> parse token to use, etc.).
>>
>
> Yes possible, although I would recommend using the on keystroke execute
> command feature rather than letting a plugin run anything it likes. At least
> that way you can be sure what state the system is in.


Well, this will be under control :-)
I just need a small menu (not a problem to implement) that asks a couple of
questions and pass the answers to a couple of config scripts. The system is
a cluster node that boots from a live system image, reads a persistent
config partition and autoconfigures itself. But for seeding the cluster, or
in corner cases, I need some interaction with the user to help seed the
config, and I want to use plymouth for that.


>
>
>  - I desperately miss a couple of possibilities regarding strings, like
>> determining a string length, and addressing strings as lists
>> (a="foobar"; c=a[2]), thus making it possible to do strings
>> transformations, iterate on strings, etc. Did I miss something ? Would
>> that be hard to implement ?
>>
>
> Ah! So there are two functions that do this. "CharAt" and "SubString".
> Somehow, I forgot to add these to the wiki.
>
> "String".CharAt(2) => "r"
> "String".SubString(2, 4) => "rin"
>
> I think it is indexed starting at zero and the SubString takes inclusive
> start and end pointers.


Yes, meanwhile, as I said in a later email, I noticed those in the code. I
will add a String.Len() method for my needs an be all set.


>
>
>  - Last, but related to the previous, I currently keep an index on lists
>> I create to knopw their length before iterating on them, but it would be
>> nice to have a mylist.Len() method.
>>
>
> Are you just appending to a list by adding elements at increasing indices?
> list[0] = "blah", list[1]="sdf"...
> In which case you can just add a length element and keep that up to date
> when you add/remove elements. (list.length++ or list["length"]++)


This is what I do right now, I do the housekeeping in my script for an
separate length variable. But now that I have added a couple of additional
methods to plymouth script modu;e, I know how trivial it is to add that kind
of thing, so I'll just do it when I do not feel to lazy/when the need is
immediate.


>
>  Can any of the two previous points be done with a "list | []" method of
>> sorts ?
>>
>
> Not really. That's a rather complex one to explain.
>

<nod>

>
> > Things using "\033"
>
> There is no escaping supported in the scripted system apart from \n \" and
> \0.
>
> Ok, sorry, just found your patch. I'm split between \123 and \x123.
>

Mhhh, I hesitated too but settled for C-like behavior.
We can make it nicer and easily support at the same time \0, \XYZ with XYZ
in octal, even \XY if we add a lookahead function for the n next chars that
do not shift the current char pointer.


>
> Are there other questions I have missed?


I think that's all, actually I solved most of it meanwhile :-)
The code is pretty clear when you get into it. It only lacks a bit of user
docs.

What do you think about having a switch to hand ctrl-V, esc, etc either to
the script or to the main.c code depending on the user needs ? that would
allow me to submit something that could go in your git repo for my ANSI key
handling logic. I could even add some examples from my code, like a log
viewer that supports scrolling with up/down, things like that.

Best Regards,
-- 
Jérôme Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/plymouth/attachments/20100928/2a5edb48/attachment.html>


More information about the plymouth mailing list