Yifan-Liu1 commented on PR #21446:
URL: https://github.com/apache/nuttx/pull/21446#issuecomment-6756719567

   > @Yifan-Liu1 I implemented the UVC host class driver some time ago and was 
planing to submit it to mainline: 
https://github.com/acassis/incubator-nuttx/tree/uvc_webcam Since you are 
working on it now, could you please check both implementations? Feel free to 
copy any commit or driver to your PR since I don't have time to work on it now
   
   @acassis Thanks for the pointer and for offering the code - comparing the 
two was worth it and it changed the shape of this PR.
   
   I took two things from your branch. The first is the optional 
DRVR_ISOCASYNCH() method with struct usbhost_isoc_s, which covers several 
isochronous packets per submission and reports the length of every packet on 
completion, together with your simulator implementation of it. It is `8d63b14`, 
with you as the author, and it removed the awkward assumption this driver had 
inherited: that the completion callback runs once per packet.
   
   The second is the retry you added for a video device name another driver 
already holds. The driver here asked capture_register() for one name and gave 
up on -EEXIST, so a board with an on-board sensor next to the USB port - or the 
simulator with SIM_CAMERA enabled - never saw the camera at all. It now walks 
on to the next number (`0fd929f`), and the commit says where it came from.
   
   I did not adopt your extension of include/nuttx/usb/uvc.h: this driver needs 
112 control unit definitions (UVC_CT_*, UVC_CTRL_UNIT_*) that are not in it, 
and moving them into the public header would duplicate what the gadget driver 
keeps there. The private header stays for now - if you would rather see them 
shared, I am happy to do it as a separate change.
   
   I did not swap the whole driver either, because this one matches more 
payload formats (MJPEG, H.264/HEVC frame-based, YVU420, YUV420, M420, GREY, 
RGB565, BGR24 on top of the JPEG/NV12/UYVY/YUYV yours handles) and negotiates 
bandwidth across the alternate settings itself. The structure differs as well - 
yours submits and completes through the isochronous descriptor, this one keeps 
a slot pipeline - but both feed the same imgdata/imgsensor operations. If you 
spot a behaviour in yours that this one lacks, tell me and I will add it.
   
   One limitation is shared by both: no hardware host controller implements the 
new method yet, so CONFIG_USBHOST_UVC is limited to the simulator for now. If 
you ever pick the xHCI side up, that restriction can go.
   
   Thanks again for the offer and for the review comments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to