zmcontrol not loading new control module [SOLVED]
zmcontrol not loading new control module [SOLVED]
Hi,
I am helping another user with getting their camera control working, with a remote cam running on the mjpg_streamer software.
I have created a new module (adapted from the PanasonicIP.pm module) for him, but for some reason I can't get it to work.
From my debuging it looks like the new module is not found by the 'load' command in zmcontrol.pm, but I can't see why (I must be missing something obvious here)
The new script was placed in the folder /usr/local/share/perl/5.8.8/ZoneMinder/Control/ and is called ' mjpg_streamer.pm'
At present (during my debugging) I have only set the new control to do a reset. Once I get that working, I can add the rest of the controls back.
I run:
zmcontrol.pl --id 1 --command=reset
Can't connect: No such file or directory at /usr/local/share/perl/5.8.8/ZoneMinder/Debug.pm line 349
ZoneMinder::Debug::Fatal('Can\'t connect: No such file or directory') called at /usr/local/bin/zmcontrol.pl line 157
which I have traced via the debug log to the fact that the load module command on line 175 of zmcontrol.pl is not actually loading in the new module. So I am obviously missing something to 'register' the new module in zoneminder.
Debug log (i added some extra debug messages to zmcontrol.pl while i was busy with this, so I can trace the execution path of the file)
12/01/09 11:38:57.253733 zmcontrol[21151].DBG [--id 1 --command=reset]
12/01/09 11:38:57.258953 zmcontrol[21151].DBG [mjpg_streamer]
12/01/09 11:38:57.259097 zmcontrol[21151].DBG [Trying as a module]
12/01/09 11:38:57.259158 zmcontrol[21151].INF [Starting control server 1/mjpg_streamer]
12/01/09 11:38:57.261908 zmcontrol[21152].DBG [doing the elsif]
12/01/09 11:38:57.267515 zmcontrol[21152].INF [Control server 1/mjpg_streamer starting at 09/01/12 11:38:57]
12/01/09 11:38:57.313956 zmcontrol[21151].DBG [Trying to connect to socket]
12/01/09 11:38:57.368671 zmcontrol[21152].DBG [attempting to call new method]
12/01/09 11:39:07.316686 zmcontrol[21151].FAT [Can't connect: No such file or directory]
The [Can't connect: No such file or directory] is caused by the fact that the control socket was never created , as the new module's 'new' method was never called.
The top part of my module is as such:
package ZoneMinder::Control::mjpg_streamer;
use 5.006;
use strict;
use warnings;
require ZoneMinder::Base;
require ZoneMinder::Control;
our @ISA = qw(ZoneMinder::Control);
our $VERSION = $ZoneMinder::Base::VERSION;
# ==========================================================================
#
# mjpg_streamer camera Control Protocol
#
# ==========================================================================
use ZoneMinder::Debug qw(:all);
use ZoneMinder::Config 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" );
}
I have tried this in 1.23.3 and the new 1.24, with same result.
Any pointers would be appreciated.
I am helping another user with getting their camera control working, with a remote cam running on the mjpg_streamer software.
I have created a new module (adapted from the PanasonicIP.pm module) for him, but for some reason I can't get it to work.
From my debuging it looks like the new module is not found by the 'load' command in zmcontrol.pm, but I can't see why (I must be missing something obvious here)
The new script was placed in the folder /usr/local/share/perl/5.8.8/ZoneMinder/Control/ and is called ' mjpg_streamer.pm'
At present (during my debugging) I have only set the new control to do a reset. Once I get that working, I can add the rest of the controls back.
I run:
zmcontrol.pl --id 1 --command=reset
Can't connect: No such file or directory at /usr/local/share/perl/5.8.8/ZoneMinder/Debug.pm line 349
ZoneMinder::Debug::Fatal('Can\'t connect: No such file or directory') called at /usr/local/bin/zmcontrol.pl line 157
which I have traced via the debug log to the fact that the load module command on line 175 of zmcontrol.pl is not actually loading in the new module. So I am obviously missing something to 'register' the new module in zoneminder.
Debug log (i added some extra debug messages to zmcontrol.pl while i was busy with this, so I can trace the execution path of the file)
12/01/09 11:38:57.253733 zmcontrol[21151].DBG [--id 1 --command=reset]
12/01/09 11:38:57.258953 zmcontrol[21151].DBG [mjpg_streamer]
12/01/09 11:38:57.259097 zmcontrol[21151].DBG [Trying as a module]
12/01/09 11:38:57.259158 zmcontrol[21151].INF [Starting control server 1/mjpg_streamer]
12/01/09 11:38:57.261908 zmcontrol[21152].DBG [doing the elsif]
12/01/09 11:38:57.267515 zmcontrol[21152].INF [Control server 1/mjpg_streamer starting at 09/01/12 11:38:57]
12/01/09 11:38:57.313956 zmcontrol[21151].DBG [Trying to connect to socket]
12/01/09 11:38:57.368671 zmcontrol[21152].DBG [attempting to call new method]
12/01/09 11:39:07.316686 zmcontrol[21151].FAT [Can't connect: No such file or directory]
The [Can't connect: No such file or directory] is caused by the fact that the control socket was never created , as the new module's 'new' method was never called.
The top part of my module is as such:
package ZoneMinder::Control::mjpg_streamer;
use 5.006;
use strict;
use warnings;
require ZoneMinder::Base;
require ZoneMinder::Control;
our @ISA = qw(ZoneMinder::Control);
our $VERSION = $ZoneMinder::Base::VERSION;
# ==========================================================================
#
# mjpg_streamer camera Control Protocol
#
# ==========================================================================
use ZoneMinder::Debug qw(:all);
use ZoneMinder::Config 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" );
}
I have tried this in 1.23.3 and the new 1.24, with same result.
Any pointers would be appreciated.
Last edited by dedmeet on Wed Jan 14, 2009 10:35 pm, edited 1 time in total.
-
- Posts: 41
- Joined: Thu Jan 01, 2009 8:11 am
Was hoping maybe someone could help us out. This orbit cam is pretty inexpensive and when teamed up with the Linksys NSLU2 or similar device creates a very powerful remote control camera. Thanks for working on this dedmeet, hopefully you'll figure it all out.
I'm still messing with it and reading up on controls. but at my rate it would take me years to figure it out
I'm still messing with it and reading up on controls. but at my rate it would take me years to figure it out

I am basically waiting to see if someone can help out here, as I am stuck, additionally - I am now working on a dealine for next week the 21st, so I have to put this aside for a bit to get my paid work donefoxtroop11 wrote:Was hoping maybe someone could help us out. This orbit cam is pretty inexpensive and when teamed up with the Linksys NSLU2 or similar device creates a very powerful remote control camera. Thanks for working on this dedmeet, hopefully you'll figure it all out.
I'm still messing with it and reading up on controls. but at my rate it would take me years to figure it out

When I have a moment/gap again between my work schedules, I will check with you and get back onto this.
Good luck
Hi,cordel wrote:Have you checked to make sure the permissions on the file are correct?
It's the only time I see this error for the modules.
Thank you for the reply.
Can you give a hint what the right perms should be?
/usr/local/share/perl/5.8.8/ZoneMinder/Control $ ls -la
total 92
drwxr-xr-x 2 root root 4096 2009-01-12 11:10 .
drwxr-xr-x 4 root root 4096 2009-01-12 10:45 ..
-r--r--r-- 1 root root 10999 2008-02-25 18:49 AxisV2.pm
-r--r--r-- 1 root root 7390 2009-01-12 11:10 mjpg_streamer.pm
-r--r--r-- 1 root root 7391 2009-01-12 11:10 mjpg_streamer.pm~
-r--r--r-- 1 root root 5283 2008-02-25 18:49 Ncs370.pm
-r--r--r-- 1 root root 7391 2008-02-25 18:49 PanasonicIP.pm
-r--r--r-- 1 root root 18952 2008-02-25 18:49 PelcoD.pm
-r--r--r-- 1 root root 20114 2008-02-25 18:49 Visca.pm
Just to mention, I changed the control to use the PanasonicIP.pm module, and with debugging enabled, I can clearly see the module loads, and the 'New' method is called.
If i just rename the module from Panasonic.pm to soemething else (I used mjpgStreamer.pm), and then try and use it as such, then it does not load.
This is weird, as the code inside was not changed, only the name.
Hi,cordel wrote:Looks good.
Have you set the proper package name in the file?dedmeet wrote:This is weird, as the code inside was not changed, only the name.
package ZoneMinder::Control::<Module>;
This is required.
If you still have issues, Maybe try taking out the underscore in the file name.
yes the package name is set as : package ZoneMinder::Control::mjpg_streamer;
I also did the whole thing without the underscore, as package ZoneMinder::Control::mjpgStreamer; (file name including), but I will give that a try again, just to make sure I have not missed renaming it somewhere. The last time I was a bit frustrated, so I could have missed something.
I was looking into how to debug perl modules, so i can debug the module on it's own, but unfortunately work has gotten in the way (hate it when that happens)
I know it is going to be something stupid that i am doing....
ZoneMinder expects the module to have <Module>.pm and that the package name in the file is package ZoneMinder::Control::<Module>; it drops the extension for the package name.
You should be able to rise the debug from the console in options->debug.
You can also rise the debug level in zmcontrol.pl by editing that script and setting debug accordingly maybe if it's not overridden by the setting in the database.
You should be able to rise the debug from the console in options->debug.
You can also rise the debug level in zmcontrol.pl by editing that script and setting debug accordingly maybe if it's not overridden by the setting in the database.
Success.cordel wrote:ZoneMinder expects the module to have <Module>.pm and that the package name in the file is package ZoneMinder::Control::<Module>; it drops the extension for the package name.
You should be able to rise the debug from the console in options->debug.
You can also rise the debug level in zmcontrol.pl by editing that script and setting debug accordingly maybe if it's not overridden by the setting in the database.
I dumped everything, and started over.
The new control is now loaded, and controls the camera via mjpg_streamer program
File sent to other user for testing, and if it works for him I will post the script on my site for others to use.
Thank you for your help
-
- Posts: 41
- Joined: Thu Jan 01, 2009 8:11 am
Dedmeet,
Thanks for all your help and work on this. Emailed you this morning my time to confirm it's working. The camera is attached to a Linksys NSLU2 with a custom openwrt firmware running mjpg_streamer. It's amazing, sitting in the other room with Zoneminder moving the camera all over the place.
I love modding things and hope I sparked your intererst back into the Orbit
If I could just get a response now on why we have to go into PHPmyadmin and directly edit the controls for it to save that would make it so much easier setting up cameras. I guess I should have mentioned, I've been doing all this on 8.04 Kubuntu.
Thanks for all your help and work on this. Emailed you this morning my time to confirm it's working. The camera is attached to a Linksys NSLU2 with a custom openwrt firmware running mjpg_streamer. It's amazing, sitting in the other room with Zoneminder moving the camera all over the place.
I love modding things and hope I sparked your intererst back into the Orbit

If I could just get a response now on why we have to go into PHPmyadmin and directly edit the controls for it to save that would make it so much easier setting up cameras. I guess I should have mentioned, I've been doing all this on 8.04 Kubuntu.
I'm having similar troubles and posted about them here:
http://www.zoneminder.com/forums/viewto ... highlight=
Maybe someone listening to this thread can help.
Thanks,
http://www.zoneminder.com/forums/viewto ... highlight=
Maybe someone listening to this thread can help.
Thanks,
MRD
Did you find a cause or reason for this in the end. I'm having similar issues (Intrepid 8.10, Zoneminder 1.24-rc1-2740). zmcontrol.pl seems to hang/halt on the load module part.dedmeet wrote: Success.
I dumped everything, and started over.
The new control is now loaded, and controls the camera via mjpg_streamer program
Name, permissions all seem correct but nothing is happening.
Code: Select all
load "ZoneMinder::Control::$protocol";