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 options --vid=<VID> --pid=<PID> --serial=<SERIAL> for soft reset with libusb #65

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

Conversation

jcdr
Copy link

@jcdr jcdr commented Apr 8, 2021

Hello,

I am aware that this is not the first pull request asking for that critical feature absolutely required to remotely update multiples boards connected to the same computer. The VID and PID options allow to control boards with custom USB descriptor. Tested on Debian 11 with 4 Teensy 4.1 board behind a external hub and each with custom USB composite descriptors (ACM + ACM + HID + HID).

The code only touch the soft reset for libusb. If you like the idea, feel free to extend that to other reset and libraries.

Best regards.
Jean-Christian

@stapelberg
Copy link
Contributor

Thank you for sending this PR!

I, too, would love to see this merged.

The https://github.com/kinx-project/kint keyboard controller uses the Teensy, but also specifies a custom USB VID/PID.

It would be very convenient to be able to easily soft reset it when programming.

@PaulStoffregen
Copy link
Owner

I'm reluctant to add a feature which only works on 1 platform.

@jcdr
Copy link
Author

jcdr commented Apr 10, 2021

I'm reluctant to add a feature which only works on 1 platform.

Thank you very much for your message.

I perfectly understand that, but soft reset is actually only implemented for libusb anyway. I will not try to extend that feature to others platforms outside of what is actually implemented, and without some confidence that the work will be merged at some point. So this narrow the discussion to extend the proposal to hard reset. Please see this first pull request as the potential beginning of the process.

The --vid and --pid proposed patch is not platform dependent, but the default value depend on the hard or soft reset. A way to manage that is to convert opt_vid / opt_pid later and default them to NULL, then to test the opt_vid and opt_pid at the open_usb_device() call from the hard and soft reset. Like:
open_usb_device(opt_vid ? strtoul(opt_vid, NULL, 16) : 0x16C0, opt_pid ? strtoul(opt_pid, NULL, 16) : 0x0477, opt_serial);
Is that idea a way forward or should that issue be managed in a other way ?

The --serial proposed patch is very platform dependent. I will not be able to test others platform myself, so the only way forward if to find help from enough peoples to test all the platforms. That said, if you at least agree on the architecture of the patch, this will allow others to more easily implement that feature on others platforms.

Will be happy to read more from you.

Best Regards
Jean-Christian

@jcdr
Copy link
Author

jcdr commented Apr 11, 2021

Last commit propose an other way to manage the default hard and soft vid and pid. I think this is cleaner than the proposal in my last message.

@RenaKunisaki
Copy link

RenaKunisaki commented Sep 25, 2021

Was just coming to request that --device be re-added since it's the only way to reprogram a Teensy with a different VID/PID if you can't reach the button. This seems like the same thing.

Unfortunately it seems to fail to actually perform the soft reset. It says "Soft reset performed" but the board doesn't reset. With the older version I had been using, it works.

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.

4 participants