mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-20 16:12:38 +00:00
Update USB lifecycle fixtures for stream mode and host deadlines
This commit is contained in:
@@ -100,6 +100,7 @@ static std::atomic<bool> usb_logging_preference_known{false};
|
||||
static bool enabled = false, dedicated_usb_logging_port_started = false;
|
||||
static bool dedicated_usb_logging_port_configured = false;
|
||||
static bool isUsbLoggingEnabled() { return enabled; }
|
||||
static bool isUsbLoggingPacketStream() { return false; }
|
||||
static bool isUsbDebugLoggingEnabled() { return false; }
|
||||
static void setPlatformDebugOutputEnabled(bool) {}
|
||||
struct Port {
|
||||
@@ -257,6 +258,8 @@ struct Device {
|
||||
} TinyUSBDevice;
|
||||
namespace mesh {
|
||||
static void clearUsbLoggingClientActivity() {}
|
||||
static bool isUsbLoggingPacketStream() { return false; }
|
||||
@DEDICATED@
|
||||
@GATES@
|
||||
static std::atomic<bool> dedicated_usb_logging_port_connected{true};
|
||||
static std::atomic<uint32_t> dedicated_usb_logging_reset_generation{0};
|
||||
@@ -302,6 +305,7 @@ int main() {
|
||||
}
|
||||
'''
|
||||
source = source.replace("@GATES@", gates)
|
||||
source = source.replace("@DEDICATED@", function("bool hasDedicatedUsbLoggingPort("))
|
||||
source = source.replace("@RESTART@", function("static void restartDedicatedUsbLoggingHostSession()"))
|
||||
source = source.replace("@COMPLETE@", function("static void completePrimaryUsbSessionReset("))
|
||||
self.run_native(source)
|
||||
|
||||
@@ -664,8 +664,9 @@ class Nrf52UsbLoggingContractTest(unittest.TestCase):
|
||||
self.assertEqual(source.count("finishPendingRequest(result, tag, est_timeout);"), 6)
|
||||
delayed = (ROOT / "src/helpers/CompanionDelayedReplies.cpp").read_text()
|
||||
arm = extract_braced(delayed, "void CompanionDelayedReplies::arm(")
|
||||
self.assertIn("timeout + timeout / 5", arm)
|
||||
self.assertIn("reply.radio_deadline = now + budget;", arm)
|
||||
# Exact timeout windows and delayed SENT admission are exercised by
|
||||
# test_companion_delayed_reply_delivery.py against real callbacks.
|
||||
self.assertIn("radioBudget(reply)", arm)
|
||||
self.assertIn("reply.sent_deadline = now + DELIVERY_GRACE_MS;", arm)
|
||||
self.assertIn("servicePendingSerialReply();", source)
|
||||
self.assertIn(
|
||||
|
||||
Reference in New Issue
Block a user