Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Forum for questions and support relating to the 1.26.x releases only.
Locked
tonys01
Posts: 2
Joined: Tue Dec 17, 2013 12:19 am

Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by tonys01 »

after repository upgrade getting these errors in log. I've included the log screen shot.
The cams are working as monitors, but a ptz d-link DCS5020L has lost controls after the update.
The monitor has kept all the original settings and the control script is still in the: /usr/share/perl/5.14.2/ZoneMinder/Control/DCS5020L.pm file.
Database was the latest version in 1.26.4.
I don't know where to look next...Help!!!

Tony
Attachments
Log
Log
zm_log.jpg (216.86 KiB) Viewed 7326 times
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by knight-of-ni »

Thanks for the feedback, Tonys01.
The workaround for this is to put the following line back into your zm.conf file:

Code: Select all

ZM_VERSION=1.26.5
We are working on removing this entirely from zm.conf, but apparently we missed something.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
tonys01
Posts: 2
Joined: Tue Dec 17, 2013 12:19 am

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN

Post by tonys01 »

Thanks knnniggett...
added as last line in zm.conf---> ZoneMinder RESTART--->works perfectly!...
I hope others can refer to this post and apply your fix as well.
Happy Holidays, and Best Wishes for a Happy and Healthy New Year!!

Tony
Biggus
Posts: 96
Joined: Mon Nov 18, 2013 9:15 am

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by Biggus »

*Posted in wrong place*
wmoore
Posts: 43
Joined: Mon Mar 29, 2004 2:25 am

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by wmoore »

Knnniggett, Tony,

I need a hand.

I am running an upgraded 1.26.5 install. After the install, I added a Mobotix camera as well as the PTZ control script I downloaded from this site. Everything looks to be in order, but when I attempt to manipulate the camera, I get exactly the error Tony experienced. I have checked the script and its permissions. everything looks good.

Code: Select all

FATEL ERROR "Can't connect: No such file or directory" from zmcontrol.pl
followed by:

Code: Select all

ERROR /usr/bin/zmcontrol.pl --command=Left --id=3>
When I run zmcontrol.pl from the command line, I get a string of the following:
Constant subrouteen ZoneMinder::ZM_VERSION redefined at /usr/share/perl/5.14.2/ZoneMinder.pm line 33
Protocol mismatch: sub ZoneMinder:: ZM_VERSION () vs none at /usr/share/perl/5.14.2/ZoneMinder.pm line 33
I assumed the fix was as Knnniggett identified, so I added ZM_VERSION=1.26.5 to zm.conf with no success.. I am at a loss for where to look next. My symptoms and log look exactly like Tony's.

A point in the correct direction would be appreciated.

Thanks in advance,

-WAM
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by knight-of-ni »

Well, it would have been helpful to see the whole script after you made your edits.

My advice would be to compare your script to the ptz control scripts here:
https://github.com/ZoneMinder/ZoneMinde ... er/Control

This folder will always contain the latest and greatest working scripts that have been incorporated into the source tree. If you are troubleshooting a custom script on the latest version, you can always look here and do a comaprison.

The control scripts in the Wiki don't automatically get updated when we make a change to the source so don't count on them working with the latest version of zoneminder.

Comparing your script to what is on github, you want to find the line that will look like this:

Code: Select all

$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
OR this

Code: Select all

$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
If it looks like the first then adding ZM_VERSION=1.26.5 to zm.conf is the simplest workaround.
If it looks like the second then don't add ZM_VERSION=1.26.5 to zm.conf, because the script has already been properly fixed.

From the sounds of it, your script might look like the second case, which would explain why perl is complaining you are trying to redefine a constant.

Lastly, once you get a working script please open a pull request on github to get it added to the source. There are some additional steps that must be done, but I'll step you through it. Once it has been added to the source, you won't ever have to modify the script again.... we will do it for you anytime a modification is required.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
wmoore
Posts: 43
Joined: Mon Mar 29, 2004 2:25 am

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by wmoore »

knnniggett,

Thanks for the quick reply.

From the looks of your notes, I am still a bit confused. The script I am using does look to incorporate the the 'fixed' line.

I am not sure if I have one or two issues here. The 'version redefinition' may be separate form the "no such file or directory" error out of zmcontrol.pl. I know the 'ZM_VERSION=1.26.5' setting in zm.conf is being read. If I remove it, the PanasonicIP.pm script fails.

Regarding the zmcontrol.pl "No such file or directory' feels like a permissions issue, but I have looked. The permissions and owner match the working PanasonicIP.pm script as does the file directory location. The package name, file name and protocol field all seem to match (Mobotix). I have been unable to get any more details even using debug logging.

I'll keep looking, but any guidance or ideas are welcome.

Once I get it going, I would be happy to merge it with github.

Thanks again.

-WAM

Code: Select all

2014-01-10 22:24:10.947593	web_php	2416	ERR	/usr/bin/zmcontrol.pl --panstep=0 --command=moveRelRight --id=3=>	/usr/share/zoneminder/includes/functions.php	2344

2014-01-10 22:24:10.942660	zmcontrol	2838	FAT	Can't connect: No such file or directory	zmcontrol.pl

Code: Select all

# ==========================================================================
#
# This module contains the implementation of the Mobotix protocol
# It is easy to adapt to all Mobotix cameras. We have found a lot of commands 
# using: http://<IP-Camera>/control/click.cgi?help or http://<IP-Camera>/control/click.cgi?list
# Any improve is welcome, and please share it
# Fabio Maresca AND Pasquale Riccio 
# fabio.maresca[at]gmail[dot]com 

package ZoneMinder::Control::Mobotix;

use 5.006;
use strict;
use warnings;

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

our $VERSION = $ZoneMinder::Base::VERSION;

# ==========================================================================
#
# Mobotix Control Protocol
#
# ==========================================================================

use ZoneMinder::Debug qw(:all);
use ZoneMinder::Config qw(:all);
Use ZoneMinder::Logger qw(:all);
use Time::HiRes qw( usleep );

sub new
{
    my $class = shift;
    my $id = shift;
    my $self = ZoneMinder::Control->new( $id );
    bless( $self, $class );
    srand( time() );
    return $self;
}

our $AUTOLOAD;

sub AUTOLOAD
{
    my $self = shift;
    my $class = ref($self) || croak( "$self not object" );
    my $name = $AUTOLOAD;
    $name =~ s/.*://;
    if ( exists($self->{$name}) )
    {
        return( $self->{$name} );
    }
    Fatal( "Can't access $name member of object of class $class" );
}

sub open
{
    my $self = shift;

    $self->loadMonitor();

    use LWP::UserAgent;
    $self->{ua} = LWP::UserAgent->new;
    [b]$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );[/b]

    $self->{state} = 'open';
}


sub close
{
    my $self = shift;
    $self->{state} = 'closed';
}

sub printMsg
{
    my $self = shift;
    my $msg = shift;
    my $msg_len = length($msg);

    Debug( $msg."[".$msg_len."]" );
}

sub sendCmd
{
    my $self = shift;
    my $cmd = shift;

    my $result = undef;

    printMsg( $cmd, "Tx" );
    #print( "http://$address/$cmd\n" );
    my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."$cmd" );
    my $res = $self->{ua}->request($req);

    if ( $res->is_success )
    {
        $result = !undef;
    }
    else
    {
        Error( "Error check failed: '".$res->status_line()."'" );
    }

    return( $result );
}

sub receiveCmd
{
    my $self = shift;
    my $cmd = shift;

    my $result = undef;

    printMsg( $cmd, "Rx" );
    #print( "http://$address/$cmd\n" );
    my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."$cmd" );
    my $res = $self->{ua}->request($req);
    my $content = $res->content();
    if ( $res->is_success )
    {
        $result = $content;
    }
    else
    {
        Error( "Error check failed: '".$res->status_line()."'" );
    }

    return( $result );
}


sub moveMap
{
    my $self = shift;
    my $params = shift;
    my $xcoord = $self->getParam( $params, 'xcoord' );
    my $ycoord = $self->getParam( $params, 'ycoord' );
    my $imagewidth = $self->{Monitor}->{Width};
    my $imageheight = $self->{Monitor}->{Height};
    Debug( "Move Map to $xcoord,$ycoord at $imagewidth/$imageheight" );
    if ( $imagewidth == "640" )
    {
    $xcoord = $xcoord/2;
    $ycoord = $ycoord/2;   
    }
    my $cmd = "/control/click.cgi?x=$xcoord&y=$ycoord";
    $self->sendCmd( $cmd );
}


sub moveRelLeft
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Left - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=-$step&y=0";
    $self->sendCmd( $cmd );
}

sub moveRelRight
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Right - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=$step&y=0";
    $self->sendCmd( $cmd );

}

sub moveRelUp
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Up - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=0&y=$step";
    $self->sendCmd( $cmd );
}

sub moveRelDown
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Down - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=0&y=-$step";
    $self->sendCmd( $cmd );
}

sub moveRelUpRight
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Up Right - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=$step&y=$step";
    $self->sendCmd( $cmd );
}

sub moveRelUpLeft
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Up Left - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=-$step&y=$step"
    $self->sendCmd( $cmd );
}

sub moveRelDownRight
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Down Right - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=$step&y=-$step";
    $self->sendCmd( $cmd );
}

sub moveRelDownLeft
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Move Down Left - Step $step" );
    my $cmd = "/control/click.cgi?moverel&x=-$step&y=-$step";
    $self->sendCmd( $cmd );
}


sub zoomRelTele
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Zoom Tele" );
    my $cmd = "/control/click.cgi?zoomrel=$step";
    $self->sendCmd( $cmd );
}

sub zoomRelWide
{
    my $self = shift;
    my $params = shift;
    my $step = $self->getParam( $params, 'step' );
    Debug( "Zoom Wide" );
    my $cmd = "/control/click.cgi?zoomrel=-$step";
    $self->sendCmd( $cmd );
}

sub presetClear
{
    my $self = shift;
    my $params = shift;
    Debug( "Clear All Presets" );
    my $cmd = "/control/click.cgi?delete_all_views";
    $self->sendCmd( $cmd );
}

sub presetSet
{
    my $self = shift;
    my $params = shift;
    my $preset = $self->getParam( $params, 'preset' );
    my $preset = ( $preset - 1 );
    my $cmd = "/control/click.cgi?setview=$preset";
    Debug( "Set Preset $preset" );
    $self->sendCmd( $cmd );
}

sub presetGoto
{
    my $self = shift;
    my $params = shift;
    my $preset = $self->getParam( $params, 'preset' );
    my $preset = ( $preset - 1 );
    Debug( "Goto Preset $preset" );
    my $cmd = "/control/click.cgi?loadview=$preset";
    $self->sendCmd( $cmd );
}

sub presetHome
{
    my $self = shift;
    Debug( "Home Preset" );
    my $cmd = "/control/click.cgi?zoom=1000";
    $self->sendCmd( $cmd );
}

1;
__END__
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by knight-of-ni »

I'll take a closer look tomorrow, but for starters remove the html bold tags:

Code: Select all

[b]$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );[/b]

Code: Select all

$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );
Oh, and to test your script for errors from the command line:

Code: Select all

perl ptz_script.pl
If it returns immediately with no output then the script is good to go.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by knight-of-ni »

Found the following typos in your script:

Change:

Code: Select all

Use ZoneMinder::Logger qw(:all);
to:

Code: Select all

use ZoneMinder::Logger qw(:all);
Lowercase "u".

Also, double check the script has been saved as "Mobotix.pl" with a capital "M".

And you need to delete this line:

Code: Select all

use ZoneMinder::Debug qw(:all);
You are missing a semicolon at the end of line 213:

Code: Select all

my $cmd = "/control/click.cgi?moverel&x=-$step&y=$step";
get rid of "my" in lines 272 & 283 since you already defined $preset in the preceding line:

Code: Select all

$preset = ( $preset - 1 );
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by knight-of-ni »

Now test your script like so:

Code: Select all

sudo perl Mobotix.pl
If the script immediately returns with no error message then you know your script is good.

If you get this error message:

Code: Select all

Bareword "ZM_VERSION" not allowed while "strict subs" in use at Mobotix.pl line 67.
Execution of Mobotix.pl aborted due to compilation errors.
Then make line 67 to look like this:

Code: Select all

$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
msteinwandel
Posts: 1
Joined: Tue Jan 21, 2014 11:50 am

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --SOLVED--

Post by msteinwandel »

Had exactly the same problem, after upgrading from 1.25 to 1.26.5 "No such file or directory" -Error and the PTZ-Controls not working at all. After I realized, that no more zmcontrol-sock-Files in /tmp/zm being created and also no zmcontrol-Processes running, I put back the "zmcontrol.pl" from Version 1.25 in the right place, and after this everything works perfect like before!

With the Linux "diff"-Command, I can't see big differences between the zmcontrol.pl-Files, so give it I try!!
helpme1986
Posts: 8
Joined: Sat Feb 08, 2014 10:47 am

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by helpme1986 »

Just wanted to thank knnniggett, your fix worked perfectly for me (after hours of messing!)

Thank you
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by knight-of-ni »

Good. Glad it worked for you.
If you would, I'd appreciate a return favor.
The soon-to-be-released 1.27 version of zoneminder is going to have a new tool with it, zmcamtool.pl, that will allow you to export the ptz control config from your database. Take your script and the exported information and create a pull request in github to add it to the zoneminder source.

That way, when (not if) we make another global change to ptz control scripts, you won't have to worry about manually updating your script.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
fri.K
Posts: 5
Joined: Tue Jul 26, 2011 7:53 pm

Re: Upgrade 1.26.4-->1.26.5 on ubuntu 12.04.3 --BROKEN--

Post by fri.K »

Hi
I also have problem with not creating zmcontrol-sock-Files in /tmp/zm like msteinwandel after upgrade from zm 1.25 to 1.26. I downloaded scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm from zoneminder's git(hub) added new control type for it and also have my old FoscamFI8908W.pm. Both are unable to PTZ cammera. Copping zmcontrol.pl from 1.25 gives nothing.

OS: Ubuntu 12.04.3 amd64
zoneminder: 1.26.5-1 from deb

I think control scripts are clean

Code: Select all

$ perl /usr/share/perl/5.14.2/ZoneMinder/Control/FoscamFI8908W.pm
$ perl /usr/share/perl/5.14.2/ZoneMinder/Control/FI8908W.pm
returns nothing.

directory content:

Code: Select all

/tmp/zm# ll
razem 7592
drwxr-xr-x  5 www-data www-data    4096 mar 14 09:39 ./
drwxrwxrwt 39 root     root     7749632 mar 14 09:39 ../
drwxrwxrwx  2 www-data www-data    4096 mar 11 08:03 log/
srwxr-xr-x  1 www-data www-data       0 mar 14 08:51 zmdc.sock=
-rw-r--r--  1 www-data www-data     512 mar 14 09:34 zm_debug.log.30043
drwxrwxrwx  2 www-data www-data    4096 mar 14 09:22 zmswap-m1/
drwxrwxrwx  2 www-data www-data    4096 mar 14 09:34 zmswap-m3/
debug log:

Code: Select all

03/14/14 09:34:09.557594 zmcontrol[30043].DBG [LogOpts: level=DBG/DBG, screen=OFF, database=ERR, logfile=DBG->/tmp/zm/zm_debug.log.30043, syslog=OFF]
03/14/14 09:34:09.558126 zmcontrol[30043].DBG [--autostop --command=moveConLeft --id=3]
03/14/14 09:34:09.558998 zmcontrol[30043].INF [Starting control server 3/FI8608W]
03/14/14 09:34:09.561234 zmcontrol[30045].INF [Control server 3/FI8608W starting at 14/03/14 09:34:09]
03/14/14 09:34:19.562087 zmcontrol[30043].FAT [Can't connect: No such file or directory]
What I'm missing?
Locked