alew3 / faceit_live3

This is an update to faceit_live using first order model
366 stars 96 forks source link

Add chmod 777 of webcam #18

Open dlgiant opened 4 years ago

dlgiant commented 4 years ago

System: Ubuntu 20.04.1

Command:

python faceit_live.py --system linux --webcam_id 1

Error:

Linux version, importing FakeWebCam
CUDA is available:  True
Device Name: GeForce RTX 2080 Ti
Device Count: 1
CUDA:  10.1
cuDNN 7603
Device 0
Scanning /media folder for images to use...
./media/oliver.jpg
./media/oliver2.jpg
Traceback (most recent call last):
  File "faceit_live.py", line 285, in <module>
    main()
  File "faceit_live.py", line 87, in main
    camera = pyfakewebcam.FakeWebcam(f'/dev/video{stream_id}', webcam_width, webcam_height)
  File "/home/rick/anaconda3/envs/faceit_live3/lib/python3.8/site-packages/pyfakewebcam/pyfakewebcam.py", line 54, in __init__
    fcntl.ioctl(self._video_device, _v4l2.VIDIOC_S_FMT, self._settings)
OSError: [Errno 22] Invalid argument

Suggestion:

add line below to the README.md: chmod 777 /dev/video<x>

jdtimmerman commented 4 years ago

This was not neccesary for me (on Manjaro). These resources have a group owner video

$ ls -la /dev/video*
crw-rw----+ 1 root video 81, 0 26 okt 09:15 /dev/video0
crw-rw----+ 1 root video 81, 1 26 okt 09:15 /dev/video1
crw-rw----+ 1 root video 81, 2 26 okt 09:15 /dev/video2
crw-rw----+ 1 root video 81, 3 26 okt 09:15 /dev/video3
crw-rw----+ 1 root video 81, 4 26 okt 12:12 /dev/video4

Are you in this group?

HumanG33k commented 4 years ago

NEVER NEVER do a chmod 777.

In 99.9999999999% case a security issue.

Same here on debian so on ubuntu

$ ls -la /dev/video*
crw-rw----+ 1 root video 81, 0 26 oct.  19:01 /dev/video0
crw-rw----+ 1 root video 81, 1 26 oct.  19:01 /dev/video1
crw-rw----+ 1 root video 81, 2 27 oct.  18:16 /dev/video2
dlgiant commented 4 years ago

I was getting the error shown up to the moment I performed the chmod. My suggestion was just for the case another user find themselves getting OSError: [Errno 22] Invalid argument.

But I agree with @HumanG33k, a chmod 777 is a horrible idea in a production environment, it can leave a lot resources vulnerable.