Update USB lifecycle fixtures for stream mode and host deadlines

This commit is contained in:
mikecarper
2026-10-04 14:39:38 -07:00
parent 0cc561b0d8
commit b9ba35f9d7
2 changed files with 7 additions and 2 deletions
+4
View File
@@ -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)
+3 -2
View File
@@ -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(