Commit graph

3126 commits

Author SHA1 Message Date
bunnie
a468733ea6 Merge branch 'automation' into bunnie-dev 2022-05-24 16:58:55 +08:00
bunnie
6e61405609 update release notes 2022-05-24 16:58:21 +08:00
bunnie
5815eae023 restore the security check around recalculatesleep 2022-05-24 16:28:16 +08:00
bunnie
bdc43a5190 Merge branch 'bunnie-dev' into main 2022-05-24 16:18:50 +08:00
bunnie
4d1d132233 add a first-pass at what hardware CI automation strings might look like 2022-05-24 02:22:36 +08:00
bunnie
8221f92d95 potential fix for #162
see issue for discussion
2022-05-23 17:30:02 +08:00
bunnie
d6d5c89746 add facility to help debug stalled suspend/resume 2022-05-23 13:50:52 +08:00
bunnie
058e3480df add facility to help debug stalled suspend/resume 2022-05-23 13:50:40 +08:00
bunnie
424f8feab7 advance timer state by +1 ms on suspend to avoid double-interrupts on resume
Issue #159 may be caused by queueing a connection to respond to when
the timer expires, but if the timer expires twice then it tries to
respond to a null connection id.

And if it goes to suspend in the same millisecond as it services the
condvar, then it'll reissue the interrupt when it comes back from
suspend.
2022-05-23 13:50:30 +08:00
bunnie
ed16fc1b2f advance timer state by +1 ms on suspend to avoid double-interrupts on resume
Issue #159 may be caused by queueing a connection to respond to when
the timer expires, but if the timer expires twice then it tries to
respond to a null connection id.

And if it goes to suspend in the same millisecond as it services the
condvar, then it'll reissue the interrupt when it comes back from
suspend.
2022-05-21 01:34:35 +08:00
bunnie
3bfdc238a0 add support for keymaps in HID
remaps keys based on the assumed keymap based on the user's
preference for the keyboard layout on the device.

So far, only dvorak and QWERTY are supported.
2022-05-17 16:41:08 +08:00
bunnie
7112b6a15f add a script to help extract keyboard mappings for unknown keyboards
use `usb kbdtest` to output a mapping assuming US-101 maps
it will then derive an appropriate keymap based on that mapping

doesn't support non-ascii characters (yet)
2022-05-17 16:39:48 +08:00
bunnie
4cba739a81 remove improper warning message
this was a vestige of an earlier version that should have been
removed
2022-05-17 03:13:19 +08:00
bunnie
b69fbfdd01 adjust keyboard emulation delays for better compatibility 2022-05-17 03:08:08 +08:00
bunnie
4a23cf671d fix hosted mode MAC address 2022-05-17 03:07:56 +08:00
bunnie
ca275308ef Merge branch 'usbdev' into main 2022-05-17 02:31:10 +08:00
bunnie
03a191d182 adjust IP targets on helper scripts 2022-05-17 02:27:04 +08:00
bunnie
ec53be0ac7 add USB device checkup functions and fix hosted mode 2022-05-17 02:26:28 +08:00
bunnie
66e4d9f803 move test commands for USB status checkup from keys to USB 2022-05-17 02:25:59 +08:00
bunnie
c7f9688b5f have status point to the USB crate for USB checkup 2022-05-17 02:25:44 +08:00
bunnie
78611f97c4 remove USB checkup functions from LLIO crate 2022-05-17 02:25:28 +08:00
bunnie
346caad315 Add the usb-device-xous driver to the default hardware config
Also includes the USB test commands in shellchat.

This is different from the usb-test crate, in that it's fully
integrated into Xous. usb-test is just for quick-testing the USB
driver, in the absence of most of the rest of Xous.
2022-05-17 00:46:52 +08:00
bunnie
3f779d5def tweak delays for more consistent key down reporting 2022-05-16 21:43:24 +08:00
bunnie
71f5183766 working USB development demo (HID keyboard emulation) 2022-05-16 21:26:37 +08:00
bunnie
ffbfa1dc3f wooooo i spy with my little eye an emulated HID keyboard 2022-05-16 13:15:21 +08:00
bunnie
2b57fa559d use Cargo patches so we can target our branch of usb-device
we have to add a patch to usb-device because the SpinalHDL UDC
needs a little extra handholding on EP0 to switch IN and OUT modes
(vs e.g. STM32 where EP0 has IN and OUT descriptors).
2022-05-16 03:09:28 +08:00
bunnie
874c4d41ff well, it's enumerating. now what? 2022-05-16 02:49:23 +08:00
bunnie
45c4d6320c bug fixes for SpinalHDL core (EP0 setups now go to the correct location) 2022-05-16 00:34:42 +08:00
bunnie
77038737b2 just before attempting to use IN to linked list trick 2022-05-16 00:34:14 +08:00
bunnie
26739472af this requires an adjustment to the SoC, but now we're seeing half the setup
a small bug was found in the device core that is now fixed. the
device core was not computing the target for the SETUP transaction
correctly if the HEAD of the OUT descriptor was set in advance of
the SETUP transaction. we now see much more consistent SETUP
transactions, and even the first IN response.

the next challenge is figuring out why the second IN response doesn't
seem to be issued.
2022-05-15 14:11:14 +08:00
bunnie
8c39b64126 getting closer...
we're now two packets into the setup.

i think i see one fundamental mismatch between how the driver
behaves and how the hardware runs. it has to do with where the
ep0 data gets deposited for a SETUP or OUT transaction --
the HEAD of the list can't be allocated the transaction is
completely ready to go.

will bang on this more tomorrow, but this is progress at least.
2022-05-15 02:16:24 +08:00
bunnie
bd1cc10678 refactor code base after a slightly better understanding of the USB core
still one mystery remaining, howcome setup packets don't "stick"
the first time around...
2022-05-14 23:53:10 +08:00
bunnie
4f36027974
Merge pull request #157 from gsora/gsora/modals-time-crash-fix
fix: clamp TextEntryPayloads content slice to the real amount of fields used in the modal
2022-05-14 02:59:34 -07:00
Gianguido Sorà
dbff05d1f2 fix: clamp TextEntryPayloads content slice to the real amount of fields used in the modal 2022-05-14 11:49:15 +02:00
bunnie
0dadc32716 fix interrupts, direction
interrupts seem to behave much more like i think they should.
i think the interrupt unit on the spinalHDL block is not made to
have the whole set enabled/disabled frequently, it just wants
to have the bits banged to clear the interrupts. enabling and
disabling interrupts as a whole causes some erratic operations.
NB: the reference linux driver only enables them once and never
turns them off.

also, realized just now that OUT is from the direction of the host.
so OUT on the device is incoming data. oops.

things are moving in the right direction, i'm seeing the next
IN packet being issued by the USB driver on the precursor
side, but it's not being sent by the hardware. yet.
2022-05-13 23:44:15 +08:00
bunnie
9a11056340
Merge pull request #154 from NicolasDorier/patch-1
Fix link in repl demo
2022-05-13 00:18:22 -07:00
bunnie
e9b627cab8 update release notes, clean up Cargo.toml, smoltcp to 0.8.1
smoltcp gave us a patch for our smoltcp issues! thank you @dirbaio!
2022-05-13 15:09:45 +08:00
bunnie
3664331b2f update release notes 2022-05-13 14:53:23 +08:00
bunnie
4ec84bf4dc implement deferred close on drop for TcpStream
streams are not closed until the txbuffer is empty
2022-05-13 14:51:07 +08:00
bunnie
6f1597b1e7 make "fountain" test optionally terminate
any characters typed as an argument after "fountain" will cause
it to terminate in 10 iterations
2022-05-13 14:50:29 +08:00
bunnie
b470588285 oops, fix a compile error. also try adding a flush()...this only made things worse?? 2022-05-13 02:25:35 +08:00
bunnie
56f9c654c0 debugging of TcpStream Drop dropping too fast
so far only able to confirm the problem happens, no effective
fixes yet.
2022-05-13 02:19:10 +08:00
bunnie
17e9a210ef add maintenanence notes referring to relevant smoltcp issues 2022-05-13 01:21:41 +08:00
bunnie
77e56a5a6e add notes about smoltcp integration 2022-05-13 01:17:25 +08:00
bunnie
c17219b6fe add icmpv4 fixes
a lot of debug spew is also enabled in this commit, intentionally,
because the next thing to chase out is the failure of TcpStream
on Drop.
2022-05-13 00:30:12 +08:00
bunnie
bac650808d force all UDP packets to respond on the local IP address
smoltcp is written to allow multiple adapters, so 0.0.0.0 as
the binding for UDP is illegal. However, in Rust, it seems that
0.0.0.0 is "totally fine" and most OSes will resolve this to
a "default" adapter.

this patch introduces the behavior of taking 0.0.0.0 and mapping
it to a default adapter. In fact, we only allow binding to the
default adapter. The reasoning behind this is that if our IP
address changes, we would expect that 0.0.0.0 resolves to that.

Where this scheme fails is if someone binds to 127.0.0.1 expecting
it to not respond to packets coming in from the outside, e.g.
they are using UDP as a loopback interface. I think this isn't
a common use case for Xous, but if it does become one I suppose
we could add a code path to also check for the 127.0.0.1 case
and try to handle it...
2022-05-12 22:26:38 +08:00
bunnie
94cbbddaa6 refactor follow-up scheduling vs smoltcp stack
smoltcp requires some polling to be done in the future for it
to work with low latency. It returns a time in the future for
the next poll.

This refactors the polling algorithm to:

1. use a fixed thread pool. This burns a little extra memory in
exchange for not having to allocate/de-allocate threads every
time a follow-up is needed.

2. use a short/long scheduler, where short delays (shorter than
the scheduler quantum) are grouped together, and only a single
follow-up is fired off within that time range if needed. Longer
delays have a larger window (roughly +/- 100ms) of grouping,
so fewer such events are also required in the distant future.

Empirically the delays seem to fall into two groups, either "short"
(less than 20ms) or "long" (around 700ms).

This improved scheduler uses fewer threads and generates less
messages, so instead of 16 threads and encountering exhaustion
we have 9 and have yet to see more than 7 used even under the
most strenuous tests (multiple while-true curl loops + fountain
test + ping simultaneously).

Some helpful debug is also printed now when scheduler runs out
of slots, so we can see the distribution of pending delays.
2022-05-12 17:49:27 +08:00
bunnie
0aa2f21f0b make scheduler quantum a visible parameter, and adjust to 10ms down from 20ms 2022-05-12 17:49:03 +08:00
bunnie
caf91e18ca fix net reset
we no longer create a new interface on net reset, which means that
the socket handles don't blow up if we change IP addresses.
However, the ARP cache is still stale and there seems to be on way
to force it to flush....but I guess in theory, eventually it
should fix itself, if smoltcp is working correctly?
2022-05-12 10:34:19 +08:00
bunnie
cc7e7f97c7 update smoltcp to 0.8.0
the refactor changes the way sockets are handled, so now, when
the interface is rebound we are certain to get panics.

working on resolving this detail now, but at least the interface
is working now and it seems more stable than before.
2022-05-12 09:27:51 +08:00