pybricks / pybricksdev

pybricksdev: Python Package with Pybricks developer tools
https://pypi.org/project/pybricksdev/
MIT License
48 stars 15 forks source link

run command Bluetooth timeout issue on Linux #71

Closed Eggmanplant closed 5 months ago

Eggmanplant commented 9 months ago

Read the title. Distro: Fedora Linux 39

dlech commented 9 months ago

This is not very much details to go on. Can you please give the exact steps to reproduce the problem and share the full output of the error?

Eggmanplant commented 9 months ago

Trying to connect with my boost hub, the light stops blinking, but the script is still searching, and some seconds after the script throws out an timeout error, and the hub light starts blinking again.

laurensvalk commented 9 months ago

For comparison, does everything work normally if you code it with https://code.pybricks.com/ ?

Eggmanplant commented 9 months ago

Sometimes, but I want to code with an other IDE.

Eggmanplant commented 9 months ago

I'm now using the Pybricks Code IDE but built on the pc using yarn because that paid features are distracting me.

panthertrader commented 5 months ago

I had similar issues with Linux (Debian based). The bluetooth connection times out very fast, at least compared to Windows. I have reconnect the hub (bluetooth) after a few minutes of inactivity. I quess it is a Linux issue and not pybricksdev related. However, if someone has an idea how to prolong the blu connection, I would be very grateful.

dlech commented 5 months ago

Can you please give the exact steps needed to reproduce the problem?

laurensvalk commented 5 months ago

I have reconnect the hub (bluetooth) after a few minutes of inactivity

The hub automatically turns itself off after 3 minutes of not being connected to a computer.

With pybricksdev (unlike the online Pybricks Code editor), it disconnects after the program completes. So if you spend a few minutes coding, the hub will be off when you try to start code again.

milad-asrar commented 5 months ago

Thank you very much.

One more think just for documentation purposes:

Using Linux Mint 21.3, I could not see the Spike Hub in the bluetooth manager. After starting the Pybricks Code Editor, is appears in the manger and you can develop in the Code Editor. Still I can not use VSC, get the following error. But it is for sure an hardware / firmware issues, as it works well on two other Linux Mint 21.3 systems.

File "/usr/local/lib/python3.10/dist-packages/pybricksdev/cli/__init__.py", line 380, in main
    asyncio.run(subparsers.choices[args.tool].tool.run(args))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/dist-packages/pybricksdev/cli/__init__.py", line 192, in run
    device_or_address = await find_device(args.name)
  File "/usr/local/lib/python3.10/dist-packages/pybricksdev/ble/__init__.py", line 68, in find_device
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
Eggmanplant commented 5 months ago

Fixed by not using pipx.