mkuf / prind

print in docker - Deploy a containerized Klipper Stack for your 3D Printer
GNU General Public License v3.0
324 stars 82 forks source link

Webcam not working #96

Closed humbertogu closed 11 months ago

humbertogu commented 11 months ago

Hello,

Firstly, great implementation! Could get Klipper working great on my printer using my home computer in a breeze.

Couldn´t get webcam to stream in any frontend though, so tried to run ustreamer manually with:

docker run -p 8080:8080 --device /dev/video0:/dev/video0 mkuf/ustreamer:latest

That returned

-- INFO  [11765.384      main] -- Starting PiKVM uStreamer 5.42 ...
-- INFO  [11765.384      main] -- Using internal blank placeholder
-- INFO  [11765.384      main] -- Listening HTTP on [0.0.0.0]:8080
-- INFO  [11765.384    stream] -- Using V4L2 device: /dev/video0
-- INFO  [11765.384    stream] -- Using desired FPS: 0
================================================================================
-- INFO  [11765.384      http] -- Starting HTTP eventloop ...
-- ERROR [11765.384    stream] -- Can't access device: Permission denied
-- INFO  [11765.384    stream] -- Waiting for the device access ...

The webcam is working fine everywhere else, even on other containers, what could be causing this?

mkuf commented 11 months ago

This might be due to a gid mismatch between your host and the container.

Check the group ownership of the video device with

ls -ln /dev/video0

The gid should be 44 to match the container.
If that is not the case, you may have to add a udev rule to set the device ownership.

There are already docs on how to achieve this for the serial device, which you can adapt for your case: https://github.com/mkuf/prind#serial-device-permissions

If that is not working, please run the get-info script and share the generated archive here.

-Markus

humbertogu commented 11 months ago

Thanks for the swift reply,

Got it working perfectly with the instructions provided for the serial device with a few tweaks.

ACTION=="add",SUBSYSTEM=="video4linux",ATTRS{idVendor}=="0000",ATTRS{idProduct}=="0000",GROUP="44"