[SLOF] [PATCH v3 10/17] Add support for a TPM menu to control the state of the TPM
Thomas Huth
thuth at redhat.com
Tue Dec 22 01:48:02 AEDT 2015
On 21/12/15 15:39, Stefan Berger wrote:
> On 12/15/2015 07:34 AM, Thomas Huth wrote:
>> On 30/11/15 23:01, Stefan Berger wrote:
>>> diff --git a/board-qemu/slof/vtpm-sml.fs b/board-qemu/slof/vtpm-sml.fs
>>> index 193b567..3e17c82 100644
>>> --- a/board-qemu/slof/vtpm-sml.fs
>>> +++ b/board-qemu/slof/vtpm-sml.fs
>>> @@ -120,6 +120,200 @@ log-base LOG-SIZE tpm-set-log-parameters
>> ...
>>> +\ wait for keyboard input
>>> +: menu-key-get
>>> + 0 0 DO
>>> + key? IF
>>> + key
>>> + UNLOOP EXIT
>>> + THEN
>>> + 100 MS
>>> + LOOP
>>> + 1b
>>> +;
>> Is that some kind of timeout that you've tried to do with the "100 MS"
>> and 1b at the end here? If so, that should have a proper comment. Then I
>> somewhat doubt that it is working as expected: Since you're looping with
>> "0 0" that means the loop is running almost forever - and since you're
>> delaying 256 ms inbetween (yes, we're hex), the loop will likely never
>> end while the user is sitting in front of the screen.
>> So if you really want to time-out here, I think you have to rework the
>> code. If you wanted to do an endless loop instead ... well then please
>> do not use "DO ... LOOP" and something like BEGIN ... WHILE ... REPEAT
>> or BEGIN ... UNTIL instead.
>
> It was meant to get a key from the keyboard. So I replaced the code now
> as follows:
>
> \ wait for keyboard input
> : menu-key-get
> BEGIN key? 0=
> WHILE 64 MS
> REPEAT
> key
> ;
If you just want to get a key in a blocking way, you can simply use
"key" alone, without the loop magic. "key" blocks until a key has been
pressed, and you only need to use "key?" if you do not want to block
while checking for the availability of a key.
Thomas
More information about the SLOF
mailing list