Skip to content

Commit

Permalink
Allow using thirdparty VID for reboot interface
Browse files Browse the repository at this point in the history
Filtering by `--vid` and `--pid` is not enough currently.

Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Nov 17, 2024
1 parent bf33c6d commit 701283f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions picoboot_connection/picoboot_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "picoboot_connection.h"
#include "pico/bootrom_constants.h"
#include "pico/stdio_usb/reset_interface.h"

#if ENABLE_DEBUG_LOG
#include <stdio.h>
Expand Down Expand Up @@ -138,6 +139,17 @@ enum picoboot_device_result picoboot_open_device(libusb_device *device, libusb_d
}
}

// Runtime reset interface with thirdparty VID
if (!ret) {
for (int i = 0; i < config->bNumInterfaces; i++) {
if (config->interface[i].altsetting[0].bInterfaceClass == 0xff &&
config->interface[i].altsetting[0].bInterfaceSubClass == RESET_INTERFACE_SUBCLASS &&
config->interface[i].altsetting[0].bInterfaceProtocol == RESET_INTERFACE_PROTOCOL) {
return dr_vidpid_stdio_usb;
}
}
}

if (!ret) {
if (config->bNumInterfaces == 1) {
interface = 0;
Expand Down

0 comments on commit 701283f

Please sign in to comment.