FC5 Serial port baudrate issue

A place for discussion of topics that are not specific to ZoneMinder. This could include Linux, Video4Linux, CCTV cameras or any other topic.
Post Reply
jitz
Posts: 16
Joined: Fri Apr 21, 2006 9:39 pm

FC5 Serial port baudrate issue

Post by jitz »

Hi guys:

I have been investigating the perl serial port stuff some more and am
somewhat convinced that there may be a problem with the api regarding
FC5.

I tryed changing the baudrate in both
zmcontrol-pelco-p.pl ( org 4K8 )
zmcontrol-pelco-d.pl ( org 9K6 )

It just stays at the system default ( 9K6 ). If I change the PTZ camera's
to run a 9K6 communication works. If I change the baud rate to anything else
it fails
-IE change camera to 4K8 and zmcontol to 4K8 ( no work )
change camera to 9k6 and works.

I got the Perl::Serial from Dries but I don't know how to go about resolving the issue.
- I have changed ttyS0 to be rw by all ( 777 )

Any ideas???
-I can work around it, but would be nice to resolve


Thanks
Jitz

I don't think this is a general problem as I run my cameras at 2.4k anyway. I assume you have tried a simple test script with just the serial bits in it? Can you change the port speed with stty or minicom etc?
jitz
Posts: 16
Joined: Fri Apr 21, 2006 9:39 pm

continued

Post by jitz »

I put together a quick perl script to test changing the baudrate

Code: Select all

#!/usr/bin/perl -w

use Device::SerialPort qw( :PARAM :STAT 0.07 );;

my $device = "/dev/ttyS0";
my $serial_port = new Device::SerialPort( $device );

$serial_port->databits(8);
$serial_port->parity('none');
$serial_port->stopbits(1);
$serial_port->handshake('none');
 
$serial_port->read_const_time(50);
$serial_port->read_char_time(10);

if ( $serial_port->baudrate(2400) == 0 )
{
    printf "Waiting for 1ck\n" ;
}
else
{
    printf "Waiting for 2ck\n" ;
}

$count_out = $serial_port->write("Hello World");
printf "count out = %d\n", $count_out;

sleep(1);

$serial_port->close();

printf "hello world\n";[/code]

I verified that perl:Serial does modify the baudrate but when
I run script via zoneminder, it doesn't???

Kinda stumped. Sounds like it could be priviledges but on what/where??

Jitz
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The only things I can think of at the moment are that zmvideo-*.pl scripts are run in tainted mode (with the -wT) on the bang line. Or that there is something in having the script executed by apache.

You should be able to simulate both of these circumstances to eliminate them. If you do and it still doesn't work then I too will be a bit stumped.
Phil
Post Reply