Sanyo VCR RS232C control

~2007
Control Sanyo SSP enabled VCRs through RS232C.

Requires Device::SerialPort (nix) or Win32::SerialPort on windows.

Developed from the manual for the VZU-485/232C interface board. Tested and developed on a Sanyo SRT6000 security VCR.

Device-VCR-SSP-Serial-0.01.tar.gz

A rough terminal VCR control script is here. (source below) It works, but don't judge it too hard. Slapped together as I developed it. I'll probably polish it when I get a chance.

#!/usr/bin/perl

use strict;
use warnings;
use Time::HiRes qw(sleep);
use Device::SerialPort qw( :PARAM :STAT 0.07  );
use Device::VCR::SSP::Serial qw (:all);

BEGIN {
    $ENV{PERL_RL} = 'Gnu';
}

use Term::ReadLine;
my ( $PORTNAME, $BAUD, $DATABITS, $PARITY, $STOPBITS,
    $HANDSHAKE, $DTR )
  = qw (/dev/ttyS0 2400 8 none 1 rts F);

my $CLEAR = `clear`;

# INIT
my $Port = Device::SerialPort->new($PORTNAME)
  || die "Can't open port: $!\n";
$Port->databits($DATABITS);
$Port->baudrate($BAUD);
$Port->parity($PARITY);
$Port->stopbits($STOPBITS);
$Port->handshake($HANDSHAKE);
$Port->dtr_active($DTR) || die "Couldn't set DTR";
$Port->read_const_time(10000)
  ;    # delay in milliseconds per unfulfilled "read" call

my $vcr = Device::VCR::SSP::Serial->new(
    port_obj => $Port,
    debug    => 1
);
sleep 2;

sub show_res {
    my $res = shift;
    warn "Write command failed!" unless defined $res;
    if ( $res eq R_ACK ) {
        warn "ACK [$res] received.\n";
    }
    elsif ( $res eq R_NAK ) {
        warn "NAK [$res] received.\n";
    }
    else {
        warn "Unexpected response: ", $res, "\n";
    }
}

my $term     = Term::ReadLine->new("VCR Control");
my $OUT      = $term->OUT() || *STDOUT;
my @commands = ( $vcr->listcmd, 'QUIT' );
@commands = ( @commands, map { lc($_) } @commands );

my $attribs = $term->Attribs;
$attribs->{completion_entry_function} =
  $attribs->{list_completion_function};
$attribs->{completion_word} = [@commands];

my ( $cmd, $clean );

sub do_screen {
    print $CLEAR;
    print "Enter Command:\n";
    foreach ( grep { /^[A-Z]/ } @commands ) {
        print "\t", $_, "\n";
    }

}

$vcr->sendcmd('TL_ON');

do_screen();

while ( defined( $cmd = $term->readline('>') ) ) {
    do_screen();
    $cmd = uc($cmd);
    chomp($cmd);
    $cmd =~ s/\s*$//;
    if ( $cmd eq 'STATUS_SENSE' ) {
        $vcr->status_sense;
        warn $vcr->dump_status_sense();
    }
    elsif ( $cmd eq 'TL_STATUS_SENSE' ) {
        $vcr->tl_status_sense;
        warn $vcr->dump_tl_status_sense();

    }
    elsif ( $cmd eq 'QUIT' ) {
        last;

    }
    else {
        show_res( $vcr->sendcmd($cmd) );
    }

}
$vcr->sendcmd('TL_OFF');

undef $Port;
Scroll to top