Commit graph

256 commits

Author SHA1 Message Date
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
5cad1a3bcf more xous_ipc cleanup 2024-09-23 00:03:49 +08:00
bunnie
6d7a8fdc09 regex search/replace instances of xous_ipc::String to String
split into multiple commits for easier committing
2024-09-22 14:16:36 +08:00
bunnie
fb68eb9dd2 cleanup datetime API deprecation warnings 2024-02-08 13:46:24 +08:00
bunnie
bf15d7c803
Merge branch 'main' into refactor-sha2 2024-02-01 01:46:31 +08:00
bunnie
0c7be94c22 re-introduce "wait for hardware" hashes for "big hashes" 2024-02-01 00:52:21 +08:00
bunnie
f7bcbbf2d0 add FIXME note so we can find this spot later 2024-01-31 04:05:33 +08:00
bunnie
eb28893128 upgrade ecup to sha 0.10 api 2024-01-31 03:52:02 +08:00
bunnie
f162555ac3 register a listener for U2F events plugged into autobacklight
this should cause the backlight to turn on anytime there is
an incoming U2F packet, allowing a user to read the screen
and see what they are trying to allow for authentication even
in a dark room.
2024-01-29 23:15:34 +08:00
bunnie
d7f94575fc format services/status
it did some things i hated, some things i liked. I'll take it.
2024-01-14 22:44:28 +08:00
bunnie
9ab66eea80 change error message that's more of a warning 2023-12-07 02:15:05 +08:00
bunnie
6c39534a7b mark the EC as ready at the conclusion of all update activity
by marking the EC as ready after all the update checks are done
we can ensure that the PDDB mount dialog does not attempt to come
up during an EC update.
2023-12-07 01:30:33 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
bunnie
1434764f08 Support open wifi networks
Mods to allow the EC to support open wifi networks. Requires an
update to the EC as well as Xous for this to function.

Before filing an issue, please check that EC version is v0.9.13-5-g8f7e23f
or greater by running `ver ec` inside shellchat.
2023-07-15 21:03:42 +08:00
bunnie
ee5168254e fix #396 2023-07-06 00:20:43 +08:00
bunnie
b2c64eb61a aesthetic cleanup; change default font for all modals
I decided to go back on the idea of not changing the modals
and now all modals use the new larger font as well.

This creates issue #396, which I will deal with later once
I have the time to do some more testing. I'm pretty sure
some other dialog boxes are broken now too.
2023-07-05 15:13:38 +08:00
Jean-Pierre De Jesus DIAZ
2af737b57e
xous-rs: move LANG variable to locales
This change is made with the intention of making the xous-rs crate a bit
more freestanding without depending on the xtask build system.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-15 18:23:12 +02:00
bunnie
0b32ac073b add scan state information to ssid scans
ssid scans can now be in-progress, and they also record
the time elapsed since the last scan was performed.

this allows the network manager to be a bit smarter about when
it decides to kick off a scan.

the ssid scan dialog box is also updated to show
the scan results in progress. This addresses #336.
2023-05-29 02:12:28 +08:00
bunnie
d3dfe9fdde add option to lock device on autosleep. 2023-05-22 15:44:46 +08:00
bunnie
6f9febccf6 this resolves #383
Adds a menu item (defaults to 0 or off) for autosleep timeout in
minutes.

Once the autosleep timeout is hit, the system tries to suspend.

- It will not try to sleep if the system is plugged in.
- It will reset the timer if the power state changes (plug/unplug).
- It will reset the timer every time a key is pressed.
- The timer is reset on suspend, so it does not try to immedaitely re-sleep on wake.

The autosleep handler is domiciled in the "pump" loop which is
responsible for updating the uptime timestamp in the status bar.
It is pinged at a 1 second interval.

Therefore, the sleep timeout has a +/-1 second variability in it,
and also, a quick plug-unplug event (< 1 second) will likely go
unnoticed.
2023-05-22 02:32:13 +08:00
bunnie
2dc3d19bf1 add autounmount, autosleep handlers in preferences
but autounmount is just a placeholder
2023-05-22 02:31:50 +08:00
bunnie
fe646f52c1 fix #382
this should fix the issue on #382. The behavior is now:

*device not plugged in*

1. select "Lock device (reboot)"
2. device reboots
3. device goes to sleep
4. user wakes up the device
5. user is challenged with the unlock PIN

*device is plugged in*

1. select "Lock device (reboot)"
2. device reboots
3. user is challenged with the unlock PIN

I think this should be the "least surprising" outcome given
the description of the menu item.
2023-05-21 18:25:27 +08:00
bunnie
c7a0057685
Merge pull request #370 from gsora/gsora/sleep-on-lock
Sleep device on lock
2023-05-03 22:53:18 +08:00
Jean-Pierre De Jesus DIAZ
3e2eb63663
imports: remove com_rs-ref
The crate just re-exports the com_rs crate. This patch changes usages of
com_rs-ref to use com_rs directly.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-05-02 14:33:17 +02:00
Gianguido Sorà
42bc425ca9 reformat early_settings interactions so that it only writes if data is actually changed
also abstract get/set off the early settings FLASH section, easier to maintain

still todo: make hosted mode work again
2023-05-01 18:25:12 +02:00
Gianguido Sorà
6abf497ac9
services/status: if early sleep flag is present, sleep immediately
This flag is only set if the user selects "Lock (reboot)".

This way, the device sleeps immediately after boot, and makes easier turning it on and off in a safe manner.
2023-04-21 18:12:36 +02:00
bunnie
2d1073faf0 add retry loop to EC version checking
sometimes it can take a bit longer for the EC to respond to
version requests. Instead of hard coding a timeout and check
poll the EC over a longer period, which leads to a system more
tolerant of the variations in startup times.
2023-04-09 14:22:54 +08:00
bunnie
db8348292f add force EC update to the non-initialized menu options
also bump release notes
2023-04-08 16:40:40 +08:00
bunnie
430d3550b7 move time services into the DNS crate
Time services are moved into the DNS crate so that the EC
update thread can remain running and consuming resources.

The problem is that we are out of connections in the connection table
(it's limited to 32 total), and in order to allow a "force update"
function for the EC we need to hold on to more connections than
are possible.

The "time" service is fairly self contained and could be moved
elsewhere. It sort of logically fit in the status crate initially
because the status crate manages preferences and displays the
current time on the screen, but it's modular enough that we could
put the service in any process space, at a minor trade-off of
the time UX function being public. This was avoided for a long
time because it could be a security risk but in the end the records
that store time zone and offsets are in the PDDB, which are accessible
to anyone who knows the names of these records, which is in the end
equivalent to knowing the name of the time UX server.

Thus the time UX server was made a dynamically registered "public"
server with just one connection (so only a minor downgrade in security,
the only vector exists in between boot and when the time servers
connect up), and the time server itself was slotted into the DNS
server's process space.

The DNS server was chosen because the DNS service itself is
very lightweight and will be unlikely to grow any heavier, so there
is little risk in merging the time service into the DNS crate's
process connection allocation.
2023-04-08 00:30:07 +08:00
bunnie
f8913ac944 initial steps toward #335
adds the menu item and handler for a force update
revises some of the wording of the menus so they are more
self-consistent

leaves the EC update handler thread running permanently so
that force updates can be caught and handled
2023-04-07 16:22:22 +08:00
bunnie
f4fabc3f8e fix #337
Adds MAC display to preference dialog box

also offer both hex and decimal formatting outputs on wlan status
2023-03-24 23:07:29 +08:00
bunnie
e479de4e02 make time errors print the full RTC value set
this is necessary to debug more I2C weirdnesses.
2023-03-24 01:29:24 +08:00
bunnie
e32a22655b add a sanity check on the reported EC version 2023-03-23 03:17:05 +08:00
bunnie
fb3dabbd5d fix #326
- add some ux lag
- checks link integrity

previous commit also revises message on precursorupdater
per @nworbnhoj's comments.
2023-03-09 04:45:26 +08:00
bunnie
aea9b95506 skip checking any ec update image that reports a length beyond our slice bounds 2023-02-26 01:22:53 +08:00
bunnie
9140beef24 clear some warnings in hosted mode 2023-02-01 15:01:19 +08:00
bunnie
a4c97a410c handle time panics more gracefully; work around RTC HW issues
- don't hard panic if the time seems wrong; just clear
the PDDB entries, and move on. This at least allows the
user to intervene to fix the time, intsead of insta-crashing
when anything seems wrong and depriving users an opportunity
to fix anything

- fix HW derpiness by introducing some dummy reads during
the resetting of the hardware process.

One thing I wanted to do was to have the RTC always powered
off of the battery. This is not a default mode but it's an
option. In theory, this is a more efficient because anyways,
VDD comes from VBAT, right? However, the RTC hardware gets
a little side-eye when VBAT is higher than VDD most of the
time and reports a strange error code. The power savings
is miniscule -- some tens of nanowatts -- so I'm not going
to fight with the RTC hardware quirks anymore.
2023-02-01 03:19:32 +08:00
bunnie
f860f7bb33 add a mutex guard around I2C transactions
Individual I2C register reads and writes, even if to multiple bytes,
are atomic.

However, some i2c operations require multiple reads and writes
to be strung together without interruption for them to be valid.
A "mutex" is added, which if a program using I2C calls it prior
to their I2C operation, it will block if another program is
already using the I2C block for an uninterruptable series of
operations. The caller will automatically be unblocked once
the untinterruptable transactionts are completed.

Note that this is a collaborative exercise, a caller can still
try to initiate an I2C operation without getting a mutex first,
in which case it could interrupt another block that is doing something
uninterruptable. At the moment this merely generates a warning on
the console, but eventually, this will become a panic.
2023-01-31 18:22:10 +08:00
bunnie
b18230def4 move pddb dependencies to a feature flag for testing purposes 2023-01-31 02:34:12 +08:00
bunnie
2f30e1b50a implement #269 2022-12-29 00:11:03 +08:00
bunnie
e422740d37 chore: last one. really. 2022-12-13 23:03:50 +08:00
bunnie
1d94968b2f chore: fix typos 2022-12-13 22:36:47 +08:00
bunnie
bd230f5bb0 fix text to speech mode preferences setting
never allow the audio system to be turned off for blind people,
and disallow 0-volume setting as well.
2022-12-12 16:51:27 +08:00
bunnie
80ce119c95 fix RSSI calculations 2022-12-12 15:31:06 +08:00
bunnie
edf24d9fc2 clean up on the wifi signal bars 2022-12-12 14:11:19 +08:00
bunnie
eb17edc4ec
Merge pull request #283 from gsora/feat/wifi-signal-bars
feat: wifi signal bar
2022-12-12 11:47:18 +08:00
bunnie
9a580070a3 revert threaded init question now that deface issue is fixed 2022-12-11 17:50:51 +08:00
bunnie
6138b65d76 update comments to reflect changes in CI infra 2022-12-10 23:44:18 +08:00
bunnie
1f89843122 defer init root keys question until status thread starts
also defer the preference thread from loading until after the
PDDB mount thread is started -- doesn't make sense to start it
any earlier than that, since it depends on the PDDB being mounted.
2022-12-09 12:38:53 +08:00
bunnie
dd82b7f32a add no-codec mode to status
this is for DVT builds where the codec isn't supported, needed
for efuse testing
2022-12-08 17:14:21 +08:00