Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Minaylov <nm29719@gmail.com>2022-02-14 13:29:30 +0300
committerGitHub <noreply@github.com>2022-02-14 13:29:30 +0300
commitbe500993a313511139d23c8eb8cb40944c2ca70a (patch)
treef2d899538a0921d194609584038c05c1b7361ef8 /firmware
parent939998a8c81de2e981274491676b050aa6f8f489 (diff)
[FL-2219] VCP: fix Tx data freeze on sending 64 bytes packets #992
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/targets/f6/furi_hal/furi_hal_vcp.c13
-rw-r--r--firmware/targets/f7/furi_hal/furi_hal_vcp.c13
2 files changed, 22 insertions, 4 deletions
diff --git a/firmware/targets/f6/furi_hal/furi_hal_vcp.c b/firmware/targets/f6/furi_hal/furi_hal_vcp.c
index b09cc49a..4ac59ae3 100644
--- a/firmware/targets/f6/furi_hal/furi_hal_vcp.c
+++ b/firmware/targets/f6/furi_hal/furi_hal_vcp.c
@@ -77,6 +77,7 @@ static int32_t vcp_worker(void* context) {
bool enabled = true;
bool tx_idle = false;
size_t missed_rx = 0;
+ uint8_t last_tx_pkt_len = 0;
furi_hal_cdc_set_callbacks(VCP_IF_NUM, &cdc_cb, NULL);
@@ -184,8 +185,16 @@ static int32_t vcp_worker(void* context) {
if(len > 0) { // Some data left in Tx buffer. Sending it now
tx_idle = false;
furi_hal_cdc_send(VCP_IF_NUM, vcp->data_buffer, len);
- } else { // There is nothing to send. Set flag to start next transfer instantly
- tx_idle = true;
+ last_tx_pkt_len = len;
+ } else { // There is nothing to send.
+ if(last_tx_pkt_len == 64) {
+ // Send extra zero-length packet if last packet len is 64 to indicate transfer end
+ furi_hal_cdc_send(VCP_IF_NUM, NULL, 0);
+ } else {
+ // Set flag to start next transfer instantly
+ tx_idle = true;
+ }
+ last_tx_pkt_len = 0;
}
}
}
diff --git a/firmware/targets/f7/furi_hal/furi_hal_vcp.c b/firmware/targets/f7/furi_hal/furi_hal_vcp.c
index b09cc49a..4ac59ae3 100644
--- a/firmware/targets/f7/furi_hal/furi_hal_vcp.c
+++ b/firmware/targets/f7/furi_hal/furi_hal_vcp.c
@@ -77,6 +77,7 @@ static int32_t vcp_worker(void* context) {
bool enabled = true;
bool tx_idle = false;
size_t missed_rx = 0;
+ uint8_t last_tx_pkt_len = 0;
furi_hal_cdc_set_callbacks(VCP_IF_NUM, &cdc_cb, NULL);
@@ -184,8 +185,16 @@ static int32_t vcp_worker(void* context) {
if(len > 0) { // Some data left in Tx buffer. Sending it now
tx_idle = false;
furi_hal_cdc_send(VCP_IF_NUM, vcp->data_buffer, len);
- } else { // There is nothing to send. Set flag to start next transfer instantly
- tx_idle = true;
+ last_tx_pkt_len = len;
+ } else { // There is nothing to send.
+ if(last_tx_pkt_len == 64) {
+ // Send extra zero-length packet if last packet len is 64 to indicate transfer end
+ furi_hal_cdc_send(VCP_IF_NUM, NULL, 0);
+ } else {
+ // Set flag to start next transfer instantly
+ tx_idle = true;
+ }
+ last_tx_pkt_len = 0;
}
}
}