Keyboard input / init + questions

Charlie Brej plymouth at brej.org
Tue Sep 28 11:06:44 PDT 2010


On 09/27/2010 11:33 PM, Jerome Martin wrote:
> Hi Charlie,
>
> On Mon, Sep 27, 2010 at 8:01 PM, Charlie Brej <plymouth at brej.org
> <mailto: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.

Yeah the \123 is more standard. Although now I am thinking all of this 
should be unicode characters and have a unique character for each key 
stroke (ctrl-V, esc, etc).

> 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 ?

OK, that is a little scary. I can see why that is useful, but having a 
key to force the details view is a good thing. Also I think it is a good 
idea to make any interaction that happens, work with any plugin.

> I could even add some examples from my code,
> like a log viewer that supports scrolling with up/down, things like that.

That sounds like something I wanted to try out. Would love to see your 
implementation.


More information about the plymouth mailing list