From 5d1e75ea176fcd6369df316ceb44a51c1f5f5f9f Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Tue, 15 Oct 2024 10:51:38 +0200 Subject: [PATCH] feat(usb_uvc): Allow any VID/PID --- host/class/uvc/usb_host_uvc_2/uvc_host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/host/class/uvc/usb_host_uvc_2/uvc_host.c b/host/class/uvc/usb_host_uvc_2/uvc_host.c index 0d76b621..c19cc6ca 100644 --- a/host/class/uvc/usb_host_uvc_2/uvc_host.c +++ b/host/class/uvc/usb_host_uvc_2/uvc_host.c @@ -236,7 +236,8 @@ static esp_err_t uvc_find_and_open_usb_device(uint16_t vid, uint16_t pid, TickTy SLIST_FOREACH(uvc_stream, &p_uvc_obj->uvc_stream_list, list_entry) { const usb_device_desc_t *device_desc; ESP_ERROR_CHECK(usb_host_get_device_descriptor(uvc_stream->dev_hdl, &device_desc)); - if (device_desc->idVendor == vid && device_desc->idProduct == pid) { + if ((vid == device_desc->idVendor || vid == 0) && + (pid == device_desc->idProduct || pid == 0)) { // Return path 1: (*dev)->dev_hdl = uvc_stream->dev_hdl; return ESP_OK; @@ -264,7 +265,8 @@ static esp_err_t uvc_find_and_open_usb_device(uint16_t vid, uint16_t pid, TickTy assert(current_device); const usb_device_desc_t *device_desc; ESP_ERROR_CHECK(usb_host_get_device_descriptor(current_device, &device_desc)); - if (device_desc->idVendor == vid && device_desc->idProduct == pid) { + if ((vid == device_desc->idVendor || vid == CDC_HOST_ANY_VID) && + (pid == device_desc->idProduct || pid == CDC_HOST_ANY_PID)) { // Return path 2: (*dev)->dev_hdl = current_device; return ESP_OK;