Skip to content

Add USB support - #69

Merged
dlech merged 3 commits into
pybricks:masterfrom
nkarstens:usb
Feb 1, 2025
Merged

Add USB support#69
dlech merged 3 commits into
pybricks:masterfrom
nkarstens:usb

Conversation

@nkarstens

@nkarstensnkarstens commented Nov 13, 2023

Copy link
Copy Markdown
Contributor

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

@nkarstens

Copy link
Copy Markdown
ContributorAuthor

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

@dlech

Copy link
Copy Markdown
Member

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

@nkarstens

Copy link
Copy Markdown
ContributorAuthor

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

@dlech

dlech commented Dec 6, 2023

Copy link
Copy Markdown
Member

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

@nkarstens
nkarstensforce-pushed the usb branch 2 times, most recently from d769458 to 3456029CompareDecember 28, 2023 10:04
Comment threadpybricksdev/cli/__init__.py Outdated
Comment threadpybricksdev/connections/pybricks.py
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py
Comment threadpybricksdev/connections/pybricks.py
@nkarstens
nkarstensforce-pushed the usb branch 3 times, most recently from 170da39 to da4e389CompareJanuary 1, 2024 05:46
Comment threadpybricksdev/ble/pybricks.py Outdated
Comment threadpybricksdev/ble/pybricks.py Outdated
Comment threadpybricksdev/ble/pybricks.py Outdated
@nkarstens
nkarstensforce-pushed the usb branch 2 times, most recently from c705276 to 540e6d3CompareJanuary 7, 2024 00:50
@nkarstens

nkarstens commented Jan 7, 2024

Copy link
Copy Markdown
ContributorAuthor

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

@dlech

dlech commented Jan 7, 2024

Copy link
Copy Markdown
Member

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.

Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py
Comment threadpybricksdev/connections/pybricks.py
Comment threadpybricksdev/connections/pybricks.py Outdated
@nkarstens

Copy link
Copy Markdown
ContributorAuthor

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

Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
Comment threadpybricksdev/connections/pybricks.py Outdated
@nkarstens
nkarstensforce-pushed the usb branch 3 times, most recently from 4c5ddff to 260c9c8CompareFebruary 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 <nate.karstens@gmail.com>
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 <nate.karstens@gmail.com>
Adds a new subclass of PybricksHub that manages USB connections.
Co-developed-by: David Lechner <david@pybricks.com>
Signed-off-by: Nate Karstens <nate.karstens@gmail.com>
@dlech

dlech commented Feb 1, 2025

Copy link
Copy Markdown
Member

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:masterFeb 1, 2025
Sign up for freeto 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

@nkarstens@dlech