#!/usr/bin/perl 

# 'unlock' scope front panel, in case it was left in a locked
# state by aborted acquisition program.


use Lab::Instrument::TDS2024B;
use Getopt::Long;

my $tmc_address;
my $visa_name;
my $usb_serial;
my $help = 0;

    
Getopt::Long::GetOptions(
    "tmc_address|t" => \$tmc_address,
    "visa_name|v" => \$visa_name,
    "usb_serial|u" => \$usb_serial,
    "h|?|help" => \$help,
    );

if ($help) {
    print "usage: $0 [options] INFILE\n";
    print "\t-tX --tmc_address=X                      use /dev/usbtmcX device\n";
    print "\t-vUSB... --visa_name=USB:0xAAAA::0xBBBB::0xCCCC  use visa-style address\n";
    print "\t-s\uSN     --usb_serial=SerialNumber       select device by serial number\n";
    print "\t-h -? --help                              this message\n";
    print "\n";
   
    print "If device is not specified, first TDS2024B found is used\n";
    exit(0);
}

my $args = {};
$args->{tmc_address} = $tmc_address if defined $tmc_address;
$args->{visa_name} = $visa_name if defined $visa_name;
$args->{usb_serial} = $usb_serial if defined $usb_serial;

my $s = new Lab::Instrument::TDS2024B($args) || die("failure to connect to TDS2024B");

$s->set_locked(0);
print "TDS2024B front panel unlocked\n";


