Skip to content

Conversation

@szymonlesisz
Copy link
Contributor

@szymonlesisz szymonlesisz commented Aug 12, 2025

Description

We need to dynamically change bluetooth write params when we are sending big messages like for example FW update.
briefly explanation:

  • WriteWithoutResponse (default - fast) sends the message but doesnt guarantee the delivery, we dont know if bluetooth central (adapter) really send it and is it safe to send another chunk.
  • WriteWithResponse (slower) - sends the message and waits for delivery confirmation (ACK sent by bluetooth peripheral)

Those params behaves differently on each OS:

  • linux: WriteWithoutResponse works as expected and doesnt need any workaroud.
  • macos: WriteWithoutResponse sends the message immediately (~1ms) - after a while it keep loosing the packets when the OS buffer is full. Additionally i've fixed one bug in btleblug dependency - hopefully it will be merged soon.
  • windows: WriteWithoutResponse is also very fast and it is clogging the OS buffer (loosing packets) yet WriteWithResponse is deadly slow

To optimize FW update process we need custom approach.

  • for macos use WriteWithResponse on first 8 packets and then on each 16nth packet.
  • for windows WriteWithoutResponse but throttle it and use delay if sending speed it too fast

🔍🖥️ Suite web test results: View in Currents

🔍🖥️ Suite desktop test results: View in Currents

@szymonlesisz szymonlesisz added no-project This label is used to specify that PR doesn't need to be added to a project cherry-pick🍒 labels Aug 12, 2025
@szymonlesisz szymonlesisz force-pushed the feat/bt-write-without-response branch from 3202a10 to 5b3d4d1 Compare August 20, 2025 11:56
@trezor-bot
Copy link
Contributor

trezor-bot bot commented Aug 20, 2025

✅ Previously successful run of [Test] PR Suite Web e2e tests workflow has been found.
⏭️ Skipping tests for this run.
💡 If you are unsure about your latest changes, please rerun the workflow manually. (Use the Re-run all jobs option)

@trezor-bot
Copy link
Contributor

trezor-bot bot commented Aug 20, 2025

✅ Previously successful run of [Test] PR Suite Desktop e2e tests workflow has been found.
⏭️ Skipping tests for this run.
💡 If you are unsure about your latest changes, please rerun the workflow manually. (Use the Re-run all jobs option)

@szymonlesisz szymonlesisz merged commit 7ab12f3 into develop Aug 20, 2025
21 checks passed
@szymonlesisz szymonlesisz deleted the feat/bt-write-without-response branch August 20, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick🍒 no-project This label is used to specify that PR doesn't need to be added to a project

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants