Skip to content

Conversation

@jmachuca77
Copy link

This PR adds automatic port detection for waveshare boards. It does so by checking for the PID/VID of the waveshare board, Hopefully all other boards match. If not it is possible that it might need to expand with several ID combinations but those can be added as needed to the DEVICE_IDS table.

@jmachuca77
Copy link
Author

If the board is not found it tries to connect using /dev/ttyACM0 and if that fails it prints out a message asking the user to provide the port manually.


DEFAULT_ID = 1 # A brand new motor should have id 1

# These are placeholders. Please replace these with your actual device's USB IDs.
Copy link
Owner

Choose a reason for hiding this comment

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

So these are the IDs of the BOM's waveshare boards ?

Copy link
Author

Choose a reason for hiding this comment

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

those are the vendor ID and product ID of the waveshare boards, if you do an lsusb you will see those printed out:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 010: ID 1a86:55d3 QinHeng Electronics USB Single Serial
Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 003: ID 0c45:672e Microdia Integrated_Webcam_HD
Bus 003 Device 002: ID 27c6:63ac Shenzhen Goodix Technology Co.,Ltd. Goodix USB2.0 MISC
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Like this... the QinHeng Electronics USB Single Serial is how mine shows up.

Copy link
Author

Choose a reason for hiding this comment

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

So if you try it with yours and the Vid:Pid comes out different it can be added to that table and it will be detected.

Copy link
Owner

Choose a reason for hiding this comment

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

Ok, I'll try that on a single motor next week before merging !

return None

# Update the script to use a list of device IDs.
DEVICE_IDS = [
Copy link
Author

Choose a reason for hiding this comment

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

To this table, this is what the second commit is for, so that if the IDs are different you can add as many IDs to this table.

@apirrone
Copy link
Owner

apirrone commented Apr 25, 2025

Should be good, can anyone confirm that it still works on their duck ?

Added the serial port in duck_config, but always defaults to /dev/ttyACM0 if not provided, so should not be breaking

@jmachuca77 are you happy with my modifications ?

@jmachuca77
Copy link
Author

Looks good on paper, I cant actually check it at the moment my HW is all over the place.

@jmachuca77
Copy link
Author

anything missing here? looks good to me.

@apirrone
Copy link
Owner

I wanted someone else to test before merging, to be sure we didn't miss something

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