Allow easy selection of the serial device
This commit is contained in:
parent
b7155bbb71
commit
6ccd447870
|
@ -22,6 +22,7 @@ my $verbose = 0;
|
||||||
my $fast = 0;
|
my $fast = 0;
|
||||||
my $channel = 81;
|
my $channel = 81;
|
||||||
my $mac = "0102030201";
|
my $mac = "0102030201";
|
||||||
|
my $ser = undef;
|
||||||
my $help = 0;
|
my $help = 0;
|
||||||
my $intvl = 2;
|
my $intvl = 2;
|
||||||
my $lintvl = 60;
|
my $lintvl = 60;
|
||||||
|
@ -29,6 +30,7 @@ GetOptions (
|
||||||
"server=s" => \$server,
|
"server=s" => \$server,
|
||||||
"port=n" => \$port,
|
"port=n" => \$port,
|
||||||
"id=n" => \$id,
|
"id=n" => \$id,
|
||||||
|
"dev=s" => \$ser,
|
||||||
"fast" => \$fast,
|
"fast" => \$fast,
|
||||||
"verbose" => \$verbose,
|
"verbose" => \$verbose,
|
||||||
"channel=n" => \$channel,
|
"channel=n" => \$channel,
|
||||||
|
@ -40,7 +42,7 @@ if($help){
|
||||||
die "Currently no help. Please check the source\n";
|
die "Currently no help. Please check the source\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
r0ket::r0ket_init();
|
$ser=r0ket::r0ket_init($ser);
|
||||||
|
|
||||||
# Default openbeacon settings.
|
# Default openbeacon settings.
|
||||||
r0ket::set_txmac(pack("H*",$mac)); # Not really needed.
|
r0ket::set_txmac(pack("H*",$mac)); # Not really needed.
|
||||||
|
@ -73,7 +75,13 @@ my $errors=0;
|
||||||
my $ctr=0;
|
my $ctr=0;
|
||||||
my($lcrcerr,$lctr,$lerrors)=(0,0,0);
|
my($lcrcerr,$lctr,$lerrors)=(0,0,0);
|
||||||
if($verbose){
|
if($verbose){
|
||||||
print "OpenBeacon Reader $id sending to [$server:$port]\n";
|
my($dev)=$ser;
|
||||||
|
if(!defined $dev){
|
||||||
|
$dev="<undef>";
|
||||||
|
}else{
|
||||||
|
$dev=~s!/dev/!!;
|
||||||
|
};
|
||||||
|
print "OpenBeacon Reader $id sending [$dev] to [$server:$port]\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
};
|
};
|
||||||
my $lasttime=time;
|
my $lasttime=time;
|
||||||
|
|
|
@ -288,11 +288,7 @@ sub nice_beacon{
|
||||||
};
|
};
|
||||||
|
|
||||||
sub r0ket_init{
|
sub r0ket_init{
|
||||||
my $ser;
|
my $ser=shift;
|
||||||
if ($ARGV[0] eq "-s"){
|
|
||||||
shift;
|
|
||||||
$ser=shift;
|
|
||||||
};
|
|
||||||
if(!defined $ser){
|
if(!defined $ser){
|
||||||
if (defined $ENV{R0KETBRIDGE} && -e $ENV{R0KETBRIDGE}){
|
if (defined $ENV{R0KETBRIDGE} && -e $ENV{R0KETBRIDGE}){
|
||||||
$ser=$ENV{R0KETBRIDGE}
|
$ser=$ENV{R0KETBRIDGE}
|
||||||
|
@ -305,6 +301,7 @@ sub r0ket_init{
|
||||||
if($verbose){
|
if($verbose){
|
||||||
print "using: $ser\n";
|
print "using: $ser\n";
|
||||||
};
|
};
|
||||||
|
return $ser;
|
||||||
};
|
};
|
||||||
|
|
||||||
sub send_raw {
|
sub send_raw {
|
||||||
|
|
Loading…
Reference in New Issue