Code: Select all
$ sudo -u www-data zmu -d /dev/video0 -q -v
Error, failed to query crop /dev/video0: Invalid argument
$ sudo -u www-data ./zmu -d /dev/video0 -q -v -V1
Error, failed to get channel 0 attributes: Invalid argument
Code: Select all
vidioctl( vid_fd, VIDIOC_G_CROP, &crop )
Looking through the code, the results of this call is never used, it is only displayed as diagnostic information when the verbose flag is set. Therefore, I patched the code to display this information if it succeeds, or ignore it if it fails.
The next point of failure was the call to vidioctl( vid_fd, VIDIOC_S_FMT, &v4l2_data.fmt) with v4l2_data.fmt.fmt.pix.field = V4L2_FIELD_ANY; My fix was to comment out this assignment to leave the current camera settings alone.
When trying to use the web interface's 'Probe' function, it fails to match the machine parseable output from zmu. The 'S:' for available "standards" was missing the colon. Apparently, my device returns 0 standards as a result of the call to vidioctl( vid_fd, VIDIOC_ENUMSTD, &standard ). The code assumed at least one standard would be returned, and the last one would have an extra forward slash at the end. The code following this while loop replaces the last '/' with a pipe '|', but since no standards were appended, the pipe '|' replaced the colon ':' From what I gathered from the V4L2 documents, USB video webcams rarely return standards, so I don't think my camera is mis-behaving by not returning any. I patched the code as seen below to only substitute a pipe '|' if the last character is a forward slash '/'. Also, in the regular expression, I had to change the S:([^|]+) from '+' to '*' so it matches 0 or more occurrences, not one or more occurrences.
Probing still doesn't work, I think the 'arp -a' command is now the culprit. It is located in /usr/sbin/arp on my system (Ubuntu 9.10). I'm suspecting the script is running under a environment that does not have /usr/sbin in its path. I haven't had time to look at this further and come up with a suitable fix.
My camera is now working with these modifications. Thanks for the software.
Josh
Code: Select all
diff -ur orig/ZoneMinder-1.24.2/src/zm_local_camera.cpp ZoneMinder-1.24.2/src/zm_local_camera.cpp
--- orig/ZoneMinder-1.24.2/src/zm_local_camera.cpp 2009-05-20 19:14:21.000000000 -0400
+++ ZoneMinder-1.24.2/src/zm_local_camera.cpp 2009-11-14 22:06:43.424748327 -0500
@@ -380,7 +380,7 @@
v4l2_data.fmt.fmt.pix.height = height;
v4l2_data.fmt.fmt.pix.pixelformat = palette;
//v4l2_data.fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
- v4l2_data.fmt.fmt.pix.field = V4L2_FIELD_ANY;
+ //v4l2_data.fmt.fmt.pix.field = V4L2_FIELD_ANY;
if ( vidioctl( vid_fd, VIDIOC_S_FMT, &v4l2_data.fmt ) < 0 )
Fatal( "Failed to set video format: %s", strerror(errno) );
@@ -841,7 +841,7 @@
sprintf( output+strlen(output), "%s/", standard.name );
}
while ( standardIndex++ >= 0 );
- if ( !verbose )
+ if ( !verbose && output[strlen(output)-1] == '/')
output[strlen(output)-1] = '|';
if ( verbose )
@@ -910,15 +910,29 @@
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if ( vidioctl( vid_fd, VIDIOC_G_CROP, &crop ) < 0 )
{
- Error( "Failed to query crop: %s", strerror(errno) );
- if ( verbose )
- sprintf( output, "Error, failed to query crop %s: %s\n", queryDevice, strerror(errno) );
- else
- sprintf( output, "error%d\n", errno );
- return( false );
- }
- if ( verbose )
- sprintf( output+strlen(output), " Current: %d x %d\n", crop.c.width, crop.c.height );
+ if(errno != EINVAL)
+ {
+ Error( "Failed to query crop: %s", strerror(errno) );
+ if ( verbose )
+ sprintf( output,
+ "Error, failed to query crop %s: %s\n",
+ queryDevice, strerror(errno) );
+ else
+ sprintf( output, "error%d\n", errno );
+
+ return( false );
+ }
+ else if ( verbose )
+ {
+ Info( "Does not support VIDIOC_G_CROP");
+ }
+ }
+ else
+ {
+ if ( verbose )
+ sprintf( output+strlen(output), " Current: %d x %d\n",
+ crop.c.width, crop.c.height );
+ }
struct v4l2_input input;
int inputIndex = 0;
diff -ur orig/ZoneMinder-1.24.2/web/skins/classic/views/monitorprobe.php ZoneMinder-1.24.2/web/skins/classic/views/monitorprobe.php
--- orig/ZoneMinder-1.24.2/web/skins/classic/views/monitorprobe.php 2009-05-28 04:45:50.000000000 -0400
+++ ZoneMinder-1.24.2/web/skins/classic/views/monitorprobe.php 2009-11-08 23:26:49.384248637 -0500
@@ -48,7 +48,7 @@
$preferredFormats = array( '422P', 'YUYV', 'BGR3' );
foreach ( $output as $line )
{
- if ( !preg_match( '/^d:([^|]+).*S:([^|]+).*F:([^|]+).*I:(\d+)\|(.+)$/', $line, $deviceMatches ) )
+ if ( !preg_match( '/^d:([^|]+).*S:([^|]*).*F:([^|]+).*I:(\d+)\|(.+)$/', $line, $deviceMatches ) )
die( "Can't parse command output '$line'" );
$standards = split('/',$deviceMatches[2]);
$preferredStandard = false;