5

Is there any way to pass the camera through to Windows Subsystem for Linux? This feature would make everything I'm doing right now so much easier. I know there is a feature request for USB support, but is there a workaround for now? Can I setup a camera stream on my host and access the 'networked' stream on the Ubuntu terminal?

edit: clarification

4 Answers 4

7

Alas, no, WSL doesn't support camera devices at this time. If this is something you'd like to see in future releases, please find & upvote or file an ask on the WSL UserVoice page.

2

While I haven't tried it (yet), a few recent developments should allow you to accomplish this indirectly.

First, there's this devblog from Microsoft detailing the new WSL2 kernel support for USB/IP, along with the steps need to enable it. At a high-level:

  • According to the devblog, Windows 11 is required (although see below for the possibility of doing this on Windows 10).
  • Update to the 5.10.60.1 kernel release with wsl --update.
  • Install the latest release of usbip-win
  • Install the user-space tools for USB/IP along with the HW database of USB devices.
  • Add the tools to the sudoers secure_path
  • As a Windows administrator, share the device using usbipd
  • Check that the device is connected in WSL via lsusb

Note also that some folks running Home Assistant in WSL have also had success using USB/IP even before Windows 11. See this answer for my write-up, as well as a link to the Home Assistant post detailing this.

0

This is a workaround I used:

I stream USB and built-in camera video as MJPEG data over HTTP and receive it in WSL. This works for both WSL1 and 2.

I wrote a three step guide: https://gist.github.com/soerenkoh/a964caf0ca958c4e3a9cdac125615c2f

-1

Until now WSL and WSL2 still do not support this feature along with all other applications or development use cases that require accessing an USB device attached to Windows. It is due to the lack of USB-pass-through in Hyper-V which governs WSL.

Follow this github issue for potential updates.

There is a workaround though, you can consult this article which walks through the steps to make it happen. The basic idea is to setup a stream server both on Windows and WSL. Then first stream raw video input into WSL, do the processing work in WSL, and finally stream out the output from WSL back to Windows.

Until USB-pass-through is natively supported, these extra hops are necessary. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.