summaryrefslogtreecommitdiffstats
path: root/uisimulator/common/sim_tasks.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-05-22 14:45:17 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-05-22 15:34:42 +0100
commit85232fadbb1fa02f6abeee7bf28ac6e286c45a24 (patch)
treee21cf4719d4564f3ed1447d29f133de5a470673c /uisimulator/common/sim_tasks.c
parent5ee9a451266b0b8616435319f43e874932d2a237 (diff)
downloadrockbox-85232fadbb1fa02f6abeee7bf28ac6e286c45a24.tar.gz
rockbox-85232fadbb1fa02f6abeee7bf28ac6e286c45a24.zip
simulator: fix off by one error in USB ack calculations
The sim's printout of the number of expected USB acks was off by one. Since the sim queue is not registered for broadcasts, it will not receive an ack message and does not need to account for itself when determining the number of acks to expect, unlike the USB code. Change-Id: I6715039c05c1ea95099716c5251d401e37f5b085
Diffstat (limited to 'uisimulator/common/sim_tasks.c')
-rw-r--r--uisimulator/common/sim_tasks.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/uisimulator/common/sim_tasks.c b/uisimulator/common/sim_tasks.c
index 8c1f193080..c53b9990fd 100644
--- a/uisimulator/common/sim_tasks.c
+++ b/uisimulator/common/sim_tasks.c
@@ -92,7 +92,9 @@ void sim_thread(void)
last_broadcast_tick = current_tick;
}
- num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0) - 1;
+ /* NOTE: Unlike the USB code, we do not subtract one here
+ * because the sim_queue is not registered for broadcasts! */
+ num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0);
DEBUGF("USB inserted. Waiting for %d acks...\n",
num_acks_to_expect);
break;