Problem communicating with camera (/dev/video0) linux.

Forum for questions and support relating to the 1.25.x releases only.
Locked
rash.m2k
Posts: 4
Joined: Sun Oct 13, 2013 5:22 pm

Problem communicating with camera (/dev/video0) linux.

Post by rash.m2k »

Hi all,

I've setup zoneminder on opensuse 12.3, all went smoothly and have it working OK.

I've setup a camera (via a USB capture device) and cheese (a linux webcam tool) can see it perfectly and it works fine.

zoneminder however can't seem to get access to this device for whatever reason, I see the error messages below.

I have added the group video to wwwrun (for apache) and rebooted, but to no avail.

Code: Select all

2013-10-14 10:13:04.105730	zmdc	2049	ERR	'zmc -d /dev/video0' exited abnormally, exit status 255	zmdc.pl	
2013-10-14 10:13:04.096891	zmc_dvideo0	2231	FAT	Failed to set camera source 0: Device or resource busy	zm_local_camera.cpp	503
2013-10-14 10:13:04.087742	zmc_dvideo0	2231	INF	Starting Capture	zmc.cpp	191
2013-10-14 10:13:04.017610	zmdc	2231	INF	'zmc -d /dev/video0' started at 13/10/14 11:13:04	zmdc.pl	
2013-10-14 10:13:04.017460	zmdc	2049	INF	'zmc -d /dev/video0' starting at 13/10/14 11:13:04, pid = 2231	zmdc.pl	
2013-10-14 10:13:04.007730	zmdc	2049	INF	Starting pending process, zmc -d /dev/video0	zmdc.pl	
2013-10-14 10:03:04.176390	zmdc	2049	ERR	'zmc -d /dev/video0' exited abnormally, exit status 255	zmdc.pl	
2013-10-14 10:03:04.167662	zmc_dvideo0	2199	FAT	Failed to set camera source 0: Device or resource busy	zm_local_camera.cpp	503
2013-10-14 10:03:04.158396	zmc_dvideo0	2199	INF	Starting Capture	zmc.cpp	191
2013-10-14 10:03:04.090370	zmdc	2199	INF	'zmc -d /dev/video0' started at 13/10/14 11:03:04	zmdc.pl	
2013-10-14 10:03:04.088580	zmdc	2049	INF	'zmc -d /dev/video0' starting at 13/10/14 11:03:04, pid = 2199	zmdc.pl	
2013-10-14 10:03:04.081310	zmdc	2049	INF	Starting pending process, zmc -d /dev/video0	zmdc.pl	
I've increased the log level in zoneminder and I see the following in the logs:
10/14/13 13:43:57.091593 zmc_dvideo0[7465].DB1-zm_logger.cpp/231 [LogOpts: level=DB9/DB9, screen=OFF, database=INF, logfile=DB9->/var/log/zm/zm_debug.log, syslog=INF]
10/14/13 13:43:57.093640 zmc_dvideo0[7465].DB1-zm_monitor.cpp/1755 [Got 1 monitors]
10/14/13 13:43:57.093719 zmc_dvideo0[7465].DB2-zm_local_camera.cpp/293 [V4L support enabled, using V4L2 api]
10/14/13 13:43:57.096708 zmc_dvideo0[7465].DB1-zm_monitor.cpp/340 [monitor purpose=1]
10/14/13 13:43:57.096753 zmc_dvideo0[7465].DB1-zm_monitor.cpp/347 [mem.size=49767924]
10/14/13 13:43:57.096830 zmc_dvideo0[7465].DB1-zm_monitor.cpp/371 [Unable to map file /dev/shm/zm.mmap.1 (49767924 bytes) to locked memory, trying unlocked]
10/14/13 13:43:57.118133 zmc_dvideo0[7465].DB1-zm_zone.cpp/50 [Initialised zone 0/All - 1 - 720x576 - Rgb:ff0000, CM:3, MnAT:15, MxAT:0, MnAP:50, MxAP:75000, FB:3x3, MnFP:50, MxFP:50000, MnBS:10, MxBS:0, MnB:0, MxB:0, OF: 0]
10/14/13 13:43:57.118533 zmc_dvideo0[7465].DB9-zm_image.cpp/1353 [x1:0,y1:575 x2:0,y2:0]
10/14/13 13:43:57.118551 zmc_dvideo0[7465].DB9-zm_image.cpp/1353 [x1:0,y1:0 x2:719,y2:0]
10/14/13 13:43:57.118564 zmc_dvideo0[7465].DB9-zm_image.cpp/1353 [x1:719,y1:0 x2:719,y2:575]
10/14/13 13:43:57.118577 zmc_dvideo0[7465].DB9-zm_image.cpp/1353 [x1:719,y1:575 x2:0,y2:575]
10/14/13 13:43:57.118595 zmc_dvideo0[7465].DB9-zm_image.cpp/1373 [0: min_y: 0, max_y:575, min_x:0.00, 1/m:-0.00]
10/14/13 13:43:57.118619 zmc_dvideo0[7465].DB9-zm_image.cpp/1373 [1: min_y: 0, max_y:575, min_x:719.00, 1/m:0.00]
10/14/13 13:43:57.118636 zmc_dvideo0[7465].DB9-zm_image.cpp/1387 [Moving global edge]
10/14/13 13:43:57.118652 zmc_dvideo0[7465].DB9-zm_image.cpp/1387 [Moving global edge]
...
...
10/14/13 13:43:57.244854 zmc_dvideo0[7465].DB9-zm_image.cpp/1315 [x:1, y:575.00]
10/14/13 13:43:57.247453 zmc_dvideo0[7465].DB1-zm_monitor.cpp/1857 [Loaded monitor 1(Monitor-1), 1 zones]
10/14/13 13:43:57.247473 zmc_dvideo0[7465].INF-zmc.cpp/191 [Starting Capture]
10/14/13 13:43:57.251398 zmc_dvideo0[7465].DB3-zm_local_camera.cpp/355 [Opening video device /dev/video0]
10/14/13 13:43:57.251438 zmc_dvideo0[7465].DB2-zm_local_camera.cpp/361 [V4L2 support enabled, using V4L2 api]
10/14/13 13:43:57.251452 zmc_dvideo0[7465].DB3-zm_local_camera.cpp/366 [Checking video device capabilities]
10/14/13 13:43:57.251472 zmc_dvideo0[7465].DB3-zm_local_camera.cpp/376 [Setting up video format]
10/14/13 13:43:57.251487 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/384 [ v4l2_data.fmt.type = 00000001]
10/14/13 13:43:57.251499 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/385 [ v4l2_data.fmt.fmt.pix.width = 000002d0]
10/14/13 13:43:57.251512 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/386 [ v4l2_data.fmt.fmt.pix.height = 000001e0]
10/14/13 13:43:57.251524 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/387 [ v4l2_data.fmt.fmt.pix.pixelformat = 59565955]
10/14/13 13:43:57.251536 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/388 [ v4l2_data.fmt.fmt.pix.field = 00000004]
10/14/13 13:43:57.251548 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/389 [ v4l2_data.fmt.fmt.pix.bytesperline = 000005a0]
10/14/13 13:43:57.251560 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/390 [ v4l2_data.fmt.fmt.pix.sizeimage = 000a8c00]
10/14/13 13:43:57.251571 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/391 [ v4l2_data.fmt.fmt.pix.colorspace = 00000001]
10/14/13 13:43:57.251583 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/392 [ v4l2_data.fmt.fmt.pix.priv = 00000000]
10/14/13 13:43:57.251596 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/414 [ v4l2_data.fmt.type = 00000001]
10/14/13 13:43:57.251608 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/415 [ v4l2_data.fmt.fmt.pix.width = 000002d0]
10/14/13 13:43:57.251620 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/416 [ v4l2_data.fmt.fmt.pix.height = 000001e0]
10/14/13 13:43:57.251632 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/417 [ v4l2_data.fmt.fmt.pix.pixelformat = 59565955]
10/14/13 13:43:57.251644 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/418 [ v4l2_data.fmt.fmt.pix.field = 00000004]
10/14/13 13:43:57.251656 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/419 [ v4l2_data.fmt.fmt.pix.bytesperline = 000005a0]
10/14/13 13:43:57.251667 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/420 [ v4l2_data.fmt.fmt.pix.sizeimage = 000a8c00]
10/14/13 13:43:57.251679 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/421 [ v4l2_data.fmt.fmt.pix.colorspace = 00000001]
10/14/13 13:43:57.251691 zmc_dvideo0[7465].DB4-zm_local_camera.cpp/422 [ v4l2_data.fmt.fmt.pix.priv = 00000000]
10/14/13 13:43:57.251702 zmc_dvideo0[7465].DB3-zm_local_camera.cpp/433 [Setting up request buffers]
10/14/13 13:43:57.254333 zmc_dvideo0[7465].DB3-zm_local_camera.cpp/461 [Setting up 8 data buffers]
10/14/13 13:43:57.254762 zmc_dvideo0[7465].DB3-zm_local_camera.cpp/499 [Configuring video source]
10/14/13 13:43:57.254794 zmc_dvideo0[7465].FAT-zm_local_camera.cpp/503 [Failed to set camera source 0: Device or resource busy]
Any ideas how I can fix this.

There is one wierd thing that I see no wwrun user account under Yast (a system admin tool) but I suspect this is a user whose login has been disabled and has no shell.
patmansf
Posts: 49
Joined: Mon Sep 30, 2013 12:19 am

Re: Problem communicating with camera (/dev/video0) linux.

Post by patmansf »

rash.m2k wrote:Hi all,

I've setup zoneminder on opensuse 12.3, all went smoothly and have it working OK.

I've setup a camera (via a USB capture device) and cheese (a linux webcam tool) can see it perfectly and it works fine.

zoneminder however can't seem to get access to this device for whatever reason, I see the error messages below.

I have added the group video to wwwrun (for apache) and rebooted, but to no avail.

Code: Select all

	
2013-10-14 10:13:04.096891	zmc_dvideo0	2231	FAT	Failed to set camera source 0: Device or resource busy	zm_local_camera.cpp	503
The above means that the device is already opened by another process, check that cheese or some other process isn't still running.
I've increased the log level in zoneminder and I see the following in the logs:
And how do you modify the log level?

-- Patrick
rash.m2k
Posts: 4
Joined: Sun Oct 13, 2013 5:22 pm

Re: Problem communicating with camera (/dev/video0) linux.

Post by rash.m2k »

patmansf wrote:
rash.m2k wrote:Hi all,

I've setup zoneminder on opensuse 12.3, all went smoothly and have it working OK.

I've setup a camera (via a USB capture device) and cheese (a linux webcam tool) can see it perfectly and it works fine.

zoneminder however can't seem to get access to this device for whatever reason, I see the error messages below.

I have added the group video to wwwrun (for apache) and rebooted, but to no avail.

Code: Select all

	
2013-10-14 10:13:04.096891	zmc_dvideo0	2231	FAT	Failed to set camera source 0: Device or resource busy	zm_local_camera.cpp	503
The above means that the device is already opened by another process, check that cheese or some other process isn't still running.
I've increased the log level in zoneminder and I see the following in the logs:
And how do you modify the log level?

-- Patrick
I modified the level on the Logging page via the GUI.

I also tried lsof /dev/video0 and showed no processes using this device. Even if I reboot I get the same error message. I think perhaps it is somehow blocking itself.
rash.m2k
Posts: 4
Joined: Sun Oct 13, 2013 5:22 pm

Re: Problem communicating with camera (/dev/video0) linux.

Post by rash.m2k »

Hah I've managed to get it working!!!

The problem was the driver! The default one that comes with opensuse 12.3 (called stk1160) does not work properly.

I tried the stk11xx driver from the opernsuse build service (search for stk11xx on opensuse and you will find it) and now it works fine. Just need to blacklist the stk1160.

The full device details are, in case other people come across this issue:

05e1:0408 Syntek Semiconductor Co., Ltd STK1160 Video Capture Device
Locked