Jump to content

Recommended Posts

Posted
Armbianmonitor:

Hi!

 

I recently upgraded the OS of my OpiZeroLTS, from the Debian Stretch Server 5.3.5 (available distro on Sunxi website) to Debian Buster 5.8.5 (downloaded from armbian webpage).

Everything went well, except when I plug my USB webcam several video devices are assigned. I made a script with fswebcam to acquire still pictures from all /dev/video*  and these "ghost" cameras are causing errors when the software try to open them as regular webcams.

 

My script:

for vid in /dev/video*; do
  output=$(basename $vid)
  fswebcam -d $vid -r 1920x1080 -D 10 -S 5 -F 1 --jpeg -1 --no-banner  --no-timestamp --no-info /opt/images/$output
  mv /opt/images/$output /opt/images/$output.jpg
done

____

 

This is the error message I get running the script:

# ./capture.sh
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Unable to query input 0.
VIDIOC_ENUMINPUT: Inappropriate ioctl for device
mv: cannot stat '/opt/images/video0': No such file or directory
--- Opening /dev/video1...
Trying source module v4l2...
/dev/video1 opened.
No input was specified, using the first.
Unable to query input 0.
VIDIOC_ENUMINPUT: Inappropriate ioctl for device
mv: cannot stat '/opt/images/video1': No such file or directory
--- Opening /dev/video2...
Trying source module v4l2...
/dev/video2 opened.
No input was specified, using the first.
Adjusting resolution from 1920x1080 to 1280x800.
Delaying 10 seconds.
--- Capturing frame...
Skipping 5 frames...
Capturing 1 frames...
Captured 6 frames in 0.17 seconds. (35 fps)
--- Processing captured image...
Setting output format to JPEG, quality -1
Disabling banner.
Clearing timestamp.
Clearing info text.
Writing JPEG image to '/opt/images/video2'.
--- Opening /dev/video3...
Trying source module v4l2...
/dev/video3 opened.
No input was specified, using the first.
Unable to query input 0.
VIDIOC_ENUMINPUT: Inappropriate ioctl for device
mv: cannot stat '/opt/images/video3': No such file or directory

____

 

Here is my lsusb output:

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 004: ID 04f2:b351 Chicony Electronics Co., Ltd
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

_____


typing v4l2-ctl --list-devices I get:
cedrus (platform:cedrus):
        /dev/video1

sun8i-di (platform:sun8i-di):
        /dev/video0

 HD Webcam:  HD Webcam (usb-1c1b000.usb-1):
        /dev/video2
        /dev/video3

 

The only physical device is the /dev/video2

 

 

I got some clue reading this post:

https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device

 

but I don´t know much (i.e. nothing) about kernel compiling, drivers and etc.

 

Does anyone know what to stop assigning video nodes to these memory-to-memory devices? Is there a way to filter the virtual devices on my fswebcam script?

 

Thank you!

Posted

Hello @Godfabber,

 

i think i understand your problem.

 

First let's check

 

lsusb

master@Zero-Bk:~$ lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 045e:0779 Microsoft Corp. LifeCam HD-3000
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

..as you can see, a usbcam is detected: Microsoft Corp. LifeCam HD-3000

 

What gives you a ls -ltrh /dev/video*

 

master@Zero-Bk:~$ ls -ltrh /dev/video*
crw-rw---- 1 root video 81, 0 Sep  6 12:20 /dev/video0
crw-rw---- 1 root video 81, 1 Sep  6 12:20 /dev/video1
crw-rw---- 1 root video 81, 3 Sep  6 12:20 /dev/video3
crw-rw---- 1 root video 81, 2 Sep  6 12:20 /dev/video2

or

sudo apt-get install v4l-utils

v4l2-ctl --list-devices

In my case:

master@Zero-Bk:~$ v4l2-ctl --list-devices
cedrus (platform:cedrus):
        /dev/video0

sun8i-di (platform:sun8i-di):
        /dev/video1

Microsoft® LifeCam HD-3000: Mi (usb-1c1c000.usb-1):
        /dev/video2
        /dev/video3

That means that the module sunxi_cedrus and sun8i_di has to be blacklisted...

sudo nano /etc/modprobe.d/sunxi_cedrus.conf

blacklist sunxi_cedrus

and:


sun8i_di

sudo nano /etc/modprobe.d/sun8i_di.conf

blacklist sun8i_di

sudo reboot

After reboot you see this after typing v4l2-ctl --list-devices:

Microsoft® LifeCam HD-3000: Mi (usb-1c1c000.usb-1):
        /dev/video0
        /dev/video1

so, you have now only your webcam as video-device..

 

..hope it helps...

 

 

Posted (edited)

Hi @MacBreaker,

 

Yes, it helped a lot!

Everything works fine! I'm just wondering why we need to write sun8i_di - with low dash - if the platform name is sun8i-di, with regular hyphen...¯\_(ツ)_/¯

 

All my seven cameras appears correctly now:

# v4l2-ctl --list-devices
USB 2.0 Camera: USB Camera (usb-1c1b000.usb-1.1.1):
	/dev/video2
	/dev/video3

SMI: SMI (usb-1c1b000.usb-1.1.2):
	/dev/video8
	/dev/video9

HBV camera: HBV camera (usb-1c1b000.usb-1.1.3):
	/dev/video6
	/dev/video7

SMI: SMI (usb-1c1b000.usb-1.1.4):
	/dev/video12
	/dev/video13

USB 2.0 Camera: USB Camera (usb-1c1b000.usb-1.2):
	/dev/video0
	/dev/video1

SMI: SMI (usb-1c1b000.usb-1.3):
	/dev/video10
	/dev/video11

 HD Webcam:  HD Webcam (usb-1c1b000.usb-1.4):
	/dev/video4
	/dev/video5

The problem now is that fswebcam can't filter the metadata device (the second /dev/video* for each camera) and try to open it, outputing an error message:

# ./capture.sh
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Delaying 2 seconds.
--- Capturing frame...
Captured frame in 0.00 seconds.
--- Processing captured image...
Setting output format to JPEG, quality -1
Disabling banner.
Clearing timestamp.
Clearing info text.
Writing JPEG image to '/opt/images/video0'.
--- Opening /dev/video1...
Trying source module v4l2...
/dev/video1 opened.
No input was specified, using the first.
Unable to query input 0.
VIDIOC_ENUMINPUT: Inappropriate ioctl for device
.
.
.
.
and so on...

I found info about this bug (or feature, depending the side you are...):

https://bugzilla.kernel.org/show_bug.cgi?id=199575

Quote

Apparently this is a feature introduced by commit that went in kernel 4.16: 088ead25524583e2200aa99111bea2f66a86545a. media: uvcvideo: Add a metadata device node

Some UVC video cameras contain metadata in their payload headers. This patch extracts that data, adding more clock synchronisation information, on both bulk and isochronous endpoints and makes it available to the user space on a separate video node, using the V4L2_CAP_META_CAPTURE capability and the V4L2_BUF_TYPE_META_CAPTURE buffer queue type. By default, only the V4L2_META_FMT_UVC pixel format is available from those nodes. However, cameras can be added to the device ID table to additionally specify their own metadata format, in which case that format will also become available from the metadata node.

 

Now I'll try to figure out how to filter it on fswebcam or maybe I'll need to choose another webcam app.

 

Thanks for your help!

Edited by Godfabber
Posted

Hi,

 

Quote

Everything works fine! I'm just wondering why we need to write sun8i_di - with low dash - if the platform name is sun8i-di, with regular hyphen...¯\_(ツ)_/¯

 

i know the problem :),  but when you type "lsmod" you can see all aktive modules and the writing..

 

About the other problem.

Maybe you can set a filter in your script that allow only "even numbers" and skip "odd numbers"..

 

..just my thougts about this.

 

greetings

 

Markus

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines