PZT with Foscam FI8918W

Forum for questions and support relating to the 1.24.x releases only.
Locked
jacknunyo
Posts: 9
Joined: Wed Dec 07, 2011 12:09 am

PZT with Foscam FI8918W

Post by jacknunyo »

hello all,

I can't get panning and tilting working with my FoscamFI8918W.

Running ZM1.24.4 on Ubuntu 11.4, all yum installed and working fine with a USB cam and a Trendnet wifi cam. Video is working for the Foscam8918 in ZM. Using the cam web interface, panning and tilting works fine.

I followed the instructions here without any trouble:
http://www.zoneminder.com/wiki/index.php/Foscam_FI8918W
added the control 'protocol' file, configured ZM for the control option.

But much like the last couple of posts on this thread:
http://www.zoneminder.com/forums/viewto ... oscam+8918
When I click the control buttons on the video page nothing happens but I get no errors anywhere I can find.

In another thread I found how to enable debug in zmcontrol.pl, and this is what I see in the log:
tail -f zmcontrol.log
12/06/2011 17:58:50.528067 zmcontrol[24875].DBG [--autostop --command=moveConRight --id=7]
12/06/2011 17:58:50.530989 zmcontrol[24875].INF [Starting control server 7/Foscam]
12/06/2011 17:58:50.540508 zmcontrol[24876].INF [Control server 7/Foscam starting at 11/12/06 17:58:50]

Running the zmcontrol.pl from the command line:
/var/log/zm$ sudo /usr/bin/zmcontrol.pl --autostop --command=moveConRight --id=7
/var/log/zm$ echo $?
0

no errors when I use perl to run the pm file:
/usr/share/perl5/ZoneMinder/Control$ sudo perl FoscamFI8918W.pm
/usr/share/perl5/ZoneMinder/Control$

No errors, but the cam does not move. I checked the apache2 error logs, and syslog... nothing.

I have removed added the monitor and reconfigured the script thinking I just missed something somewhere, but no luck.

Any suggestions would be appreciated! What else can I do to debug this?
jacknunyo
Posts: 9
Joined: Wed Dec 07, 2011 12:09 am

Re: PZT with Foscam FI8918W

Post by jacknunyo »

Ok, I've spent some time with wireshark and I'm convinced that ZM is not sending the commands to move the camera.

First I captured moving the cam with the built-in web gui and see packets containing /decoder_control.cgi?command=#. Ah ha! A web search and I found the IPCAM SDK and this is starting to make a little sense. Now I'm ready to capture while ZM controls the cam, and... I never see any decoder_control commands.

I also tried running zmcontrol.pl with the options from the zmcontrol.log file and again nothing in the sniffer trace. (Well, I get thousands of packets of the video streaming, but nothing for control.)

I can even control the cam using firefox: httx://192.168.x.x/decoder_control.cgi?command=6 and I get an OK back and the cam moves right.

So... I don't know. I see that when I feed zmcontrol bogus control options like so:
sudo /usr/bin/zmcontrol.pl --autostop --command=moveConxxxx --id=7

it will be logged:
12/06/2011 23:06:15.502105 zmcontrol[5792].DBG [--autostop --command=moveConxxxx --id=7]
12/06/2011 23:06:15.504916 zmcontrol[5792].INF [Starting control server 7/Foscam]
12/06/2011 23:06:15.509055 zmcontrol[5793].INF [Control server 7/Foscam starting at 11/12/06 23:06:15]

But nothing errors out anywhere. I can even change the --id= to an index number of a monitor I don't even have configured and no errors.

So, what? Maybe my .pm file is bad? I took it 'as is' from the referenced web page. Permissions are 755.

How can I debug zmcontrol.pl's interaction with the .pm file?

thanks for any help!
leeroybrown
Posts: 17
Joined: Thu Nov 17, 2011 10:29 pm

Re: PZT with Foscam FI8918W

Post by leeroybrown »

How did you get the script to the zm dir ? You did a cp from the command line ? I too have had a problem with it, I could be wrong but I think you have to make it writable by zm ? I just settled for using the web for tilting ....
jacknunyo
Posts: 9
Joined: Wed Dec 07, 2011 12:09 am

Re: PZT with Foscam FI8918W

Post by jacknunyo »

Hi, been playing around with the control again.

I reloaded the script from the durdle web site, <url to durdle site removed because forum bot thinks it's spam>, to make sure I hadn't muffed it somehow. I just load it up in web browser, copy it to the clipboard and paste into vi. I've done this a lot with various scripts and never had a problem.

No change, same problem. What I've found is I can go into the control settings for the cam and change various options and it makes no difference. I can change the control address to a bogus IP. I can change the control type to a different device like the Neu-Fusion, or the Panasonic IP cam and zmcontrol will log the control server starting, but no errors... very odd.

I see in the zmcontrol.pl script it does checks that the socket is opened and commands are not bogus, but even with debug on and a bogus ip, it shows no errors. How can I enter a bogus IP and not get an errors somewhere!?! How can I enter a bogus control commands and get no errors! gah, this is killing me!!11!

12/08/11 15:52:19.110766 zmcontrol[28012].INF [Control server 7/PanasonicIP starting at 11/12/08 15:52:19]
12/08/11 15:57:21.516370 zmcontrol[28098].DBG [--autostop --command=moveConLeft --id=7]
12/08/11 15:57:21.520525 zmcontrol[28098].INF [Starting control server 7/PanasonicIP]
12/08/11 15:57:21.549901 zmcontrol[28099].INF [Control server 7/PanasonicIP starting at 11/12/08 15:57:21]
12/08/11 15:58:52.598416 zmcontrol[28115].DBG [--autostop --command=moveConRight --id=7]
12/08/11 15:58:52.601073 zmcontrol[28115].INF [Starting control server 7/PanasonicIP]
12/08/11 15:58:52.604705 zmcontrol[28116].INF [Control server 7/PanasonicIP starting at 11/12/08 15:58:52]
12/08/11 16:00:59.676294 zmcontrol[28156].DBG [--autostop --command=moveConRight --id=7]
12/08/11 16:07:50.116791 zmcontrol[28410].INF [Control server 7/Ncs370 starting at 11/12/08 16:07:50]
12/08/11 16:08:01.249130 zmcontrol[28412].DBG [--autostop --command=moveConRight --id=7]
12/08/11 16:08:01.251458 zmcontrol[28412].INF [Starting control server 7/Ncs370]
12/08/11 16:08:01.254561 zmcontrol[28413].INF [Control server 7/Ncs370 starting at 11/12/08 16:08:01]

12/08/2011 16:19:59.612817 zmcontrol[28498].DBG [--id=7 --autostop --command=bogusMoveBogus]
12/08/2011 16:19:59.615702 zmcontrol[28498].INF [Starting control server 7/Ncs370]
12/08/2011 16:19:59.620578 zmcontrol[28499].INF [Control server 7/Ncs370 starting at 11/12/08 16:19:59]

bah! see that: --command=bogusMoveBogus and no errors! wtf, why even have debug if that doesn't log anything! Am I not looking in the right place!? Nothing in /var/log/syslog. Nothing in any of the logs for /var/log/zm... I set extra_debug to level 5 and look in /tmp/zm and dig through all those files and I see no control errors. For the love of pete, what am I missing?!

I'm usually pretty good at noodling through problems and really want this to work. This really bugs me. I'll reinstall if I have to. What's the most reliable linux flavor? Not really liking the new ubuntu 11.10 anyway. :)
leeroybrown
Posts: 17
Joined: Thu Nov 17, 2011 10:29 pm

Re: PZT with Foscam FI8918W

Post by leeroybrown »

How did you get the script to the ZM dir ? Did you do a cp from the command line ? Did you also check the permissions of the file? The bluecherry-zm-livecd 2.0b.iso is an easy install, I believe that its 1.24.2 and I tested with a VM and seems to be working off the hop. When I tried to get the script to the zm control folder I tried to do a drag and drop but the control folder needed su to do it. Permissions should be 777 not 755. Please correct me if I am wrong, I too need help with this one.
hamishcross
Posts: 3
Joined: Sun Feb 05, 2012 4:15 pm

Re: PZT with Foscam FI8918W

Post by hamishcross »

I too am having the same problems. I'm running Ubuntu 11.10.

My zmcontrol appears to be acting exactly the same.

The files were copied from clipboard to a ssh terminal and then permissions modified.

I even tried giving the file 777 but that doesn't seem to have made a difference.

Tracking the outgoing requests to the camera web server using:

sudo tcpflow -c -i eth1 tcp port 80 | grep 'GET'

I see only connections retrieving the image, nothing to update the position.

Any help on this one guys?

Logs only show...

02/05/12 16:19:02.273911 zmcontrol[13967].INF [Starting control server 5/FoscamFI8918W]
02/05/12 16:19:02.276813 zmcontrol[13968].INF [Control server 5/FoscamFI8918W starting at 12/02/05 16:19:02]


Nothing else.....

Plzzzzz help :)
hamishcross
Posts: 3
Joined: Sun Feb 05, 2012 4:15 pm

Re: PZT with Foscam FI8918W

Post by hamishcross »

As a work around... I modified the script a little, then put it in a cgi-bin folder on my server. So I can access those files to move the camera as required.

Script:

Code: Select all

#!/usr/bin/perl
# setup the request
use LWP::UserAgent;
$ua = new LWP::UserAgent;

print "content-type: text/plain\n\n";

$req = new HTTP::Request 'POST','cameraip/decoder_control.cgi?command=0&user=username&pwd=password';
$req->content_type('application/x-www-form-urlencoded');
$res = $ua->request($req);
if ($res->is_error) 
{
	print "Error Sending command";
}

print "\nMoving Camera result: ";
print $res->content;

#SLEEP FOR 1 SECOND WHILE MOVE IS DONE
sleep 1;


$req = new HTTP::Request 'POST','cameraip/decoder_control.cgi?command=1&user=username&pwd=password';
$req->content_type('application/x-www-form-urlencoded');
$res = $ua->request($req);
if ($res->is_error) 
{
	print "Error Sending command";
}

print "\nStopping Camera result: ";
print $res->content;


[/code

That for example moves the camera up.
c4t0r
Posts: 3
Joined: Tue Jul 19, 2011 10:25 am

Re: PZT with Foscam FI8918W

Post by c4t0r »

Just to mention; having the almost the same problem here.
Foscam 8908W on Ubuntu 11.04 Server x64, no valuable Debug output either. wget the proper URL makes the cam move.
I even tried various .pm-files (simple one from the wiki, more complicated with iris, presets etc.) and it works with none of them. I'm almost sure my old config worked a while ago (maybe pre 10.10).
Just to have a rough guess; the bug might be around the Control.pm. But without the required Perl-skills i'll have to wait helplessly for the next release...
Intel D945GCLF2 (Atom 330 mITX) - 1 GB DDR2 - 250GB Samsung Spinpoint IDE HDD - Chieftec Bt-02b
Foscam FI8904W
Foscam FI8905W
Foscam FI8908W
4x TP-Link TL-PA411 Powerline
c4t0r
Posts: 3
Joined: Tue Jul 19, 2011 10:25 am

Re: PZT with Foscam FI8918W [SOLVED?]

Post by c4t0r »

I got my Foscam (FI8908W - no matter) working;
First tried to solve the problem by upgrading to 1.25 (ppa:dajhorn/zoneminder - changed MySQL rights for zmuser) without any success.
Then i changed the line

Code: Select all

use ZoneMinder::Debug qw(:all);
to

Code: Select all

use ZoneMinder::Logging qw(:all);
inside the Perl-Control-Script (stayed with 1.25).

And what a miracle: now it's working! PTZ with charme :-D
Intel D945GCLF2 (Atom 330 mITX) - 1 GB DDR2 - 250GB Samsung Spinpoint IDE HDD - Chieftec Bt-02b
Foscam FI8904W
Foscam FI8905W
Foscam FI8908W
4x TP-Link TL-PA411 Powerline
Locked