Skip to content
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

Add USB support #69

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add USB support #69

wants to merge 6 commits into from

Conversation

nkarstens
Copy link

@nkarstens nkarstens commented Nov 13, 2023

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

@nkarstens
Copy link
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
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
pybricksdev/cli/__init__.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
@nkarstens nkarstens force-pushed the usb branch 3 times, most recently from 170da39 to da4e389 Compare January 1, 2024 05:46
pybricksdev/ble/pybricks.py Show resolved Hide resolved
pybricksdev/ble/pybricks.py Outdated Show resolved Hide resolved
@nkarstens nkarstens force-pushed the usb branch 2 times, most recently from c705276 to 540e6d3 Compare January 7, 2024 00:50
@nkarstens
Copy link
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.

pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
@nkarstens
Copy link
Author

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

pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
pybricksdev/connections/pybricks.py Outdated Show resolved Hide resolved
nkarstens and others added 5 commits February 20, 2024 01:49
Adds an abstract base class for transport functionality and
moves all BLE logic into a new subclass.

Signed-off-by: Nate Karstens <[email protected]>
Improves abstraction of transport functionality by adding
methods that perform the desired actions and moving direct
communication into the transport class.

Signed-off-by: Nate Karstens <[email protected]>
Co-authored-by: David Lechner <[email protected]>
Renames the import for finding BLE devices to better
differentiate it from a future import to find USB devices.

Signed-off-by: Nate Karstens <[email protected]>
We were starting to get repeated defines of USB stuff, so let's put it
all in one place.
This adds constants for the Pybricks USB device class, subclass and
protocol. These are used to identify hubs running the Pybricks firmware
when connected via USB.

The `usb` command of the CLI is modified to only accept Pybricks hubs
now. If we still want to support running programs on hubs running
official LEGO firmware, we can add that back with a different command
name.

Co-authored-by: Nate Karstens <[email protected]>
@nkarstens nkarstens force-pushed the usb branch 2 times, most recently from 2e56b0d to 4c5ddff Compare February 21, 2024 05:10
Adds a new transport to manage USB connections.

Signed-off-by: Nate Karstens <[email protected]>
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