Implemented additional checks. Add force flag to flash firmware even if modem is in BIOS mode.
This commit is contained in:
@@ -18,6 +18,7 @@ func FwExists(path string) bool {
|
||||
return !errors.Is(err, os.ErrNotExist)
|
||||
}
|
||||
|
||||
// ChkHeader: runs header and CRC checks on the firmware file
|
||||
func ChkHeader(fwfile string) error {
|
||||
log.Info("checking ", fwfile)
|
||||
// SCS has two different file layouts, one for the "Dragons", the other for any older modem
|
||||
@@ -62,9 +63,7 @@ func ChkHeader(fwfile string) error {
|
||||
size = uint32(binary.LittleEndian.Uint16(firmware[2:4])) // PTC-3 and Co
|
||||
}
|
||||
a := make([]byte, 4)
|
||||
//binary.LittleEndian.PutUint32(a, crc32.ChecksumIEEE(firmware[4:size+4])) // PTC-3
|
||||
binary.LittleEndian.PutUint32(a, crc32.ChecksumIEEE(firmware[offset:offset+size]))
|
||||
//if bytes.Equal(a, firmware[4+size:8+size]) { // PTC-3
|
||||
if bytes.Equal(a, firmware[offset+size:offset+size+4]) {
|
||||
log.Info("CRC checksum ok!")
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user