-
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
USB Host UVC driver version 2 #84
Conversation
7adb8ec
to
e9a9097
Compare
host/class/uvc/usb_host_uvc_2/host_test/main/parsing/descriptors/old.hpp
Outdated
Show resolved
Hide resolved
host/class/uvc/usb_host_uvc_2/host_test/main/parsing/test_parsing_customer_dual.cpp
Outdated
Show resolved
Hide resolved
host/class/uvc/usb_host_uvc_2/host_test/main/parsing/test_parsing_elp_h264.cpp
Outdated
Show resolved
Hide resolved
host/class/uvc/usb_host_uvc_2/host_test/main/parsing/test_parsing_logitech_c270.cpp
Outdated
Show resolved
Hide resolved
e9a9097
to
4157f1b
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.
@peter-marcisovsky Thank you very much for such a thorough review!
I fixed most of the things, answered other and left a few for later.
I left the changes in separate comment for now, so it is easier to review
host/class/uvc/usb_host_uvc_2/host_test/main/parsing/descriptors/old.hpp
Outdated
Show resolved
Hide resolved
host/class/uvc/usb_host_uvc_2/examples/basic_uvc_stream/main/basic_uvc_stream.c
Outdated
Show resolved
Hide resolved
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.
Hey Tomas,
I did the first round and it works! Cool!
Regarding the changes, I did check the:
- READMEs and Description
- Folder struct and APIs
Couple of notes I've already put, but to proceed, I think that I might meed some additional information.
Like requirements. I prepared the list of the questions, answers to them will help me understand what should I check and how.
- What are the targeting versions of esp-idf for examples? (I've tried the
basic_uvc_stream
on v5.2 and there isfatal error: sd_pwr_ctrl_by_on_chip_ldo.h: No such file or directory
😐 - What are the requirements for the driver? Should it notify the user while the device is attached to the ESP32 and then user should start streaming? Or it just provides the possibility to open the stream, when the device is already connected and user knows the vid/pid? More like the general idea. Using with hubs, several streams on one device or not, hot detaching (detaching cameras during streaming) and so on
- Single-thread/Multi-thread. Does it support opening several streams on one physical device from several different tasks?
I have checked the docs/
folder, thanks for the png! (also, if we need to provide special additional information, such as "create" above the arrow, maybe we need to think about renaming the name of the API)
I will proceed with the review, feel free to address current comments.
host/class/uvc/usb_host_uvc_2/include/esp_private/uvc_control.h
Outdated
Show resolved
Hide resolved
430f7d0
to
f2e7547
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.
Actually, couple of new comments, but nothing serious.
I will try to verify it on a hardware, should I have some special camera or anything I should know before testing?
Also, did you do any measurements to what extend it is better than the implementation, based on libusb?
UPD: Is our current example in esp-idf is compatible with this new class driver?
host/class/uvc/usb_host_uvc_2/examples/basic_uvc_stream/main/basic_uvc_stream.c
Outdated
Show resolved
Hide resolved
host/class/uvc/usb_host_uvc_2/examples/basic_uvc_stream/main/basic_uvc_stream.c
Outdated
Show resolved
Hide resolved
@tore-espressif Will proceed with review shortly... |
@roma-jam that is really weird, Can you share full CFG descriptor? |
USB 2.0 Camera Seems like we have it in host_test, as CANYON_CNE_CWC2. Which probably means that I do smth wrong. UPD: I open the stream on the same device again. But the stream was already opened and interface was claimed, so I don't get any error on that and driver tries to claim the interface one more time. But it is already claimed, that is why the EP already allocated. Good.
|
Yep, I opened the stream, but I keep getting the following error: and I still have no idea why. In process. |
f2e7547
to
104b5c1
Compare
104b5c1
to
a516b6c
Compare
a516b6c
to
df83b49
Compare
The last commit adds the following:
Overall, this is Release candidate for v2. Other features and bugs will be addressed in bugfix releases |
host/class/uvc/usb_host_uvc/docs/uvc_frames_state_transitions.png
Outdated
Show resolved
Hide resolved
Yep, here is the log:
Is there is anything, that I could print of add, let me know. |
df83b49
to
999f316
Compare
This driver does not use libuvc anymore, it is native to Espressif's USB Host Library
999f316
to
2e8904e
Compare
Meanwhile
|
@roma-jam Thank you for all testing! I tried with 3 more cameras and could not get the same error as you... I'll merge this not to delay any further. I'll get the same camera as you and fix in next 2.0.1 release |
Introduction
This PR introduces version 2 of the USB Host UVC driver, aimed at enabling ESP SoCs to stream frames from connected USB cameras.
The driver provides frames to the user via a callback, offering a flexible interface that can serve as a foundation for more advanced frame processing applications.
Internally, the driver manages a FreeRTOS Queue containing multiple frame buffers, which helps prevent buffer overflows and underflows during streaming.
Detailed feature descriptions, future plans, and usage instructions are available in the README.md file.
Information for Testers
This section provides instructions for testing the driver’s functionality and public API.
Two examples are included for testing:
1.
basic_uvc_stream
2.
camera_display
Information for Reviewers
This section provides guidance for those reviewing the internal code structure of the driver.
The driver includes a
host_test
folder with tests designed to run on Linux. These tests use a mocked version of the esp-idf/usb component, focusing on the following areas, which should need less in-depth review:uvc_descriptor_parsing.c
uvc_isoc.c
anduvc_bulk.c
The following file, focused on human-readable output, also requires only a light review:
uvc_descriptor_printing.c
Areas not yet covered by
host_tests
and requiring more detailed review include:uvc_frame.c
(manages queue of empty frame buffers)uvc_control.c
(handles video format negotiation and other control requests)uvc_host.c
(includes driver installation, device management, stream initiation, etc.)Related Information