Skip to content

Conversation

@ChrisDick
Copy link
Contributor

Description

Cleaned up the stack and added host and device vendor messages to pd. This allows users to send and receive vendor messages on both ports once USB attach is complete for that port.

If a device is attached to a host port a vendor message is sent. If message is received by the badge on the usb in, it detects the other badge and connects as a device, it responds with the same message to let the other badge know it is connected as a host.

includes a helper to construct a vendor header and events to signal a badge has been connected and messages received.

It also contains code for prime and double prime messages, but there is an issue with the packet creation and the end of packet symbol is being inserted by the fusb302 before it stuffs the CRC in the packet. hopefully this will be enabled in a future PR.

@Jonty
Copy link
Member

Jonty commented Jan 18, 2026

This is EXTREMELY COOL

@ChrisDick ChrisDick marked this pull request as draft January 19, 2026 18:55
@ChrisDick
Copy link
Contributor Author

I've changed this to draft as I've started doing the docs and want to improve the mp api, it's a bit verbose and could do with being split into host and device classes and improving the connection status getters.

@ChrisDick
Copy link
Contributor Author

updated the api to the following, using separate classes as host may be extended with prime messages, which a device deosn't send:

>>> from pd import Device, Host
>>> dir(Device)
['__class__', '__name__', '__bases__', '__dict__', 'badge_connected', 'connected', 'get_vendor_msg', 'pd_enabled', 'send_vendor_msg']
>>> dir(Host)
['__class__', '__name__', '__bases__', '__dict__', 'badge_connected', 'connected', 'get_vendor_msg', 'pd_enabled', 'send_vendor_msg']

@ChrisDick ChrisDick marked this pull request as ready for review January 20, 2026 22:46
@ChrisDick ChrisDick marked this pull request as draft January 23, 2026 18:45
@ChrisDick
Copy link
Contributor Author

going to make further improvements to the api

@ChrisDick ChrisDick marked this pull request as ready for review January 26, 2026 22:53
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