Skip to content

Comments

Modern Ubuntu and connectivity issues with scratch#46

Open
fpuga wants to merge 3 commits intokawasaki:masterfrom
fpuga:modern-ubuntu-python
Open

Modern Ubuntu and connectivity issues with scratch#46
fpuga wants to merge 3 commits intokawasaki:masterfrom
fpuga:modern-ubuntu-python

Conversation

@fpuga
Copy link

@fpuga fpuga commented Jan 18, 2026

Hi, thanks for building this project, i found it very useful.

I'm using scratch web app with a chinese clone of Lego Wedo 2.0, and found two issues trying to use pyscrlink.

  • Does not work in modern Ubuntu (24.04) and Python (3.13)
  • Does not connect at all or disconnects after a second

With the help of a LLM agent i was able to get it working for me. I don't have enough experience with Bluetooth to evaluate if all the changes are need or the best options, but i reviewed the changes and seems good to me.

If you don't have the time to maintain the project, don't hesitate and just leave a short comment and i will publish my own fork.

Again, thanks for this project.

fpuga added 3 commits January 10, 2026 19:56
Remove pybluez as it is no longer supported and causes installation errors on modern Python versions.
Update ws_handler to use websocket.request.path (websockets 14+ change) with a fallback for older versions. Refactor main to use asyncio.run() and async with websockets.serve() to fix 'RuntimeError: no running event loop'.
…PU usage

- Add asyncio.sleep(0.01) to prevent 100% CPU usage.
- Remove sys.exit() and catch exceptions in Session.handle to prevent server crashes.
- Fix _get_dev_uuids to collect all advertised UUIDs (fixes LPF2 Hub discovery).
- Allow empty filters in discovery to match all devices.
- Improve discover logic to reset scan state on failure/empty results, enabling retries.
- Use withResponse=True for BLE writes to improve reliability with LPF2/WeDo hubs.
- Robustify error handling in connect and _cache_characteristics.
@heepdog
Copy link

heepdog commented Jan 30, 2026

I downloaded and tested this version on Ubuntu 24.04.3 LTS with a WEDO 2.0. It seems that it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants