Skip to content

Add USB support #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2025
Merged

Add USB support #69

merged 3 commits into from
Feb 1, 2025

Conversation

nkarstens
Copy link
Contributor

@nkarstens nkarstens commented Nov 13, 2023

Adds USB support in concert with pybricks/pybricks-micropython#208

@nkarstens
Copy link
Contributor Author

@dlech This adds enough functionality to push programs. I'm still working on receiving data from the device.

@dlech
Copy link
Member

dlech commented Nov 27, 2023

I added a branch with a few more changes here: https://github.com/pybricks/pybricksdev/tree/dlech-usb

@nkarstens
Copy link
Contributor Author

@dlech This now processes stdout and status messages. Marking as ready for review.

@dlech
Copy link
Member

dlech commented Dec 6, 2023

Cool! It will probably be a few weeks before I can have a close look.

@nkarstens nkarstens force-pushed the usb branch 2 times, most recently from d769458 to 3456029 Compare December 28, 2023 10:04
@nkarstens nkarstens force-pushed the usb branch 3 times, most recently from 170da39 to da4e389 Compare January 1, 2024 05:46
@nkarstens nkarstens force-pushed the usb branch 2 times, most recently from c705276 to 540e6d3 Compare January 7, 2024 00:50
@nkarstens
Copy link
Contributor Author

nkarstens commented Jan 7, 2024

New patchset using transport composition class. Still uses UUIDs instead of separate endpoints.

@dlech
Copy link
Member

dlech commented Jan 7, 2024

6493165 is going to be a disruptive breaking change. I agree it is better to do things in the constructor but I am undecided if it is that much better that it is worth breaking people's programs.

Edit: after reviewing the code and seeing how many projects on GitHub are using pybricksdev, I'm thinking it would be best not to make this particular change.

@nkarstens
Copy link
Contributor Author

Waiting for command responses now works. I need to clean up the pybricks-micropython code a bit and will then push that up.

@nkarstens nkarstens force-pushed the usb branch 3 times, most recently from 4c5ddff to 260c9c8 Compare February 23, 2024 04:20
Moves client creation into the PybricksHub constructor. A
future change will move this into a subclass specific for
BLE or USB, so configuring this is more appropriately done
in the constructor instead of the connect method.

The disconnect logic is moved into a class method so that
it can be shared by both BLE and USB implementations.

Temporarily comments out a message that prints the device
name as this is no longer available in the connect method.

Signed-off-by: Nate Karstens <[email protected]>
Moves all logic specific to BLE connections into a new
subclass of PybricksHub. Another subclass will be added
later to handle USB connections.

Code to retrieve firmware version, hub capabilities,
etc. is moved into the connect step to better abstract
this for any connection medium.

Signed-off-by: Nate Karstens <[email protected]>
Adds a new subclass of PybricksHub that manages USB connections.

Co-developed-by: David Lechner <[email protected]>
Signed-off-by: Nate Karstens <[email protected]>
@dlech
Copy link
Member

dlech commented Feb 1, 2025

I fixed the bitrot and reworked this a bit based on the changes I made on the firmware side. It has been tested working with this build: https://github.com/pybricks/pybricks-micropython/actions/runs/13093071041

@dlech dlech merged commit b9e8e1e into pybricks:master Feb 1, 2025
6 of 7 checks passed
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