mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'fix/usb_uvc_example_p4' into 'master'
USB Host UVC example fixes for P4 Closes IEC-94, IDF-4942, and IDF-6505 See merge request espressif/esp-idf!29560
This commit is contained in:
commit
ba1ce22b6c
@ -12,7 +12,7 @@ menu "Example Configuration"
|
|||||||
config EXAMPLE_UVC_PROTOCOL_MODE_AUTO
|
config EXAMPLE_UVC_PROTOCOL_MODE_AUTO
|
||||||
bool "Auto"
|
bool "Auto"
|
||||||
help
|
help
|
||||||
When protocol mode set to Auto, the example tries to make three attempts to negotiatiate
|
When protocol mode set to Auto, the example tries to make three attempts to negotiate
|
||||||
the protocol with following parameters:
|
the protocol with following parameters:
|
||||||
1 Attempt: 640x480, 15 FPS, MJPEG
|
1 Attempt: 640x480, 15 FPS, MJPEG
|
||||||
2 Attempt: 320x240, 30 FPS, MJPEG
|
2 Attempt: 320x240, 30 FPS, MJPEG
|
||||||
@ -24,8 +24,8 @@ menu "Example Configuration"
|
|||||||
bool "Custom"
|
bool "Custom"
|
||||||
help
|
help
|
||||||
When protocol mode set to Custom, the example tries to negotiate protocol with
|
When protocol mode set to Custom, the example tries to negotiate protocol with
|
||||||
configured parameters: Attempts, Width, Heighs, FPS, Frame Coding format.
|
configured parameters: Attempts, Width, Height, FPS, Frame Coding format.
|
||||||
After all attemts result in an error, the example displays the error message and
|
After all attempts result in an error, the example displays the error message and
|
||||||
suggests to try another USB UVC Device.
|
suggests to try another USB UVC Device.
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
@ -45,7 +45,7 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Configure the negotiation width parameter during UVC device stream getting.
|
Configure the negotiation width parameter during UVC device stream getting.
|
||||||
config EXAMPLE_HEIGHT_PARAM
|
config EXAMPLE_HEIGHT_PARAM
|
||||||
int "Heigth resolution in pixels"
|
int "Height resolution in pixels"
|
||||||
default 240
|
default 240
|
||||||
help
|
help
|
||||||
Configure the negotiation height parameter during UVC device stream getting.
|
Configure the negotiation height parameter during UVC device stream getting.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## IDF Component Manager Manifest File
|
## IDF Component Manager Manifest File
|
||||||
dependencies:
|
dependencies:
|
||||||
idf: ">=5.0"
|
idf: ">=5.0"
|
||||||
usb_host_uvc: "^1.0.0"
|
usb_host_uvc: "^1.0.3"
|
||||||
mdns: "^1.2.0"
|
mdns: "^1.2.5"
|
||||||
protocol_examples_common:
|
protocol_examples_common:
|
||||||
path: ${IDF_PATH}/examples/common_components/protocol_examples_common
|
path: ${IDF_PATH}/examples/common_components/protocol_examples_common
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -170,9 +170,9 @@ static uvc_error_t uvc_negotiate_stream_profile(uvc_device_handle_t *devh,
|
|||||||
uvc_stream_ctrl_t *ctrl)
|
uvc_stream_ctrl_t *ctrl)
|
||||||
{
|
{
|
||||||
uvc_error_t res;
|
uvc_error_t res;
|
||||||
int attempt = CONFIG_EXAMPLE_NEGOTIATION_ATTEMPTS;
|
|
||||||
#if (CONFIG_EXAMPLE_UVC_PROTOCOL_MODE_AUTO)
|
#if (CONFIG_EXAMPLE_UVC_PROTOCOL_MODE_AUTO)
|
||||||
for (int idx = 0; idx < EXAMPLE_UVC_PROTOCOL_AUTO_COUNT; idx++) {
|
for (int idx = 0; idx < EXAMPLE_UVC_PROTOCOL_AUTO_COUNT; idx++) {
|
||||||
|
int attempt = CONFIG_EXAMPLE_NEGOTIATION_ATTEMPTS;
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
The uvc_get_stream_ctrl_format_size() function will attempt to set the desired format size.
|
The uvc_get_stream_ctrl_format_size() function will attempt to set the desired format size.
|
||||||
@ -191,9 +191,9 @@ static uvc_error_t uvc_negotiate_stream_profile(uvc_device_handle_t *devh,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG_EXAMPLE_UVC_PROTOCOL_MODE_AUTO
|
|
||||||
|
|
||||||
#if (CONFIG_EXAMPLE_UVC_PROTOCOL_MODE_CUSTOM)
|
#elif (CONFIG_EXAMPLE_UVC_PROTOCOL_MODE_CUSTOM)
|
||||||
|
int attempt = CONFIG_EXAMPLE_NEGOTIATION_ATTEMPTS;
|
||||||
while (attempt--) {
|
while (attempt--) {
|
||||||
ESP_LOGI(TAG, "Negotiate streaming profile %dx%d, %d fps ...", WIDTH, HEIGHT, FPS);
|
ESP_LOGI(TAG, "Negotiate streaming profile %dx%d, %d fps ...", WIDTH, HEIGHT, FPS);
|
||||||
res = uvc_get_stream_ctrl_format_size(devh, ctrl, FORMAT, WIDTH, HEIGHT, FPS);
|
res = uvc_get_stream_ctrl_format_size(devh, ctrl, FORMAT, WIDTH, HEIGHT, FPS);
|
||||||
@ -251,8 +251,11 @@ int app_main(int argc, char **argv)
|
|||||||
ESP_LOGI(TAG, "Waiting for USB UVC device connection ...");
|
ESP_LOGI(TAG, "Waiting for USB UVC device connection ...");
|
||||||
wait_for_event(UVC_DEVICE_CONNECTED);
|
wait_for_event(UVC_DEVICE_CONNECTED);
|
||||||
|
|
||||||
UVC_CHECK(uvc_find_device(ctx, &dev, PID, VID, SERIAL_NUMBER));
|
if (uvc_find_device(ctx, &dev, PID, VID, SERIAL_NUMBER) != UVC_SUCCESS) {
|
||||||
ESP_LOGI(TAG, "Device found");
|
ESP_LOGW(TAG, "UVC device not found");
|
||||||
|
continue; // Continue waiting for UVC device
|
||||||
|
}
|
||||||
|
ESP_LOGI(TAG, "UVC device found");
|
||||||
|
|
||||||
// UVC Device open
|
// UVC Device open
|
||||||
UVC_CHECK(uvc_open(dev, &devh));
|
UVC_CHECK(uvc_open(dev, &devh));
|
||||||
|
0
examples/peripherals/usb/host/uvc/sdkconfig.ci
Normal file
0
examples/peripherals/usb/host/uvc/sdkconfig.ci
Normal file
@ -0,0 +1 @@
|
|||||||
|
CONFIG_EXAMPLE_UVC_PROTOCOL_MODE_CUSTOM=y
|
1
examples/peripherals/usb/host/uvc/sdkconfig.ci.stream
Normal file
1
examples/peripherals/usb/host/uvc/sdkconfig.ci.stream
Normal file
@ -0,0 +1 @@
|
|||||||
|
CONFIG_EXAMPLE_ENABLE_STREAMING=y
|
Loading…
x
Reference in New Issue
Block a user