Skip to content

Conversation

@bzzrd
Copy link

@bzzrd bzzrd commented Dec 6, 2025

Hello,
I've added support for single level osc bundles so we can control the Europi with trowaSoft vcvrack's module.
My module is using a Pico 2 W, so I have no idea if it's working correctly on other versions.
Cheers !

@chrisib
Copy link
Collaborator

chrisib commented Dec 6, 2025

My module is using a Pico 2 W

The only wireless-enabled Pico I have access to is also a 2W, so I'm not overly concerned. The number of EuroPi users who have Pico W boards is probably fairly small. If there are performance issues with that specific board we can address them in a separate fix.

Looking at the OSC documentation, I don't think it should be difficult to modify your code to use the full recursive definition, which would allow bundles of bundles. Unlikely to be used by many people, but it's part of the specification, so it feels reasonable to include if it's simple to implement.

@chrisib chrisib added improvement Improvement or optimization of an existing feature or script networking Features that require a Pico W or Pico 2W for network communication with other devices labels Dec 6, 2025
Copy link
Collaborator

@chrisib chrisib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kicked the CI to check the code. Files in the firmware directory have more-strict coding standards than the contrib directory. Looks like the linter caught some formatting issues.

If you can get those cleaned up and implement the data validation I think this is probably in a good state to get merged.

address_end = data.index(b"\0", 1)
address = data[0:address_end].decode("utf-8")
if address == "#bundle":
data = data[address_end+9:] # position to 1st element length
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should still be some bounds-checking here; if a corrupt packet gets received there's a chance that the processing could run into an out-of-bounds error.

Something as simple as

while len(data) > 0:
    try:
        elem_length = int.from_bytes(data[0:4], "big")
        ...
    except IndexError:
        # either the length got corrupted, or the packet was partially dropped
        # either way, just process what we can and move on
        pass

should be enough to prevent the code from crashing & handling the received data as best as it can in the event there's bad data coming in.

@bzzrd bzzrd closed this Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement or optimization of an existing feature or script networking Features that require a Pico W or Pico 2W for network communication with other devices

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants