Subversion Repositories HomeAutomation

Rev

Rev 1877 | Rev 1890 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1877 Rev 1885
Line 1... Line 1...
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
 
2
 
3
# Written by Mattias Runge 2008-2010
3
# Written by Mattias Runge 2008-2010
4
 
4
 
5
use Cwd 'abs_path';
5
use Cwd 'abs_path';
-
 
6
use File::Basename;
6
 
7
 
7
$| = 1;
8
$| = 1;
8
 
9
 
9
$numArgs = $#ARGV + 1;
10
$numArgs = $#ARGV + 1;
10
 
11
 
Line 54... Line 55...
54
if ($hwid eq "")
55
if ($hwid eq "")
55
{
56
{
56
    die "You must specify a hardware id!\n";
57
    die "You must specify a hardware id!\n";
57
    exit 1;
58
    exit 1;
58
}
59
}
-
 
60
 
-
 
61
my $path = dirname(abs_path($0));
-
 
62
 
-
 
63
# Read atom functions from separate file
-
 
64
if (-e $path."/setConfig/AtomLib.pl") {
-
 
65
    require $path."/setConfig/AtomLib.pl";
-
 
66
} else {
-
 
67
    print "Error: No AtomLib.pl was found in ".$path.". \n\n";
-
 
68
    exit 1;
-
 
69
}
-
 
70
 
59
 
71
 
60
#0x14f90d1f to 0x1f0df914
72
#0x14f90d1f to 0x1f0df914
61
@hwidChars = split(//, $hwid);
73
@hwidChars = split(//, $hwid);
62
$hwid = $hwidChars[0]. $hwidChars[1]. uc($hwidChars[8]. $hwidChars[9]. $hwidChars[6]. $hwidChars[7]. $hwidChars[4]. $hwidChars[5]. $hwidChars[2]. $hwidChars[3]);
74
$hwid = $hwidChars[0]. $hwidChars[1]. uc($hwidChars[8]. $hwidChars[9]. $hwidChars[6]. $hwidChars[7]. $hwidChars[4]. $hwidChars[5]. $hwidChars[2]. $hwidChars[3]);
63
 
75
 
Line 67... Line 79...
67
print "Hexfile: " . $filename . "\n";
79
print "Hexfile: " . $filename . "\n";
68
print "Parameters: " . "\n";
80
print "Parameters: " . "\n";
69
 
81
 
70
if ($reset eq "true" && $filename eq "")
82
if ($reset eq "true" && $filename eq "")
71
{
83
{
-
 
84
    $socket = atomd_initialize($hostname, $port);
-
 
85
    atomd_send_command($socket, "Node_Reset $hwid");
-
 
86
    print atomd_read_command_response($socket);
-
 
87
    exit(1);
72
    my $result = system("atomic -s $hostname -p $port -c \"Node_Reset $hwid\"");
88
    #my $result = system("atomic -s $hostname -p $port -c \"Node_Reset $hwid\"");
73
    exit($result);
89
    #exit($result);
74
}
90
}
75
else
91
else
76
{
92
{
-
 
93
    $socket = atomd_initialize($hostname, $port);
-
 
94
    atomd_send_command($socket, "Node_Program $hwid $bios $filename");
-
 
95
    print atomd_read_command_response($socket);
-
 
96
    exit(1);
77
    my $result = system("atomic -s $hostname -p $port -c \"Node_Program $hwid $bios $filename\"");
97
    #my $result = system("atomic -s $hostname -p $port -c \"Node_Program $hwid $bios $filename\"");
78
        exit($result);
98
    #    exit($result);
79
}
99
}
80
 
100
 
81
exit(0);
101
exit(0);