Commit graph

1338 commits

Author SHA1 Message Date
bunnie
a7912b6296 fix a swap on pub/priv server to susres 2022-03-27 17:08:04 +08:00
bunnie
9555287273 remove a debug print 2022-03-27 17:07:48 +08:00
bunnie
ee4511c35d rework menu items and ordering
init for RTC shouldn't appear until keys are initialized and
PDDB has been mounted.
2022-03-27 16:45:22 +08:00
bunnie
2340686e80 rate limit error messages 2022-03-27 16:45:00 +08:00
bunnie
727135b347 throttle debug messages 2022-03-27 16:44:26 +08:00
bunnie
fc4a598a9b add a command to reset RTC after a PDDB format 2022-03-27 16:44:13 +08:00
bunnie
2751aa03d3 add a localtime server plus other annotations
std::time::SystemTime returns time in UTC.

That's great, but a lot of times we want local time.

Unfortunately, we can't use `chrono` to do that, because
chrono figures out what your time zone is usind `libc`, which
is a thing Xous doesn't have.

the `LocalTime` server is Xous' solution to that problem. it
returns the corret time offset based on the time zone.

You can still use `chrono` to convert the returned time into
strings and to compute durations.
2022-03-27 04:08:36 +08:00
bunnie
340cd89661 update status to use the new RTC functions for time
Time is replaced with error messages that indicate either time has not
been set ("Set Time"), or the PDDB has not been mounted (it says
"Login?"), if there is an error. otherwise it displays time
in the local timezone.

Time setting is kind of awful in that you have to enter the time
as UTC. And then a timezone as an offset in hours from UTC. It's
very bare-iron.
2022-03-27 04:06:42 +08:00
bunnie
107c63f7c2 update RTC functions to use libstd 2022-03-27 04:06:26 +08:00
bunnie
4b25be75d5 fix bcd/binary conversion problems 2022-03-27 03:00:50 +08:00
bunnie
1617200cb6 remove the RTC "reach-around" cheat inside shellchat's test routine
The test routine for shellchat "cheats" and accesses the I2C block
to test the RTC during factory operations. This is not aesthetic
and is also potentially a security hole since we don't want less
trusted stuff willy-nilly playing with i2c.

Rewrite to

1) remove i2c references from shellchat
2) replace RTC calls with the newer non-dangerous llio calls that are
limited to read out the initialized time variables.
2022-03-27 02:56:41 +08:00
bunnie
515d49db08 add a sync operation after every write
I did observe some PDDB corruption that happened today that looks
ostensibly linked to a record that didn't sync up with the disk,
so, let's be safer and sync everything. We can work on optimizing
performance after correctness is guaranteed.
2022-03-27 02:55:19 +08:00
bunnie
a103536b58 add a non-blocking mount poller to the PDDB
The problem with the current is_mounted() call is that it blocks
while the PDDB is requesting a password or actively formatting
(otherwise it doesn't block). It's actually just...partially blocking.

That doesn't cut it for libstd-linked system services that need to run but
before the PDDB comes up. In particular, we need to be able to respond
to time queries *somehow*, even before our timezone and offsets are
loaded from the PDDB.

I considered doing a callback mechanism for mounting, but this
is kind of complex and probably not worth it. Instead, a separate
thread that can return the value of a single boolean revealing
the mount state of the PDDB is created, and you can create an
object that's capable of inspecting that boolean.
2022-03-27 02:52:29 +08:00
bunnie
a6af300157 don't repeat the menu key if it is press-held 2022-03-27 00:19:55 +08:00
bunnie
96f0a0d2ea add the actual thread to the code base and clean up some warnings.
Next up:
 - code up libstd glue
 - code up test cases
2022-03-26 02:42:42 +08:00
bunnie
b59e2ae2bf add reference to the time server.
We still need to *start* the thread, ya know...
2022-03-26 02:37:30 +08:00
bunnie
4ac38027a2 add function to return the hardware RTC value as u64
the u64 in and of itself is meaningless, without the context
from the PDDB that adds the offset to wall clock time plus
time zone. This is glued together by the time.rs stub inside
the status service.
2022-03-26 02:36:35 +08:00
bunnie
df96ca1429 test for libstd Instant 2022-03-26 02:35:59 +08:00
bunnie
319e0e0641 add a comment about not modifying ticktimer APIs due to libstd dependency 2022-03-26 02:35:38 +08:00
bunnie
91d0511fa4 add Seek trait to the PDDB 2022-03-26 02:34:57 +08:00
bunnie
86ab8c392d add libstd time handler glue stubs 2022-03-26 02:34:38 +08:00
bunnie
0abd4a1db6 add a response code for dictionary not found 2022-03-25 23:50:26 +08:00
bunnie
cda15a1bb3 add a routine to convert hw RTC to a seconds count. 2022-03-24 18:44:06 +08:00
bunnie
92f1552d94 Merge branch 'main' into bunnie-dev 2022-03-24 03:32:36 +08:00
bunnie
0bcc93c78e attempt to add persistent storage to hosted mode PDDB
This will create a 100MiB file in tools/ppdb-images/hosted.bin
(sorry!!) which is persistent storage for hosted mode.

Delete the file if you want to start over from scratch.

It's...pretty brittle. I expect problems, but maybe it will at
least get things moving.
2022-03-24 03:21:00 +08:00
bunnie
bfb8a17cd5 strip out legacy RTC calls in preparation for refactor 2022-03-24 02:19:26 +08:00
bunnie
b4c98528e8 add notes around names that are baked into libstd 2022-03-22 22:30:43 +08:00
bunnie
b50dbf0a69 silence a warning in the loader module about an unused macro 2022-03-22 22:18:40 +08:00
bunnie
7c3601bd25 convert the connection manager to use the new PDDB blocking call 2022-03-22 22:18:31 +08:00
bunnie
36ea69f6df add a one-liner API call to block execution until PDDB is mounted 2022-03-22 22:18:23 +08:00
bunnie
2cc8a1b24a silence a warning in the loader module about an unused macro 2022-03-22 22:17:27 +08:00
bunnie
fe52756a3d convert the connection manager to use the new PDDB blocking call 2022-03-22 22:17:04 +08:00
bunnie
86e86df68c add a one-liner API call to block execution until PDDB is mounted 2022-03-22 22:16:46 +08:00
bunnie
5d59390554 Merge branch 'main' into bunnie-dev 2022-03-21 18:59:10 +08:00
Blake Smith
77b5e7a2bb During sleep, clear the rest of the screen, to avoid
any secrets being persistently visible on the display.
2022-03-20 15:35:02 -05:00
bunnie
342e721481 Merge remote-tracking branch 'origin/main' into bunnie-dev 2022-03-18 21:46:54 +08:00
Sean Cross
af2d7e9099 Merge branch 'main' of github.com:betrusted-io/xous-core 2022-03-18 20:47:49 +08:00
Sean Cross
d6063d9992 net: don't close connection when setting fields
Due to overly liberal use of `.take()`, file handles were getting closed
when doing ordinary operations. This stops that.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 20:47:10 +08:00
bunnie
140f07ddc8 latest revised test 2022-03-18 20:28:36 +08:00
bunnie
4463b909a1 initial cut at using libstd TcpStream for comms 2022-03-18 19:55:16 +08:00
bunnie
0425f3c9b7 Merge branch 'main' of github.com:betrusted-io/xous-core into main 2022-03-18 19:39:44 +08:00
bunnie
84086c6d47 quiet a warning from tts mode 2022-03-18 19:39:25 +08:00
bunnie
02ab71f195 quiet a warning from tts mode 2022-03-18 19:39:00 +08:00
Sean Cross
0b3fc8e98e net: add functions for setting ttl, nodelay
Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 18:43:39 +08:00
Sean Cross
08b9f0bcfc services: net: add StdTcpPeek call
This is used to peek on a stream

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 15:24:01 +08:00
Sean Cross
00e2f6f505 Merge branch 'main' of github.com:betrusted-io/xous-core 2022-03-18 12:09:29 +08:00
Sean Cross
9217c2227f services: net: add timeout to connect api
This now adds a `timeout` parameter to the connect() API call.
Additionally, connections will not be returned until they are determined
to be open, or until an error occurs (such as a timeout).

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 12:08:28 +08:00
bunnie
4044a1d2c1 unbreak hosted mode audio 2022-03-18 03:10:28 +08:00
Sean Cross
7ff40a3e42 Merge branch 'main' of github.com:betrusted-io/xous-core 2022-03-17 20:38:52 +08:00
Sean Cross
89442ff4cc net: add StdTcp calls
These calls have been tested to work to create tcp connections.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-17 20:38:21 +08:00