mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
This is not really fhem stuff
git-svn-id: https://svn.fhem.de/fhem/trunk@1688 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
162f2e29e5
commit
ad52d13bfc
@ -1,13 +0,0 @@
|
||||
Normal ack is 0x11
|
||||
|
||||
- Fw 1.5, Packet 1, replaced first byte: 4a->3a
|
||||
ack = 22
|
||||
- Fw 1.5, Packet 1, replaced two bytes: 4a->0a, 84 -> c4
|
||||
ack = 22
|
||||
- Fw 1.5, Packet 1 replaced with packet 1 from fw 1.2a
|
||||
ack = 33, first packet ok
|
||||
- Fw 1.5, Inserted packet 1 from fw 1.2a before original packet 1
|
||||
ack = 33, first packet ok
|
||||
- Fw 1.5, Duplicated packet 1
|
||||
ack = 33, first packet ok
|
||||
|
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
if(@ARGV != 3) {
|
||||
die("Usage: extract_fw.pl update.exe <hex_offset> <output_file>\n" .
|
||||
" <hex_offset> is usually 25808\n")
|
||||
}
|
||||
|
||||
open(IN, $ARGV[0]) || die("$ARGV[0]: $!\n");
|
||||
open(OUT, ">$ARGV[2]") || die("$ARGV[2]: $!\n");
|
||||
|
||||
my ($b1, $b2);
|
||||
my $len = hex($ARGV[1]);
|
||||
(sysread(IN, $b1, $len) == $len) || die("Cannot read $ARGV[1]/$len bytes\n");
|
||||
|
||||
my $count = 0;
|
||||
for(;;) {
|
||||
(sysread(IN, $b1, 2) == 2) || last;
|
||||
$len = unpack("n", $b1);
|
||||
($len <= 255) || last;
|
||||
(sysread(IN, $b2, $len) == $len) || last;
|
||||
print OUT unpack("H*", $b1) . unpack("H*", $b2) . "\n";
|
||||
$count++;
|
||||
}
|
||||
print "Read $count packets\n";
|
||||
exit(0);
|
@ -1,44 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Device::SerialPort;
|
||||
|
||||
die("Usage: perl load_fw.pl firmware_file serial-device\n") if(@ARGV != 2);
|
||||
|
||||
open(IN, $ARGV[0]) || die("$ARGV[0]: $!\n");
|
||||
|
||||
#####################
|
||||
# Open serial port
|
||||
my $serport = new Device::SerialPort ($ARGV[1]);
|
||||
die "$ARGV[1]: $!\n" if(!$serport);
|
||||
$serport->reset_error();
|
||||
$serport->baudrate(38400);
|
||||
$serport->databits(8);
|
||||
$serport->parity('none');
|
||||
$serport->stopbits(1);
|
||||
$serport->handshake('none');
|
||||
|
||||
my $count;
|
||||
while(my $l = <IN>) {
|
||||
|
||||
chomp($l);
|
||||
my $buf = pack("H*", $l);
|
||||
$serport->write($buf);
|
||||
|
||||
my ($rout, $rin) = ('', '');
|
||||
vec($rin, $serport->FILENO, 1) = 1;
|
||||
my $nfound = select($rout=$rin, undef, undef, 3.0);
|
||||
|
||||
die("Select error $nfound / $!\n") if($nfound < 0);
|
||||
die("Timeout!\n") if($nfound == 0);
|
||||
|
||||
$buf = $serport->input();
|
||||
die("Received ".unpack("H*",$buf)." after $count packets\n")
|
||||
if(unpack("H*",$buf) ne "11");
|
||||
|
||||
$count++;
|
||||
print "$count\r";
|
||||
$| = 1;
|
||||
}
|
||||
print "$count packets written\n";
|
Loading…
Reference in New Issue
Block a user