Skip to content

Multiple retries may be necessary #6

@lesamouraipourpre

Description

@lesamouraipourpre

While testing U2IF I've noticed that it sometimes takes more than one try to connect to the device:

>>> dev = machine.Device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/projects/u2if/.env/lib/python3.7/site-packages/source/machine/helper.py", line 9, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
  File "/mnt/projects/u2if/.env/lib/python3.7/site-packages/source/machine/u2if.py", line 22, in __init__
    raise ValueError("No board found")
ValueError: No board found
>>> dev = machine.Device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/projects/u2if/.env/lib/python3.7/site-packages/source/machine/helper.py", line 9, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
  File "/mnt/projects/u2if/.env/lib/python3.7/site-packages/source/machine/u2if.py", line 22, in __init__
    raise ValueError("No board found")
ValueError: No board found
>>> dev = machine.Device()
>>> dev.firmware_version
[0, 5, 0]
>>> dev.vid
51966
>>> dev.pid
16389

In the example above it took 3 attempts to connect to a RP2040 Pico. Given that the hid library seems to only return null/None with no apparent errors thrown would it be possible to add some kind of connection retry mechanism?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions