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

UVC driver release 1.0.3 #24

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions host/class/uvc/usb_host_uvc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## 1.0.3

- Added support for ESP32-P4
- Bumped libuvc version to relax frame format negotiation
- Fixed crash on opening non-UVC devices
- Added `libuvc_get_usb_device_info` function

## 1.0.2

- Updated libuvc library to 0.0.7 https://github.com/libuvc/libuvc/tree/v0.0.7
- Added Software BoM information

## 1.0.1

- Fixed compatibility with IDF v4.4

## 1.0.0

- Initial version
1 change: 1 addition & 0 deletions host/class/uvc/usb_host_uvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ Following two supported formats are the most common (both encoded in MJPEG):
## Tested cameras
* Logitech C980
* CANYON CNE-CWC2
* Logitech C270
2 changes: 1 addition & 1 deletion host/class/uvc/usb_host_uvc/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## IDF Component Manager Manifest File
version: "1.0.2~1"
version: "1.0.3"
description: USB Host UVC driver
url: https://github.com/espressif/esp-usb/tree/master/host/class/uvc/usb_host_uvc
dependencies:
Expand Down
12 changes: 11 additions & 1 deletion host/class/uvc/usb_host_uvc/include/libuvc_adapter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -8,6 +8,8 @@
#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"
#include "usb/usb_types_stack.h"
#include "libuvc/libuvc.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -60,6 +62,14 @@ esp_err_t libuvc_adapter_print_descriptors(uvc_device_handle_t *device);
*/
esp_err_t libuvc_adapter_handle_events(uint32_t timeout_ms);

/**
* @brief Get information about underlying USB device
*
* @param[in] dev UVC device handle obtained from uvc_find_device()
* @param[out] dev_info Pointer to structure where the information will be saved
*/
esp_err_t libuvc_get_usb_device_info(uvc_device_t *dev, usb_device_info_t *dev_info);

#ifdef __cplusplus
}
#endif
2 changes: 1 addition & 1 deletion host/class/uvc/usb_host_uvc/libuvc
Submodule libuvc updated 2 files
+6 −5 src/device.c
+1 −1 src/stream.c
6 changes: 3 additions & 3 deletions host/class/uvc/usb_host_uvc/src/descriptor.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -190,8 +190,8 @@ int parse_configuration(libusb_config_descriptor_t *config, const uint8_t *buffe
LIBUSB_GOTO_ON_FALSE(interface->altsetting);

for (int ep = 0; ep < endpoints; ep++) {
ep_desc = usb_parse_endpoint_descriptor_by_index(ifc_desc, ep, config->wTotalLength, &offset);
ifc_desc = (const usb_intf_desc_t *)ep_desc;
int intf_offset = offset; // Current offset is interface offset in the configuration descriptor
tore-espressif marked this conversation as resolved.
Show resolved Hide resolved
ep_desc = usb_parse_endpoint_descriptor_by_index(ifc_desc, ep, config->wTotalLength, &intf_offset);
libusb_endpoint_descriptor_t *endpoint = &altsetting->endpoint[ep];
copy_endpoint_desc(endpoint, ep_desc);
LIBUSB_GOTO_ON_ERROR( add_extra_data(&extra, ep_desc) );
Expand Down
20 changes: 19 additions & 1 deletion host/class/uvc/usb_host_uvc/src/libusb_adapter.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -192,6 +192,24 @@ esp_err_t libuvc_adapter_print_descriptors(uvc_device_handle_t *device)
return ESP_OK;
}

esp_err_t libuvc_get_usb_device_info(uvc_device_t *dev, usb_device_info_t *dev_info)
{
uvc_error_t ret;
struct libusb_device_handle *usb_devh;

ret = libusb_open(dev->usb_dev, &usb_devh);
UVC_DEBUG("libusb_open() = %d", ret);
if (ret != UVC_SUCCESS) {
return ESP_FAIL;
}

uvc_camera_t *camera = (uvc_camera_t *)(usb_devh);
RETURN_ON_ERROR( usb_host_device_info(camera->handle, dev_info) );

libusb_close(usb_devh);
return ESP_OK;
}

esp_err_t libuvc_adapter_handle_events(uint32_t timeout_ms)
{
if (s_uvc_driver == NULL) {
Expand Down
Loading