xous-core/services/gam
Gianguido Sorà aa44834fbd Squashed commit of the following:
commit 1106fcfa46
Merge: 08de49da d57088a5
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 16 22:35:11 2022 +0800

    Merge pull request #277 from gsora/feat/slider-widget

    feat: user interaction-enabled slider

commit d57088a592
Author: Gianguido Sorà <me@gsora.xyz>
Date:   Wed Nov 16 14:45:46 2022 +0100

    feat: add tests for slider

commit 5243e8c258
Author: Gianguido Sorà <me@gsora.xyz>
Date:   Mon Nov 14 19:36:25 2022 +0100

    feat: user interaction-enabled slider

    This commit adds `modals::Modals::slider()` with the same interface as
    `modals::Modals::start_progress()`, with the striking difference that
    users can move the slider, and press the center keypad button to confirm
     the selection.

     Useful for objects like audio volume controls.

commit 08de49dab1
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 15 02:25:22 2022 +0800

    make testing a little more ergonomic

commit ef5c05683c
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 15 02:23:13 2022 +0800

    add a quick and dirty test command for headphone state

commit 04f700ac29
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 15 02:23:01 2022 +0800

    add headphone state polling to codec

commit 474a02c2cb
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 9 15:06:51 2022 +0800

    refactor all vault db retrieval to use new API

    This refactors the remaining vault accessor routines to use
    the new more efficient key pre-fetching routine. This also
    fixes up an error in test case generation and hopefully resolves
    an issue with concurrency errors using the older version of
    the access routine.

commit c3ba30d55d
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 9 14:25:26 2022 +0800

    expand on errors reported

commit e7e110ce76
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 9 14:25:05 2022 +0800

    cleanup and enhance test cases

commit 6d1d297500
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 9 01:01:42 2022 +0800

    bump ring-xous to track latest PR

commit 11a0107e97
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 9 00:33:13 2022 +0800

    fix UX state after button press on dynamic modal

    This bug was hidden by the previous return of state before
    the reliquish.

    Now with the correct ordering, we end up getting a double-relinquish
    which ends up trying to swap a modal into focus which doesn't exist.

    This fixes that edge case

commit 4c45dfa6bf
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 9 00:33:01 2022 +0800

    more debugging help

commit 1129f1c3c6
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 23:05:32 2022 +0800

    bump versions after xous-names bump

commit a7162fd03c
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 22:19:38 2022 +0800

    bump xous-names dependents

commit 28f42baa44
Merge: 1bc39cd5 3ca323f0
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 22:09:56 2022 +0800

    Merge pull request #274 from betrusted-io/xous-names-tryconnect

    Add TryConnect call to xous-names

commit 3ca323f0bb
Author: Sean Cross <sean@xobs.io>
Date:   Mon Nov 7 18:46:02 2022 +0800

    xous-names: implement non-blocking TryConnect call

    This call can be used by clients to try connecting to a service. If the
    service is not available, this will fail to connect.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit 3ca57bcf8b
Author: Sean Cross <sean@xobs.io>
Date:   Mon Nov 7 18:45:25 2022 +0800

    xous-api-names: add TryConnect

    This is a non-blocking version of Connect that is fallible.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit 1bc39cd513
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 00:25:16 2022 +0800

    bump release notes

commit 781776b1fe
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 00:22:49 2022 +0800

    move the mount initiator back into status; fix waiting signal

    mount initiator is now back inside of the status thread
    (woo, no more app-specific dependency) and there is now a
    wait on "attempted to mount" inside the status thread which is
    the signal to clear the "waiting on boot" message.

commit 0646ec23ba
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 00:21:52 2022 +0800

    track "attempted" mounts in PDDB

    this is to allow a UX process to clear the "waiting for boot"
    indicator once an attempt has completed.

    right now, it responds *after* the mount process is done,
    so the "please waiting" text persists even doing a format.

    I think that is...appropriate?

commit 93dcfb7435
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Nov 7 00:21:27 2022 +0800

    fix hosted mode

commit 335b78d865
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 20:50:15 2022 +0800

    fix polarity of init_done flag. oops.

commit 1d7641cafa
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 18:48:23 2022 +0800

    force please wait message to clear before doing PDDB init

    While it's a kind of neat effect to have the "please wait"
    message persist right up until the point where the dialog box
    pops up, the problem is that the blit of the backplane captures
    that, so when the context is reverted that message is still there.

    On a very fast mount (empty PDDB under Renode emulation) the
    mounting call finishes so quickly that the dialog box that would
    normally trigger the redraw to clear this message never renders.

    This patch forces the screen to blank before trying to call
    PDDB init, ensuring that we don't have that persist after the
    mount, even if it is very fast.

    The downside is there is a fraction of a second where the please
    wait disappears, and the dialog box pops up. That is just the
    time it takes for the system to setup for the cryptographic
    operations.

commit 382380bd8a
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 18:48:06 2022 +0800

    fix Sender cast

commit 3ee36f41ee
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 18:45:17 2022 +0800

    remove UX delays on PDDB path

    retain just one of them going into the erase routine, because
    it consumes enough CPU that the dialog box takes a bit too long to
    pop up.

commit 880675c238
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 18:44:56 2022 +0800

    remove UX delays between dialog boxes

commit ffa8385e7c
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 18:36:20 2022 +0800

    refactor: send response packet after context has been switched

    This refactor (at least partially) fixes a "mystery delay"
    sometimes required after a dialog box swaps out. The previous
    implementation would send the response, and then swap the contexts.
    This would often cause the recipient to start drawing its UX
    before the calling app was foregrounded, causing elements to go
    missing.

    This refactor puts the response after the context swap. The main
    downside is it requires every type of modal to have a GAM
    handle to issue the redraw call, and is especially complicated
    by the fact that GAM is not clone-friendly. However, the
    trade-offs of either creating a handle dynamically or storing
    one in the object is probably worth the benefit of removing
    an open-loop delay.

commit b0f443be48
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 16:33:31 2022 +0800

    fix race condition on relinquish focus v result return for dynamic and progress modals

    There's a race condition between the return of a blocking scalar
    and when focus is relinquished.

    This causes chained graphics operations to get dropped sometimes.

    Move the return result to after the focus switch; this allows us
    to elimate some dead waits.

commit 5a0e3e5c19
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 15:59:58 2022 +0800

    clean up bitrot in dbg-ecupdate configuration

commit 69cf629329
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 04:25:26 2022 +0800

    fix problem in tts build

commit 767580d375
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 04:17:53 2022 +0800

    bump versions

commit 30583bdf07
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:48:12 2022 +0800

    bump versions with xous change

commit e85455a077
Merge: a16304b0 c9f751f5
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:44:58 2022 +0800

    Merge pull request #271 from betrusted-io/scalar5-support

    Scalar5 support

commit a16304b0eb
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:42:07 2022 +0800

    bump release notes

commit 2a11f9dcaf
Merge: 1ca0ef7b fa90e74a
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:40:37 2022 +0800

    Merge branch 'main' of github.com:betrusted-io/xous-core into main

commit fa90e74a10
Merge: 42642310 817e758f
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:40:17 2022 +0800

    Merge pull request #270 from gsora/feat/pddb-init-notification

    feat: show boot process notifications for PDDB

commit 817e758f7c
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:36:43 2022 +0800

    remove the dead-wait before the PDDB is mounted

    the "right" way to do this is to poll to see if trusted init is
    done. once that is done, you can go ahead and try to mount the
    PDDB.

commit a56b8c802f
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:11:23 2022 +0800

    add automounter to shellchat, and initial wait message

    The initial wait message is drawn directly under where
    the modals would appear, so the message "goes away"
    when modals pop up.

    There's still a bit of trickiness around the timing of
    some of the calls. Attempting to mount the PDDB too early
    before all the contexts have been registered leads to
    a lot of needless defacing.

    Also, the final redraw needs a short delay to allow
    the system to foreground shellchat again after closing
    the modals.

commit e240ca6499
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:10:00 2022 +0800

    refactor the hardware boot screen

    - remove a blanking operation. this makes the transision from
    loader to runtime almost imperceptably smoother
    - add the ability to summon the logo screen earlier in the process

    Note that only GAM can call GFX, so, it's alright to expose that
    API, since GAM should gate-keep and prevent abuse of that function.

commit 7eecf2b1ce
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:07:35 2022 +0800

    remove the initial wait from PDDB; move the pop-up modal location

    The initial wait message is now rendered by the first app
    that owns the screen (currently shellchat).

    The location where the pop-up modal is rendered is also now bracketed
    directly around the mount call to avoid interference with other
    edge cases that may pop up modals.

commit 0d02415c82
Author: bunnie <bunnie@kosagi.com>
Date:   Sun Nov 6 03:05:30 2022 +0800

    remove automounter from the status thread

    it's now in shellchat. In general, the program that is assigned
    as the initial app context is responsible for ensuring the
    PDDB is mounted. Thus, if `vault` were to become a stand-alone app,
    it should include some code to make sure the PDDB is mounted as
    part of its boot sequence.

    The reason is that it allows the initial app to guide the
    power-on experience, instead of delegating this to the `status`
    bar, which is oblivious to the state of the app.

commit 45009a01d9
Author: bunnie <bunnie@kosagi.com>
Date:   Sat Nov 5 23:06:47 2022 +0800

    add debugging hints for figuring out context switch bugs in the future

commit 7c4ca05922
Author: bunnie <bunnie@kosagi.com>
Date:   Sat Nov 5 23:06:18 2022 +0800

    adjust modal trust level down so it's not identical to chat

commit c9f751f5f0
Author: Sean Cross <sean@xobs.io>
Date:   Sat Nov 5 18:44:01 2022 +0800

    xous: add api support for scalar5

    With the addition of scalar5, existing api calls must be updated to take
    advantage of it. This will allow `send_message()` to return a `scalar5`.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit da5647539f
Author: Sean Cross <sean@xobs.io>
Date:   Sat Nov 5 18:39:54 2022 +0800

    kernel: syscall: add support for return_scalar5

    Add kernel support for returning 5 scalars.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit c8bb039c41
Author: Sean Cross <sean@xobs.io>
Date:   Sat Nov 5 18:39:06 2022 +0800

    xous: add api support for `Scalar5`

    Add syscall and return definitions for Scalar5, as well as
    ReturnScalar5. This will enable us to pass up to five scalars as a
    return from a blockingscalar call.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit 1ca0ef7b1f
Author: bunnie <bunnie@kosagi.com>
Date:   Sat Nov 5 16:30:29 2022 +0800

    clean up warning

commit 601f3476f4
Author: bunnie <bunnie@kosagi.com>
Date:   Sat Nov 5 16:19:15 2022 +0800

    initial delay on NTP poller

    no point in clogging up the boot sequence with requests that
    will almost certainly fail.

commit d277ae9551
Author: Gianguido Sorà <me@gsora.xyz>
Date:   Fri Nov 4 17:31:27 2022 +0100

    feat: show boot process notifications for PDDB

    This commit shows two notifications:
     1. as soon as the device boots, a notification greets the user and
     tells them everything is fine, the device is booting
     2. as soon as the user enters (or doesn't) enter the password, a
     notification tell the user Xous is loading and mounting PDDB

    I spent too much time on this but I believe it's a nice UX improvement.

commit 4264231033
Merge: 5de44a95 f861af76
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Nov 4 17:06:40 2022 +0800

    Merge branch 'main' of github.com:betrusted-io/xous-core into main

commit 5de44a9502
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Nov 4 17:05:51 2022 +0800

    don't fail if keyattribute not found in current basis when no basis specified

    This is not actually an error, we just need to try another basis
    down the list. This is a copypasta bug that was only caught now. :-/

commit 0d9a39a349
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Nov 4 17:05:32 2022 +0800

    print debug information when a key goes missing in bulk read

    this helps debug problems down the road

commit f861af7620
Author: Sean Cross <sean@xobs.io>
Date:   Fri Nov 4 12:27:13 2022 +0800

    tools: elf: fix copy-elf when gcc links program

    GCC will set the text size to `0` in a certain case that `rust-lld` did
    not. This causes the elf copier to add about 512 MB to the image which
    it otherwise shouldn't be doing.

    Add a workaround that appears to fix the issue.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit 3a8457852f
Author: Sean Cross <sean@xobs.io>
Date:   Fri Nov 4 12:26:05 2022 +0800

    loader: fix build with gcc-ld

    With Rust 1.65.0, we may be forced to use gdb's linker due to bug that
    appeared in llvm-15:

    https://github.com/rust-lang/rust/issues/103949

    Signed-off-by: Sean Cross <sean@xobs.io>

commit d74673ab29
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Nov 4 03:55:57 2022 +0800

    allow main menu to be used if there are no root keys

commit ed09ee03ef
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Nov 4 03:53:03 2022 +0800

    bump to latest ring-xous version

commit af91ec97cd
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 23:28:08 2022 +0800

    bump release notes

commit 80a1bd3654
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 23:18:13 2022 +0800

    resolve issue #267

commit 4dc7135e0e
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 23:06:20 2022 +0800

    update the instructions to build soc.svd, and add note about verification

commit 01f660b04d
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 21:11:58 2022 +0800

    didn't meant to check in that script

commit ff2a7f8240
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 21:06:04 2022 +0800

    some more debugging to help trace through dict sync issues

commit b04dcc21ef
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 21:04:14 2022 +0800

    add `smalldb` flag, which builds a PDDB with a size of 4MiB

    do not interchange this on devices with the full sized
    PDDB, you may corrupt the database

commit 6c2e86d876
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 21:03:40 2022 +0800

    add support for small-sized PDDB images plus some debugging info

commit 5c624e7e52
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 21:01:11 2022 +0800

    add a flush after every PDDB write

    uncommitted data will lead to corruption later on

commit c91837c10b
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 18:33:22 2022 +0800

    fix max dicts in analyzer scripts

commit 719020b08b
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 17:23:11 2022 +0800

    don't allow polls to the unmount to turn true until other callbacks have been allowed

commit 3bdf157f9d
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 17:22:22 2022 +0800

    enhance debugging output on pddb analyzer

commit 779cc61c56
Author: Sean Cross <sean@xobs.io>
Date:   Thu Nov 3 12:31:22 2022 +0800

    emulation: spinor: implement erasesector4byte

    Implement this command, which is used by the system for bulk erases.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit 0c52a7a3ff
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:58:36 2022 +0800

    the merge requested pulled multiple other crate versions backwards

    this fixes it, hopefully.

commit c04cc0e61c
Merge: 7af04b70 f59bbc2d
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:54:00 2022 +0800

    Merge branch 'main' of github.com:betrusted-io/xous-core into main

commit f59bbc2d2b
Merge: ebc0739b 6332bf1c
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:53:38 2022 +0800

    Merge pull request #266 from Foundation-Devices/driver-refactor

    kernel: Drivers refactor.

commit 6332bf1c90
Merge: 2cf4622f ebc0739b
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:53:23 2022 +0800

    Merge branch 'main' into driver-refactor

commit 2cf4622f68
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:50:36 2022 +0800

    commit lockfile and verification pins

commit 80094aef1e
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:49:28 2022 +0800

    I see what's happening. The PR originator versions are very out of date.

    hopefully this fixes the issue.

commit bbb7e279cd
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:42:59 2022 +0800

    bump kernel version (this time with feeling)

commit ba46c6b04a
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:41:24 2022 +0800

    bump kernel version

commit 7af04b7000
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Nov 3 01:38:18 2022 +0800

    a bit more debugging around dictionary creation

commit 6d2be1b6d7
Author: bunnie <bunnie@kosagi.com>
Date:   Wed Nov 2 21:52:28 2022 +0800

    add va printouts

commit d8807e6cea
Author: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date:   Wed Nov 2 14:29:53 2022 +0100

    kernel: Move rand driver to platform module.

    Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>

commit b334e5bc31
Author: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date:   Wed Nov 2 13:30:20 2022 +0100

    kernel: Split debug shell and uart driver.

    I've added a `platform` module to store all platform specific code, (not
    architecture specific) as some platforms will require custom drivers, e.g.
    for debug output and for the random number generation code.  The platform
    code is in charge of mapping any peripherals needed to work, also to
    initialize any other parts of the kernel that require drivers, for example
    the debug shell.

    Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>

commit ebc0739bee
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 1 21:25:04 2022 +0800

    fix some defaults to make the Renode path cleaner to start

commit f738781a40
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 1 21:18:33 2022 +0800

    make the default pin 'a', as it is on Renode

commit 4e2d79942e
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 1 21:17:07 2022 +0800

    upgrade pdddbg to use basis decryption routines from the common libs

commit 54e929e877
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 1 19:01:57 2022 +0800

    move key extraction routines to pddbcommon.py

commit 05068c5cd0
Author: bunnie <bunnie@kosagi.com>
Date:   Tue Nov 1 13:03:52 2022 +0800

    extract the renode key box as a dump

commit c74ceacfef
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Oct 31 22:33:27 2022 +0800

    add a renode mode for reading in a renode.bin

commit a0dca39fa3
Author: bunnie <bunnie@kosagi.com>
Date:   Mon Oct 31 22:14:10 2022 +0800

    key file for decrypting .System basis on Renode

commit 05252663a4
Author: Tom Marble <tmarble@info9.net>
Date:   Sat Oct 29 17:38:22 2022 -0500

    Updates mtxcli README

    Signed-off-by: Tom Marble <tmarble@info9.net>

commit 604a3765b8
Author: Tom Marble <tmarble@info9.net>
Date:   Sat Oct 29 17:34:32 2022 -0500

    Adds images of mtxcli

    Images of mtxcli
    - in the hosted environment
    - on the Precusor
    - in French

    Signed-off-by: Tom Marble <tmarble@info9.net>

commit 072170efe1
Author: bunnie <bunnie@kosagi.com>
Date:   Sat Oct 29 18:01:18 2022 +0800

    restore the top-level settings file per xobs suggestion

commit 2fd685c513
Merge: 052817c7 38286d86
Author: Sean Cross <sean@xobs.io>
Date:   Sat Oct 29 04:52:48 2022 -0400

    Merge pull request #263 from sorpaas/sp-rename

    RemoveClockEntry -> TryRemoveClockEntry

commit 38286d8623
Author: Wei Tang <wei@that.world>
Date:   Sat Oct 29 10:47:47 2022 +0200

    RemoveClockEntry -> TryRemoveClockEntry

commit 052817c793
Merge: 3814337f 9689b3bc
Author: bunnie <bunnie@kosagi.com>
Date:   Sat Oct 29 00:39:27 2022 +0800

    Merge pull request #261 from betrusted-io/remove-vscode

    Removes VS Code artifacts

commit 9689b3bc07
Author: Tom Marble <tmarble@info9.net>
Date:   Fri Oct 28 11:23:56 2022 -0500

    Removes VS Code artifacts

    Also updates .gitignore to prevent adding IDE (VS Code, Emacs) artifacts

    Signed-off-by: Tom Marble <tmarble@info9.net>

commit 3814337f51
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 18:27:52 2022 +0800

    don't check in vscode settings

commit dd379aa9fb
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 18:16:16 2022 +0800

    bump kernel version

commit f01b2a871c
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 18:12:07 2022 +0800

    add some vscode stuff i guess to the release

commit f17e02460f
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 18:02:52 2022 +0800

    bump kernel revision

commit c17a6d3786
Author: Sean Cross <sean@xobs.io>
Date:   Fri Oct 28 17:38:25 2022 +0800

    kernel: make SYSTEM_SERVICES unmangled

    This symbol will be viewed by external tools.

    Signed-off-by: Sean Cross <sean@xobs.io>

commit fd739c2177
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:23:39 2022 +0800

    add `fr` locale to update options

commit f7eed18f48
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:18:34 2022 +0800

    bump verification and locks

commit ba28dd8795
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:11:17 2022 +0800

    bump to absorb utralib straggler configs

commit b5f4814bb4
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:10:00 2022 +0800

    cleanup some stragglers in utralib push

commit 6b296c9b48
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:04:56 2022 +0800

    fix a cargo file that got nuked in the merge

commit bcd1078fe2
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:01:38 2022 +0800

    bump lockfile

commit e60f7cc855
Merge: 0c7c90fb f8a66430
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 15:00:27 2022 +0800

    Merge branch 'i18n/adds-french-localization' into main

commit f8a6643054
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 14:55:33 2022 +0800

    bump locks

commit dfb10ed7f2
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 14:01:09 2022 +0800

    bump crate numbers to publish lang-fr change into xous-rs

commit 006a69105c
Author: Tom Marble <tmarble@info9.net>
Date:   Thu Oct 27 16:07:05 2022 -0500

    Completes the i18n_helper.py tool

    Added 'fr' translation
    Added *.json to .gitattributes

    Signed-off-by: Tom Marble <tmarble@info9.net>

commit 0c7c90fb78
Author: bunnie <bunnie@kosagi.com>
Date:   Fri Oct 28 02:55:42 2022 +0800

    have the core spinor routines automatically retry on failure

    normally we never see these failures, but, as we are seeing
    flash wear-out on the CI machine the writes can take
    long enough that we get some concurrent requests. As a work-around,
    just automatically retry a few times before throwing the error
    back to the caller.

commit d63c452fb6
Author: bunnie <bunnie@kosagi.com>
Date:   Thu Oct 27 23:00:10 2022 +0800

    catch serialization buffer edge case

    if the buffer fills up to the point where there isn't enough
    space for the 8-bytes of header, a split_at() call will fail before
    the routine even gets to decide if the record can fit.

    abort the loop if the buffer is that full.

commit 07cb2398d8
Author: Tom Marble <tmarble@info9.net>
Date:   Wed Oct 26 22:32:49 2022 -0500

    WIP: Adds new lang 'fr' for French

    Adds new Internationalization Helper tool: i18n_helper.py

    Signed-off-by: Tom Marble <tmarble@info9.net>
2022-11-17 10:53:32 +01:00
..
locales Squashed commit of the following: 2022-11-14 16:22:46 +01:00
src Squashed commit of the following: 2022-11-17 10:53:32 +01:00
build.rs xous: Use CARGO_CFG_TARGET_OS in build scripts. 2022-10-12 19:03:46 +02:00
Cargo.toml Squashed commit of the following: 2022-11-14 16:22:46 +01:00
README.md update some docs to refer to the modals refactor 2021-12-17 02:59:18 +08:00

Graphical Abstraction Manager (GAM)

The GAM provides abstract UI primitives to other modules.

The goal is to have this module work in close conjunction with the graphics-server, and all other modules would route abstract UI requests through this module.

Structure

At a high level, you can think of the GAM as a firewall around the graphics-server. The graphics-server has no concept of what pixel belongs where; it's happy to mutate a pixel that is anywhere within the physical hardware framebuffer.

Giving processes direct access to graphics-server means that a less trusted program could draw into an OS-reserved area, thus presenting false information to a user. The GAM solves this problem by dividing the screen into Canvas objects.

Ux Context Names

See tokens.rs for a list of expected boot UX contexts. The GAM enforces a policy that disallows the registration of unexpected UX contexts (including menus). When adding more UX elements, be sure to expand the list of EXPECTED_BOOT_CONTEXTS, or else the registration will fail.

Canvas

A Canvas is a minimal data structure that defines a physical region of the screen that will display a set of primitives. Canvas structures are domiciled in the GAM server, and are considered trusted by default, although there is a flag that can be cleared to make everything within it untrusted.

Each Canvas has a 128-bit GUID. Application processes that wish to draw something to the screen must refer to a Canvas by its 128-bit GUID; it is up to the GAM to not share secure GUIDs with insecure processes. Thus the security of a Canvas rests in the difficulty of guessing the 128-bit GUID, and also in the system not leaking GUIDs.

Every GAM drawing object includes the GUID of the Canvas to which it should be drawn. Upon receiving a draw request, it validates that the GUID exists, and applies any other relevant rules (for example, a higher security process can use the GAM to prohibit all drawing of lower security processes by marking their Canvas as not drawable).

All GAM drawing objects specify pixel offsets from a (0,0) top-left coordinate system. The GAM then handles translating these offsets from a virtual (0,0) Canvas offset to a physical region of a screen through the clip_rect record within the Canvas. The coordinate space of the clip_rect is fixed to the screen's coordinates, that is, (0,0) in the top left, X increasing to the right, Y increasing down.

A Canvas also stores a pan_offset. The pan_offset is added to every coordinate inside the objects that refer to a Canvas and then the result is clipped with clip_rect; this allows for easy implementation of panning and scrolling. (Note: this feature is largely untested as of March 2021)

A Canvas has a trust_level associated with it. Higher numbers are more trusted; 255 is the highest level of trust. Rules for drawing are as follows:

  1. More trusted Canvas objects always render on top of lower trusted object
  2. When a higher trusted Canvas object overlaps a lower trusted object, the lower trusted object is:
    • defaced using hatched lines with a random angle and spacing
    • further updates to the lower trusted object are disallowed.

Thus, a Canvas should not be thought of like a "window", as windows in typical UIs are allowed to freely overlap and clipping is handled by simply drawing over lower layers of content.

Canvas makes it strongly preferred to render trusted and untrusted data side-by-side, rather than one on top of each other.

This policy is partially to help users be very clear as to e.g. where a password box is vs. an image that looks a lot like a password box; but the policy is also informed by the limitations of the underlying hardware. In particular, the underlying memory LCD strongly relies on "dirty bits" for good performance, and doing full-region redraws to handle dirty rectangles on window movement is not an efficient use of dirty bits. Reducing time spent redrawing partially obscured windows is also good for performance and helps to simplify the code base, but these last two considerations are quite minor compared to the primary concern of a "least confusing" UI when it comes to differentiating between trustable and less trustable regions of the screen.

Thus, the simple rule is: don't stack content types of different trust levels. If you require content stacking, this can be done for content within a single trust level by using multiple objects within a Canvas, as they have a draw_order attribute and can handle content stacking; but between trust domains, it's both a trust and complexity issue to allow for simultaneous stacking of trust domains with live, full-content update of the underlying layers.

Defacing

Defacing is a policy implemented by the GAM which ensures that when trusted objects are overlaid on top of less trusted objects, the less trusted objects cannot be mistaken for a trusted object. This is to assist users with avoiding phishing attacks through Ux elements presented on less trusted canvases that look like trusted objects.

Defacing basically takes a bit of entropy from the TRNG and renders it in the form of random lines drawn across the defaced area. This allows users to still read the text within the defaced area, but makes it more difficult to mistake this area for something trusted.

Trust Level Policy Implementation

The RegisterUx opcode in gam is responsible for parceling out trust levels.

At boot, there is only a "boot context" -- no user apps are allowed, and all contexts are assigned a high trust level. During the boot process, apps are registered and claim names out of the tokens.rs EXPECTED_BOOT_CONTEXTS name space.

Roadmap (as of Xous 0.8.x): The idea is that once boot is thought to be completed, both xous-names and the gam are checked to ensure that all the available slots for boot processes are occupied. If this check passes, a flag should be set indicating we're done, and the max trust level assignable should drop. This process disallows future no-boot processes from registering as a trusted context, both in terms of their name space and their trust level.

TextView

A TextView object is a heavy data structure that contains both a xous::String and metadata which guides the GAM on how to render the string. Please note the philosophy of the GAM is to hide the exact details of how anything is rendered to the calling application. This both allows users to have greater control over customizing their interfaces, and also helps introduce a layer of protection against phishing; however it also means that UX designers will not be able to have exquisite control over the "look and feel" of their applications.

TextView objects are domiciled on the application process. The application process is responsible for guiding the rough layout of where TextViews go in a canvas. Once the object is finalized, the TextView objects are then mutably lent to the GAM using an rkyv lend wrapper; the calling thread then blocks until the GAM completes the rendering operation.

For layouts that need to adjust in height based on variable-length text strings, the calling application can use the bounds_hint/TextBounds to help manage this. The bounds of a TextView can either be a fixed-sized rectangle, or a box that grows up and out from a point plus a width. So, for example, a TextView could have an anchor in the lower-right hand corner, plus a maximum width, and the height of the box will be computed based as the text is rendered. The height of text can't be known a-priori, because for example, emoji glyphs and hanzi characters will have a different height than latin characters. A dry_run option is also available for a TextView so one can simulate the rendering to determine the height without paying the compuational price.

One can think of a TextView as a text bubble, that can have rounded or square corners, and its content string can be rendered with a selection of options that specify the glyph style (not a font -- it's more of a hint than a specifier), aligment, and the size of the text bubble. The text bubble can either be of a fixed size (such that the string will show ellipses ... if it overruns the bubble), or of a dynamically growable size based on its content.

Thus, a typical "chat-style" app where text bubbles show a history of the chat going from the most recent at the bottom of the screen to the oldest at the top, would start by rendering variable-height text bubbles on the bottom, getting the returned value of the rendered height, and setting the height of the next bubble on top for rendering, and then rendering that.

TextView can both be directly rendered to a Canvas, or managed by secondary object such as a Menu or List to compose other UI elements.

Menu

A Menu object encodes the state of a graphical menu. It's meant to be paired with a dedicated thread that serves as an event loop. You can look at the main menu implementation inside the GAM for an example of how this is done. Most event loops will look about the same; if you do not want to build an event loop, you can use the spawn_helper API to create one for you (see below).

Building a menu is fairly straight forward:

  • register your Menu object's name inside services/gam/src/tokens.rs. Currently, one can only register servers that are "expected" by the system; this is meant to prevent e.g. malicion code injection from conjuring UX elements.
  • create the Menu object by calling Menu::new(name: &str). This will automatically register an empty Menu layout as a Ux element inside the GAM.
  • add menu items by calling .add_item() on your Menu object
  • run the event loop and pass events back to the Menu object for processing

Each MenuItem has the following fields:

  • name: the text shown for the item
  • action_conn: a xous CID to the target server that receives the action of the menu item
  • action_opcode: the local opcode of the target server. Opcodes are private to the server, so menu-actionable opcodes need to be revealed with a helper method on the target server.
  • action_payload: an enum that encodes the payload of the Opcode. For now, only Scalar payloads are implemented, but the framework is there for some kind of a Frankenstein static-buffer to be passed on to targets
  • close_on_select: a boolean which indicates if the menu should automatically close once the item is selected

Modal

A Modal object encodes the state of a modal dialog box. A modal dialog box is limited to this general format:

  • Top text: describe the request
  • Action: the interactive element
  • Bottom text: reserved for validator error messages

The Action currently can be one of the following types:

  • TextEntry: for passwords, or for regular text
  • RadioButtons: for selecting one of many options
  • CheckBox: for selecting any of many options
  • Slider [NOT YET CODED]: for selecting a single numeric value along a range of values

Creating a Modal follows the same general pattern as the Menu, with the exception that the new() function is meant to be "complete": instead of creating a skeleton of a menu, the new() function takes all the necessary arguments for the repsective top, bottom, and action fields and tries to build the modal all in one go. It is, however, possible to dynamically modify the modal once created, using the modify() and remove() methods.

TextEntry supports an input validator; the validator takes as input the proposed payload string, and returns None if valid, or an error message that is plcaed into the dialog box's "bottom text" if the input is invalid.

TextEntry also supports "password" mode. When selected, text visibility can be controlled by a three-selection horizontal radio control that can select between "fully visible", "partially visible", and "fully obscured" states.

TextEntry is specifically coded so that its payload is cleared upon send, so that plaintext passwords are not left hanging around in the heap or stack.

The modals server allows applications to pop up generic modals without having to write all the eventing glue code to the GAM. The server has the following properties:

  • "Does about the right thing" for 90% of the applications
  • Shared between multiple processes with a lock -- so the messages from this server should not be absolutely trusted
  • Currently implements notifications, progress bars, text input, radio buttons, and checkboxes.
  • Has a "pure Rust" blocking API so routines can sequence through the dialog boxes in a declarative fashion without having to write fancy sequencing logic.

Example code:

  • The rtc server contains an example of a modal that uses the modals server.
  • The root-keys server contains an example of a static password modal, and uses an explicitly coded helper thread. It manages its own modals because it has a unique rendering property that can only be summoned by this process.

Helper Threads

A Menu or Modal needs to be able to respond to callbacks from the GAM. You can either do this with a separate, explicitly coded menu loop (as seen is the main menu and the emoji menus), or you can use the spawn_helper convenience call. To use spawn_helper, however, your local server need to implement three opcodes:

  • Redraw - calls the .redraw() method on the modal
  • Rawkeys - handles a set of key events destined for the modal
  • Quit - indicates that the server was told to quit for some reason (currently there's no good reason for this, but in the future once process destruction is supported, this will be important)

Your local server's opcode IDs are arguments to spawn_helper, along with both the private and the public SIDs. The public SID is inside the Menu or Modal object; it's shared with the GAM. The private SID is the SID of your loop handler, which is normally masked by xous-names. The private SID should not be shared with untrusted processes. However, since spawn_helper is in your own memory space, it's OK to shaer the private SID with this thread.

The TL;DR is that the helper thread is just a lookup table that maps UX opcodes to your thread's private opcode space, and it igonres any uknown opcodes.