Subversion Repositories HomeAutomation

Rev

Rev 902 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 902 Rev 1618
Line 36... Line 36...
36
open (FP, "+<".$biosfile) or die "Error: Cannot open file $biosfile\n";
36
open (FP, "+<".$biosfile) or die "Error: Cannot open file $biosfile\n";
37
@file = <FP>;
37
@file = <FP>;
38
close FP;
38
close FP;
39
$foundrow = 0;
39
$foundrow = 0;
40
foreach $file (@file) {
40
foreach $file (@file) {
41
    if ($file =~ m/^NODE_HW_ID=<GENERATE_HW>/) {
41
    if ($file =~ m/^NODE_HW_ID=/) {
42
        $foundrow = 1;
42
        $foundrow = 1;
43
    }
43
    }
44
}
44
}
45
if ($foundrow == 0) {
45
if ($foundrow == 0) {
46
    print "Error: Did not find NODE_HW_ID=<GENERATE_HW> in file $biosfile\n";
46
    print "Error: Did not find NODE_HW_ID= in file $biosfile\n";
47
    exit 1;
47
    exit 1;
48
}
48
}
49
 
49
 
50
#print "\n";
50
#print "\n";
51
print "Connect your node to the CAN-network (disconnect it first if it's already connected)\n";
51
print "Connect your node to the CAN-network (disconnect it first if it's already connected)\n";
Line 73... Line 73...
73
                        open (FP, "<".$biosfile) or die "Cannot open file $biosfile\n";
73
                        open (FP, "<".$biosfile) or die "Cannot open file $biosfile\n";
74
                        @file = <FP>;
74
                        @file = <FP>;
75
                        close FP;
75
                        close FP;
76
                        open (FP, ">".$biosfile) or die "Cannot open file $biosfile\n";
76
                        open (FP, ">".$biosfile) or die "Cannot open file $biosfile\n";
77
                        foreach $file (@file) {
77
                        foreach $file (@file) {
78
                            $file =~ s/^NODE_HW_ID=<GENERATE_HW>/NODE_HW_ID=0x$hwidhex/g;
78
                            $file =~ s/^NODE_HW_ID=.*/NODE_HW_ID=0x$hwidhex/g;
79
                            print FP $file;
79
                            print FP $file;
80
                        }
80
                        }
81
                        close FP;
81
                        close FP;
82
                       
82
                       
83
                        exit 0;
83
                        exit 0;