Commit graph

2452 commits

Author SHA1 Message Date
bunnie
2a0135c781 add bulk deletion of keys from a single dictionary 2023-01-30 22:14:59 +08:00
bunnie
ab90b0044e fix bug where old key data was not being zeroized on delete
on valid pages were being updated in a dictionary entry as
it is updated; actually, entries that are invalid should also
be zeroized, otheriwse they "Stick around" as valid entries.
2023-01-30 22:14:59 +08:00
bunnie
9903aacbad add fscb sync and pruning to the delete test bench 2023-01-30 22:14:59 +08:00
bunnie
d70eeb2453 fix bug in small pool re-packing after delete
the new offset address was being used for copying data, instead
of the old offset, which was causing key data to refer to
an incorrect entry after deletion
2023-01-30 22:14:59 +08:00
bunnie
bce6fb2836 improve debug output on PDDB 2023-01-30 22:14:59 +08:00
bunnie
624705d169 add timeout variant for USB Rx -- note: not tested!
turns out we didn't need this variant for things to work
with the new OpenSK stack.
2023-01-30 22:14:59 +08:00
bunnie
bc3aac677f fix zero-length key readback error in bulk reads
zero-length keys return a data section of None, instead
of Some(<empty vec>), as the latter representation deserializes
to a null pointer panic.
2023-01-30 22:14:59 +08:00
bunnie
5c454d4382 chore: fix typos 2023-01-30 22:14:58 +08:00
bunnie
e8acb62d6d fix missing corner case in cache refill 2023-01-30 22:14:58 +08:00
bunnie
82a7d0c40f fix some more edge cases in PDDB key deletion 2023-01-30 22:14:58 +08:00
bunnie
8350095d36 fix initialization order so that CI can run 2023-01-30 22:14:58 +08:00
bunnie
2ef7dfd488 add test case for pddb delete keys 2023-01-30 22:14:58 +08:00
bunnie
408cc69ad9 note that lock device also has a reboot aspect to it in the menu 2023-01-30 22:14:58 +08:00
bunnie
f2dcea0834 add a missing sync after key deletion 2023-01-30 22:14:58 +08:00
bunnie
dafec3c2eb chore: fix another typo 2023-01-30 22:14:58 +08:00
Patryk Laurent
afd1570bbc type chars rather than bytes 2023-01-30 22:14:57 +08:00
Patryk Laurent
9ad45b6f2c add pddb edit (types pddb write <k> <v>) 2023-01-30 22:14:57 +08:00
Sean Cross
dc4ca79834 services: pddb: use an enum for file types
Rather than hardcoding numbers, use an enum with the constant values.
This will make it easier to reason about what the constants mean.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-01-18 09:06:16 +08:00
bunnie
232a4b6c6c bump xous version 2023-01-18 00:02:46 +08:00
bunnie
8b5dfca749 chore: trim some unused comment-code that I forgot to clean before 2023-01-15 14:24:23 +08:00
Gianguido Sorà
b2494e92fc
usb-device-xous: don't set device-wide class on mass-storage
Setting it to zero (default if not set) makes mass-storage work under
macOS.
2023-01-14 18:53:48 +01:00
bunnie
c0d442f275 refactor reset() routine to be more comprehensive
The original implementation didn't keep around some key data,
so we had to read the old version of the record and update parameters
assuming that the USB descriptors didn't change too much.

Unfortunately with the mass storage option, the description can
change quite a bit, so we have to reconsitute it from scratch.
Basically, we re-do the `alloc()` call in the reset routine,
playing it reverse so that we setup all the higher-number
endpoints before doing ep0 last.

This hopefully fixes a stability issue for usb hid mode when
mass storage is enabled as a build option.
2023-01-15 01:00:53 +08:00
bunnie
af4b394e7d minor edit - make mass storage explicit in match option 2023-01-15 01:00:41 +08:00
bunnie
ee81c70018 refactor multi-view support
- use new SpinalUsbDevice::new() interface instead of cloning
- put the blank "key-up" event on keyboard events after the
core is switched to, instead of at boot.
- add some more appropriate debug statements to help track
view switching in debug logs
2023-01-14 19:10:21 +08:00
bunnie
df1b9d9f8d refactor SpinalUsbDevice new method
Instead of making it once and then cloning it (which is a bit
unclear what's going on), make it so that the shared memory
ranges are allocated in the caller's scope, and then create
the structure "clean".

Also add a static AtomicBool to track interrupt init state,
since that can be only called once.
2023-01-14 19:08:51 +08:00
bunnie
b13671b3bb add some debug output on asserts 2023-01-14 19:08:32 +08:00
bunnie
f5a45bc017 cleanup some edge cases in handling poll events, suspend/resume
also fixes allocation ordering for EPs
2023-01-14 02:33:16 +08:00
bunnie
0aae50fa82
Merge pull request #288 from plaurent/feat/shellchat-subcommand-pddb-copy
A "copy" subcommand for shellchat pddb
2023-01-14 00:31:37 +08:00
bunnie
26a3adcc01 integrate "chain" fully; use "chain" feature only for bulk endpoints
bulk endpoints have a different behavior now than interrupt
endpoints; bulk endpoints have chained descriptors so that the
hardware automatically responds to multiple USB packets quickly.

interrupt endpoints also have subtly different way of handling
data readiness, which is incompatible with the block device layer
as implemented.
2023-01-14 00:09:16 +08:00
bunnie
02cd24e799 fix mass-storage feature missing in shellchat 2023-01-14 00:08:30 +08:00
bunnie
26f12990f1 change default disk size to 256kiB, mostly to economize on RAM
since we don't have a clear use case for this yet and it's just
for testing on bleeding-edge, make a very small disk just so it's
easier for people to do testing, but not so big that it's a burden
on the system.

later on we can make this dynamically sizeable/allocateable only
e.g., only when the disk is required
2023-01-14 00:07:11 +08:00
Patryk Laurent
0cd2010780 use closure/return to avoid deep indents 2023-01-12 21:12:56 -08:00
bunnie
c631963a4b Merge branch 'feat/usb-mass-storage' of github.com:gsora/xous-core into gsora-feat/usb-mass-storage 2023-01-13 02:59:17 +08:00
Patryk Laurent
fb5811ddc8 use MAIN_SEPARATOR instead of hardcoded ':' 2023-01-12 07:20:43 -08:00
bunnie
bebf323798 some touch-up/cleanup; add a timeout on a blocking read 2023-01-12 01:45:51 +08:00
bunnie
cd62caadcd fix paths and README 2023-01-12 01:13:21 +08:00
bunnie
ed23cdcc17 move crates to the libs/mass-storage directory 2023-01-12 01:12:56 +08:00
bunnie
88cdde4b9a remove unused files 2023-01-12 01:04:12 +08:00
bunnie
54467a75fc gate mass-storage behind a feature that is currently default off 2023-01-12 00:58:48 +08:00
bunnie
55b940fe74 tiny bit of cleanup & docs 2023-01-11 04:09:13 +08:00
bunnie
1f3c16aea8 add ReadFormatCapacities
this is required by Windows for the driver to work.
2023-01-11 03:55:04 +08:00
bunnie
93e3bc29b3 usb disk now working well without debugging messages 2023-01-11 02:00:32 +08:00
bunnie
d592bab121 head pointer offset is the most reliable way to determine transaction in progress
before we were looking at the amount of data transferred and
seeing if it matches the expected amount

I just realized that we can just look at the descriptor pointer in
the status region; if it is non-zero, then the descriptor set
is "live" and needs to be filled.

if it's zero, then a packet came in.

use this to fix the wait conditions for accepting new commands.
2023-01-11 01:59:13 +08:00
bunnie
f0d1c65c2a repair the minimal config for faster USB debugging 2023-01-11 01:58:15 +08:00
bunnie
921199b429 a cleaner version that works 2023-01-10 14:44:52 +08:00
bunnie
3355f3b5f4 writes now working, barely. 2023-01-10 05:21:11 +08:00
bunnie
5c1518cee6 block reads work. 2023-01-09 19:04:47 +08:00
bunnie
3d826ffbbe add bulk response chaining
IN descriptors now chain up to 512 bytes long

OUT descriptors still need to be worked up

However, there is an issue where the system is injecting the
ZLP/CSW immediately after the bulk response is queued up, and this
is getting sent before the bulk data is issued. Need to figure out
this race condition.
2023-01-09 04:14:59 +08:00
bunnie
10e605569f reduce InquiryResponse record 2023-01-07 00:22:26 +08:00
bunnie
41d4837551 bump versions to absorb WDT change 2023-01-06 17:48:12 +08:00