Skip to content

Commit

Permalink
Add stdio_usb reset interface detection
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-pecserke committed May 24, 2023
1 parent 0cb4473 commit 6ed0a3f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions picoboot_connection/picoboot_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <pico/usb_reset_interface.h>

#include "picoboot_connection.h"

Expand Down Expand Up @@ -66,6 +67,19 @@ enum picoboot_device_result picoboot_open_device(libusb_device *device, libusb_d
}
if (!ret) {
if (desc.idVendor != VENDOR_ID_RASPBERRY_PI) {
ret = libusb_get_active_config_descriptor(device, &config);
if (ret && verbose) {
output("Failed to read config descriptor\n");
}

for (uint8_t i = 0; i < config->bNumInterfaces; ++i) {
if (0xff == config->interface[i].altsetting[0].bInterfaceClass &&
RESET_INTERFACE_SUBCLASS == config->interface[i].altsetting[0].bInterfaceSubClass &&
RESET_INTERFACE_PROTOCOL == config->interface[i].altsetting[0].bInterfaceProtocol) {
return dr_vidpid_stdio_usb;
}
}

return dr_vidpid_unknown;
}
switch (desc.idProduct) {
Expand Down

0 comments on commit 6ed0a3f

Please sign in to comment.