-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(usb_host_uvc): support dual camera with hub (IEC-246) #109
base: master
Are you sure you want to change the base?
feat(usb_host_uvc): support dual camera with hub (IEC-246) #109
Conversation
93fde33
to
7d193d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lijunru-hub thank you very much for fixing this limitation.
The new open API with dev_addr
looks good to me.
I left few comments for your consideration
@@ -75,6 +85,10 @@ esp_err_t uvc_desc_get_frame_format_by_format( | |||
const uvc_format_desc_t **format_desc_ret, | |||
const uvc_frame_desc_t **frame_desc_ret); | |||
|
|||
bool uvc_desc_if_uvc_device(const usb_config_desc_t *cfg_desc); | |||
|
|||
void uvc_print_desc(const usb_standard_desc_t *_desc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that you used this function for debugging... Could we revert it and make it private again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is still private for the user (priv_include
). It is called within the uvc_host_device_connected
function to print the parsed UVC descriptor. This helps us debug issues with some customer cameras, such as when they cannot be opened properly. By printing the full descriptor upon insertion, it provides useful information for troubleshooting.
host/class/uvc/usb_host_uvc/private_include/uvc_descriptors_priv.h
Outdated
Show resolved
Hide resolved
@@ -365,7 +365,7 @@ static void print_class_specific_desc(const usb_standard_desc_t *_desc) | |||
* | |||
* @param[in] _desc UVC specific descriptor | |||
*/ | |||
static void uvc_print_desc(const usb_standard_desc_t *_desc) | |||
void uvc_print_desc(const usb_standard_desc_t *_desc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert this change?
host/class/uvc/usb_host_uvc/private_include/uvc_descriptors_priv.h
Outdated
Show resolved
Hide resolved
union { | ||
struct { | ||
uint8_t dev_addr; | ||
uint8_t iface_num; //!< Disconnection event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need to pass iface_num
to the user... Do you have any example of usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood the meaning of uvc_host_stream_config_t: uvc_stream_index. We should change iface_num to uvc_stream_index here.
If a camera supports multiple video streams, the callback will be called multiple times, with the uvc_stream_index being returned incrementally each time.
// Create UAC interfaces list in RAM, connected to the particular USB dev | ||
if (is_uvc_device) { | ||
// TODO: add config to control it | ||
// usb_print_config_descriptor(config_desc, &uvc_print_desc); | ||
// Create Interfaces list for a possibility to claim Interface | ||
ESP_RETURN_ON_ERROR(uvc_host_interface_check(addr, config_desc), TAG, "uvc stream interface not found"); | ||
} else { | ||
ESP_LOGW(TAG, "USB device with addr(%d) is not UVC device", addr); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do not pass iface_num
to the user, this whole part can be removed, simplifying the code a lot. Do we really need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7d193d8
to
c037c57
Compare
@tore-espressif I added an API, |
0bb1f2b
to
9bc9961
Compare
9bc9961
to
290d524
Compare
|
||
num_frame = this_format->bNumFrameDescriptors; | ||
new_frame_info = calloc(num_frame, sizeof(uvc_host_frame_info_t)); | ||
UVC_CHECK(new_frame_info != NULL, ESP_ERR_NO_MEM); |
Check warning
Code scanning / clang-tidy
Potential leak of memory pointed to by 'frame_info' [clang-analyzer-unix.Malloc] Warning
|
||
num_frame = this_format->bNumFrameDescriptors; | ||
new_frame_info = calloc(num_frame, sizeof(uvc_host_frame_info_t)); | ||
UVC_CHECK(new_frame_info != NULL, ESP_ERR_NO_MEM); |
Check warning
Code scanning / clang-tidy
Potential leak of memory pointed to by 'new_frame_info' [clang-analyzer-unix.Malloc] Warning
Description
Feature:
usb_handle
ordev_addr
.Related
Testing
Checklist
Before submitting a Pull Request, please ensure the following: