Using Milk-V Duo as USB Webcam/USB OTG Device?

Hello!

I’m trying to build an USB Webcam using Milk-V Duo 256M. I’m trying to do that by adapting a guide made for Raspberry Pi (https://www.raspberrypi.com/tutorials/plug-and-play-raspberry-pi-usb-webcam/).

From what I understand, in order for that to work, I need to build a Linux with following packages:
-git
-libcamera
-libjpeg
-libcomposite

While I found git and libcamera in Buildroot config, it seems that libjpeg and libcomposite are missing. Is there a way to add them?

Also, the guide requires that the device should be set up as USB OTG device. What would be the best way to do that?

2 Likes

UPDATE: I’ve found a script in /etc called run_usb.sh, which by default is used by Milk-V to put device in NCM mode. This allows the device to emulate Ethernet connection. It seems that the script also allows to start the device in UVC mode, which should allow Milk-V to be registered as webcam. For some reason the script does not work - I’ll keep investigating and post results here.

2 Likes

UPDATE: I’ve managed to compile uvc-gadget on Milk-V Duo by using uvc-gadget buildroot package from GitHub - scpcom/LicheeRV-Nano-Build at package-uvc-gadget-server repository.

All that’s left is to figure out how to set up UVC folder structure for USB device and verify that it works - I’ll be able to do that once I’ll receive the compatible camera. If I’ll manage to get it working, I’ll make a pull request with this feature to Duo buildroot SDK.

2 Likes

Good luck and keep us updated. Reminds me a bit of this and this project.

3 Likes

It seems that one of the main reason why UVC init is failing is because default Linux build does not have UVC drivers included. I’m trying to figure out how to build Linux with UVC drivers, using Using a usb camera on milk-v Duos | Milk-V as reference guide on adding drivers.

3 Likes

UPDATE: Camera has arrived. Unfortunately it seems that I won’t be able to plug it in unless V4L2 is supported by Milk-V Duo. When will the Duo support v4l2?

Is there any new info regarding V4L2 support? @Carbon @setq

3 Likes


you have option to build v4l2 support while building right mate?

1 Like

Please if someone manages to do this, I would love a tutorial about this functionality.

1 Like